mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-26 01:08:39 +09:00
Issue #1291 - Part 2: Stop using the lib's sqrt() function
Use <cmath>'s functions over fdlibm's for performance reasons. No significant precision loss when doing this.
This commit is contained in:
parent
ddb27ac3e9
commit
b6c0bdd7da
10 changed files with 17 additions and 459 deletions
|
|
@ -46,6 +46,7 @@
|
|||
* than 1 ulps (units in the last place)
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <float.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
|
@ -105,7 +106,7 @@ __ieee754_hypot(double x, double y)
|
|||
t1 = 0;
|
||||
SET_HIGH_WORD(t1,ha);
|
||||
t2 = a-t1;
|
||||
w = sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
|
||||
w = std::sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
|
||||
} else {
|
||||
a = a+a;
|
||||
y1 = 0;
|
||||
|
|
@ -114,7 +115,7 @@ __ieee754_hypot(double x, double y)
|
|||
t1 = 0;
|
||||
SET_HIGH_WORD(t1,ha+0x00100000);
|
||||
t2 = a - t1;
|
||||
w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
|
||||
w = std::sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
|
||||
}
|
||||
if(k!=0) {
|
||||
u_int32_t high;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue