@@ -64,7 +64,7 @@ version (D_HardFloat)
64
64
Unqual! F pow (F, G)(F x, G n) @nogc @trusted pure nothrow
65
65
if (isFloatingPoint! (F) && isIntegral! (G))
66
66
{
67
- import std .math.algebraic : abs ;
67
+ import core .math : fabs ;
68
68
import std.math.rounding : floor;
69
69
import std.math.traits : isNaN;
70
70
import std.traits : Unsigned;
@@ -100,13 +100,13 @@ if (isFloatingPoint!(F) && isIntegral!(G))
100
100
//
101
101
// We use the following two conclusions:
102
102
//
103
- // m * floor(log2(abs (v))) >= F.max_exp
104
- // => abs (v) ^^ m > F.max == nextDown(F.infinity)
103
+ // m * floor(log2(fabs (v))) >= F.max_exp
104
+ // => fabs (v) ^^ m > F.max == nextDown(F.infinity)
105
105
//
106
106
// m * (bias - ex - 1) >= bias + F.mant_dig - 1
107
- // => abs (v) ^^ m < 2 ^^ (-bias - F.mant_dig + 2) == nextUp(0.0)
107
+ // => fabs (v) ^^ m < 2 ^^ (-bias - F.mant_dig + 2) == nextUp(0.0)
108
108
//
109
- // floor(log2(abs (v))) == ex - bias can be directly taken from the
109
+ // floor(log2(fabs (v))) == ex - bias can be directly taken from the
110
110
// exponent of the floating point represantation, to avoid long
111
111
// calculations here.
112
112
@@ -132,8 +132,8 @@ if (isFloatingPoint!(F) && isIntegral!(G))
132
132
// in CTFE we cannot access the bit patterns and have therefore to
133
133
// fall back to the (slower) general case
134
134
// skipping subnormals by setting ex = bias
135
- ex = abs (v) == F.infinity ? 2 * bias + 1 :
136
- (abs (v) < F.min_normal ? bias : cast (ulong ) (floor(log2(abs (v))) + bias));
135
+ ex = fabs (v) == F.infinity ? 2 * bias + 1 :
136
+ (fabs (v) < F.min_normal ? bias : cast (ulong ) (floor(log2(fabs (v))) + bias));
137
137
}
138
138
else
139
139
{
@@ -148,8 +148,8 @@ if (isFloatingPoint!(F) && isIntegral!(G))
148
148
// In the general case we have to fall back to log2, which is slower, but still
149
149
// a certain speed gain compared to not bailing out early.
150
150
// skipping subnormals by setting ex = bias
151
- ulong ex = abs (v) == F.infinity ? 2 * bias + 1 :
152
- (abs (v) < F.min_normal ? bias : cast (ulong ) (floor(log2(abs (v))) + bias));
151
+ ulong ex = fabs (v) == F.infinity ? 2 * bias + 1 :
152
+ (fabs (v) < F.min_normal ? bias : cast (ulong ) (floor(log2(fabs (v))) + bias));
153
153
}
154
154
155
155
// m * (...) can exceed ulong.max, we therefore first check m >= (...).
@@ -490,7 +490,7 @@ if (isIntegral!I && isFloatingPoint!F)
490
490
Unqual! (Largest! (F, G)) pow(F, G)(F x, G y) @nogc @trusted pure nothrow
491
491
if (isFloatingPoint! (F) && isFloatingPoint! (G))
492
492
{
493
- import std .math.algebraic : fabs, sqrt;
493
+ import core .math : fabs, sqrt;
494
494
import std.math.traits : isInfinity, isNaN, signbit;
495
495
496
496
alias Float = typeof (return );
@@ -1203,7 +1203,7 @@ private T expImpl(T)(T x) @safe pure nothrow @nogc
1203
1203
}
1204
1204
1205
1205
// Scale by power of 2.
1206
- x = ldexp(x, n);
1206
+ x = core.math. ldexp (x, n);
1207
1207
1208
1208
return x;
1209
1209
}
@@ -1697,7 +1697,7 @@ private T expm1Impl(T)(T x) @safe pure nothrow @nogc
1697
1697
1698
1698
// We have qx = exp(remainder LN2) - 1, so:
1699
1699
// exp(x) - 1 = 2^^n (qx + 1) - 1 = 2^^n qx + 2^^n - 1.
1700
- px = ldexp(cast (T) 1.0 , n);
1700
+ px = core.math. ldexp (cast (T) 1.0 , n);
1701
1701
x = px * qx + (px - cast (T) 1.0 );
1702
1702
1703
1703
return x;
@@ -2091,7 +2091,7 @@ private T exp2Impl(T)(T x) @nogc @safe pure nothrow
2091
2091
}
2092
2092
2093
2093
// Scale by power of 2.
2094
- x = ldexp(x, n);
2094
+ x = core.math. ldexp (x, n);
2095
2095
2096
2096
return x;
2097
2097
}
@@ -3145,7 +3145,7 @@ real log(real x) @safe pure nothrow @nogc
3145
3145
real log10 (real x) @safe pure nothrow @nogc
3146
3146
{
3147
3147
import std.math.constants : LOG2 , LN2 , SQRT1_2 ;
3148
- import std.math.algebraic : fabs, poly;
3148
+ import std.math.algebraic : poly;
3149
3149
import std.math.traits : isNaN, isInfinity, signbit;
3150
3150
3151
3151
version (INLINE_YL2X)
@@ -3251,15 +3251,14 @@ real log10(real x) @safe pure nothrow @nogc
3251
3251
*/
3252
3252
real log1p (real x) @safe pure nothrow @nogc
3253
3253
{
3254
- import std.math.algebraic : fabs;
3255
3254
import std.math.traits : isNaN, isInfinity, signbit;
3256
3255
import std.math.constants : LN2 ;
3257
3256
3258
3257
version (INLINE_YL2X)
3259
3258
{
3260
3259
// On x87, yl2xp1 is valid if and only if -0.5 <= lg(x) <= 0.5,
3261
3260
// ie if -0.29 <= x <= 0.414
3262
- return (fabs(x) <= 0.25 ) ? core.math.yl2xp1 (x, LN2 ) : core.math.yl2x (x+ 1 , LN2 );
3261
+ return (core.math. fabs (x) <= 0.25 ) ? core.math.yl2xp1 (x, LN2 ) : core.math.yl2x (x+ 1 , LN2 );
3263
3262
}
3264
3263
else
3265
3264
{
0 commit comments