Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

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 usinga local clone.

core.math

Builtin mathematical intrinsics

Sourcecore/math.d

License:
Boost License 1.0.
Authors:
Walter Bright, Don Clugston
pure nothrow @nogc @safe floatcos(floatx);

pure nothrow @nogc @safe doublecos(doublex);

pure nothrow @nogc @safe realcos(realx);
Returns cosine of x. x is in radians.
Special Values
xcos(x)invalid?
NANNANyes
±∞NANyes
Bugs:
Results are undefined if |x| >= 264.
pure nothrow @nogc @safe floatsin(floatx);

pure nothrow @nogc @safe doublesin(doublex);

pure nothrow @nogc @safe realsin(realx);
Returns sine of x. x is in radians.
Special Values
xsin(x)invalid?
NANNANyes
±0.0±0.0no
±∞NANyes
Bugs:
Results are undefined if |x| >= 264.
pure nothrow @nogc @safe longrndtol(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 floatsqrt(floatx);

pure nothrow @nogc @safe doublesqrt(doublex);

pure nothrow @nogc @safe realsqrt(realx);
Compute square root of x.
Special Values
xsqrt(x)invalid?
-0.0-0.0no
<0.0NANyes
+∞+∞no
pure nothrow @nogc @safe floatldexp(floatn, intexp);

pure nothrow @nogc @safe doubleldexp(doublen, intexp);

pure nothrow @nogc @safe realldexp(realn, intexp);
Compute n * 2exp

Referencesfrexp

pure nothrow @nogc @safe floatfabs(floatx);
Compute the absolute value.
Special Values
xfabs(x)
±0.0+0.0
±∞+∞
It is implemented as a compiler intrinsic.
Parameters:
floatxfloating point value
Returns:
|x|

Referencesequivalent tostd.math.fabs

pure nothrow @nogc @safe doublefabs(doublex);
ditto
Compute the absolute value.
Special Values
xfabs(x)
±0.0+0.0
±∞+∞
It is implemented as a compiler intrinsic.
Parameters:
doublexfloating point value
Returns:
|x|

Referencesequivalent tostd.math.fabs

pure nothrow @nogc @safe realfabs(realx);
ditto
Compute the absolute value.
Special Values
xfabs(x)
±0.0+0.0
±∞+∞
It is implemented as a compiler intrinsic.
Parameters:
realxfloating point value
Returns:
|x|

Referencesequivalent tostd.math.fabs

pure nothrow @nogc @safe floatrint(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 floatyl2x(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.
TtoPrec(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. ThetoPrec() function forces rounding of the argumentf to the precision of the specified floating point typeT. 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:
Tprecision type to round to
floatfvalue to convert
Returns:
f in precision of typeT
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Fri Feb 20 00:51:35 2026

[8]ページ先頭

©2009-2026 Movatter.jp