fix musl float arithmetic and move it into sub-library#1177
fix musl float arithmetic and move it into sub-library#1177
Conversation
| 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.
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.
Fixes a compiler warning
There was a problem hiding this comment.
Collects exp_data.h, exp_data.c, and exp.c into a single translation unit.
There was a problem hiding this comment.
Collects log_data.h, log_data.c, and log.c into a single translation unit.
There was a problem hiding this comment.
Collects pow_data.h, pow_data.c, exp_data.h, exp_data.c, and pow.c into a single translation unit.
There was a problem hiding this comment.
Collects sqrt_data.c and sort.c into a single translation unit.
There was a problem hiding this comment.
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.
| 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.
| 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