machinekit-hal icon indicating copy to clipboard operation
machinekit-hal copied to clipboard

Compile failure in rtapi/rtapi_math/e_asin.c

Open ArcEye opened this issue 7 years ago • 8 comments

Issue by mbuesch Thu Aug 11 21:10:49 2016 Originally opened as https://github.com/machinekit/machinekit/issues/1035


Compiling rtapi/rtapi_math/e_asin.c
rtapi/rtapi_math/e_asin.c: In function ‘__ieee754_asin’:
rtapi/rtapi_math/e_asin.c:98:8: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
      } else
        ^~~~
rtapi/rtapi_math/e_asin.c:100:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘else’
   p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5)))));
   ^
cc1: all warnings being treated as errors
Makefile:391: recipe for target 'objects/rtapi/rtapi_math/e_asin.o' failed

I'm not sure what the correct code would be. If the indent is correct (and thus the code is incorrect), asin seems to generate incorrect values for very small inputs.

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by mhaberler Tue Aug 16 10:07:55 2016


I think @strahlex imported this code

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by mhaberler Wed Aug 17 17:30:58 2016


@strahlex : I cannot even find any reference from where this code originated - could you help reverse-engineer/document the whereabouts?

the code fragment @mbuesch alluded to definitely looks fishy, and it would be valuable now to have some reference to the code base

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by mbuesch Wed Aug 17 17:36:13 2016


It seems to originate from an ancient BSD codebase http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libm/src/e_asin.c

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by mhaberler Wed Aug 17 18:26:34 2016


there seem to be all sorts of variations of this file, and different attempts at patching this up:

https://android.googlesource.com/platform/bionic/+/7581f9c/libm/upstream-freebsd/lib/msun/src/e_asin.c http://www.scs.stanford.edu/histar/src/pkg/uclibc/libm/e_asin.c https://bugzilla.mozilla.org/show_bug.cgi?id=933257 05-fix-else-branch.patch https://github.com/freebsd/freebsd/commit/d95c118b83b9227e11b22b271e9a8fb9f29a0ed7 http://lists.uclibc.org/pipermail/uclibc/2002-May/024269.html https://bugzilla.mozilla.org/show_bug.cgi?id=405053

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by mbuesch Wed Aug 17 20:13:32 2016


Why is this needed anyway? Can't we replace it by something sane?

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by mhaberler Thu Aug 18 20:44:14 2016


absolutely - need to find a trustable source first ;)

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by machinekoder Fri Aug 19 18:06:50 2016


It's part of the libm source code and yes it is absolutely crazy code. If you have a better working version feel free to fix it. We introduced this file because the sin implementation of the libm shipped with Debian causes real-time delays for certain values. Ideal replacement would be something with deterministic processing time.

ArcEye avatar Aug 03 '18 15:08 ArcEye

Comment by machinekoder Fri Aug 19 18:08:15 2016


See also https://github.com/machinekit/machinekit/issues/629

ArcEye avatar Aug 03 '18 15:08 ArcEye