Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
core.math
Builtin mathematical intrinsics
Source core/math.d
License:
Authors:
Walter Bright,
Don Clugston
- pure nothrow @nogc @safe float
cos
(floatx
);
pure nothrow @nogc @safe doublecos
(doublex
);
pure nothrow @nogc @safe realcos
(realx
); - Returns cosine of x. x is in radians.
Special Values x cos(x) invalid? NAN NAN yes ±∞ NAN yes Bugs:Results are undefined if |x| >= 264. - pure nothrow @nogc @safe float
sin
(floatx
);
pure nothrow @nogc @safe doublesin
(doublex
);
pure nothrow @nogc @safe realsin
(realx
); - Returns sine of x. x is in radians.
Special Values x sin(x) invalid? NAN NAN yes ±0.0 ±0.0 no ±∞ NAN yes Bugs:Results are undefined if |x| >= 264. - pure nothrow @nogc @safe long
rndtol
(floatx
);
pure nothrow @nogc @safe longrndtol
(doublex
);
pure nothrow @nogc @safe longrndtol
(realx
); - Returns x rounded to a long value using the current rounding mode. If the integer value of x is greater than long.max, the result is indeterminate.
- pure nothrow @nogc @safe float
sqrt
(floatx
);
pure nothrow @nogc @safe doublesqrt
(doublex
);
pure nothrow @nogc @safe realsqrt
(realx
); - Compute square root of x.
Special Values x sqrt(x) invalid? -0.0 -0.0 no <0.0 NAN yes +∞ +∞ no - pure nothrow @nogc @safe float
ldexp
(floatn
, intexp
);
pure nothrow @nogc @safe doubleldexp
(doublen
, intexp
);
pure nothrow @nogc @safe realldexp
(realn
, intexp
); - Compute n * 2exp
References frexp
- pure nothrow @nogc @safe float
fabs
(floatx
); - Compute the absolute value.
Special Values x fabs(x) ±0.0 +0.0 ±∞ +∞ Parameters:float x
floating point value Returns:|x|References equivalent to std.math.
fabs
- pure nothrow @nogc @safe double
fabs
(doublex
); - dittoCompute the absolute value.
Special Values x fabs(x) ±0.0 +0.0 ±∞ +∞ Parameters:double x
floating point value Returns:|x|References equivalent to std.math.
fabs
- pure nothrow @nogc @safe real
fabs
(realx
); - dittoCompute the absolute value.
Special Values x fabs(x) ±0.0 +0.0 ±∞ +∞ Parameters:real x
floating point value Returns:|x|References equivalent to std.math.
fabs
- pure nothrow @nogc @safe float
rint
(floatx
);
pure nothrow @nogc @safe doublerint
(doublex
);
pure nothrow @nogc @safe realrint
(realx
); - Rounds x to the nearest integer value, using the current rounding mode. If the return value is not equal to x, the FE_INEXACT exception is raised. nearbyint performs the same operation, but does not set the FE_INEXACT exception.
- pure nothrow @nogc @safe float
yl2x
(floatx
, floaty
);
pure nothrow @nogc @safe doubleyl2x
(doublex
, doubley
);
pure nothrow @nogc @safe realyl2x
(realx
, realy
);
pure nothrow @nogc @safe doubleyl2xp1
(doublex
, doubley
);
pure nothrow @nogc @safe realyl2xp1
(realx
, realy
); - Building block functions, they translate to a single x87 instruction.
- T
toPrec
(T : float)(floatf
);
TtoPrec
(T : float)(doublef
);
TtoPrec
(T : float)(realf
);
TtoPrec
(T : double)(floatf
);
TtoPrec
(T : double)(doublef
);
TtoPrec
(T : double)(realf
);
TtoPrec
(T : real)(floatf
);
TtoPrec
(T : real)(doublef
);
TtoPrec
(T : real)(realf
); - Round argument to a specific precision.D language types specify only a minimum precision, not a maximum. The
toPrec
() function forces rounding of the argumentf
to the precision of the specified floating point type T. The rounding mode used is inevitably target-dependent, but will be done in a way to maximize accuracy. In most cases, the default is round-to-nearest.Parameters:T precision type to round to float f
value to convert Returns:f in precision of type T
Copyright © 1999-2024 by the D Language Foundation | Page generated by
Ddoc on Sun Nov 17 01:06:52 2024