-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix musl float arithmetic and move it into sub-library #1177
base: master
Are you sure you want to change the base?
Conversation
static __inline uint16_t __bswap16(uint16_t __x) | ||
{ | ||
return __x<<8 | __x>>8; | ||
} | ||
|
||
static __inline uint32_t __bswap32(uint32_t __x) | ||
{ | ||
return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; | ||
return __x>>24 | (__x>>8&0xff00) | (__x<<8&0xff0000) | __x<<24; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a compiler warning
} | ||
|
||
static __inline uint64_t __bswap64(uint64_t __x) | ||
{ | ||
return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32); | ||
return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a compiler warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collects exp_data.h
, exp_data.c
, and exp.c
into a single translation unit.
musl-trans/cbits/musl/log.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collects log_data.h
, log_data.c
, and log.c
into a single translation unit.
musl-trans/cbits/musl/pow.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collects pow_data.h
, pow_data.c
, exp_data.h
, exp_data.c
, and pow.c
into a single translation unit.
musl-trans/cbits/musl/sqrt.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collects sqrt_data.c
and sort.c
into a single translation unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libm.h
with just what is needed to compile pow.c
, sqrt.c
, log.c
, and exp.c
. Also all symbols are prefixed with kadena
a double. (int32_t)KI is the k used in the argument reduction and exponent | ||
adjustment of scale, positive k here means the result may overflow and | ||
negative k means the result may underflow. */ | ||
static inline double kadena_specialcase(double_t tmp, uint64_t sbits, uint64_t ki) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static inline double kadena_specialcase(double_t tmp, uint64_t sbits, uint64_t ki) | |
static inline double specialcase(double_t tmp, uint64_t sbits, uint64_t ki) |
/* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */ | ||
tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5); | ||
if (kadena_predict_false(abstop == 0)) | ||
return kadena_specialcase(tmp, sbits, ki); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return kadena_specialcase(tmp, sbits, ki); | |
return specialcase(tmp, sbits, ki); |
Is this PR obsoleted by #1184 ? |
I would call this PR an improvement upon it. Except that now, this PR is only doing a pure code reorg, and no longer attempting to fix an issue. |
On some systems the c implementation of transcendental float arithmetic could result in wrong results due to conflicts with symbols in the system
libm
.This PR