www.digitalmars.com Home | Search | D | Comments
Last update Mon Aug 22 2005
D
Language
Phobos
Comparisons


object

std
 std.base64
 std.boxer
 std.compiler
 std.conv
 std.ctype
 std.date
 std.file
 std.format
 std.gc
 std.intrinsic
 std.math
 std.md5
 std.mmfile
 std.openrj
 std.outbuffer
 std.path
 std.process
 std.random
 std.recls
 std.regexp
 std.socket
 std.socketstream
 std.stdint
 std.stdio
 std.cstream
 std.stream
 std.string
 std.system
 std.thread
 std.uri
 std.utf
 std.zip
 std.zlib

std.windows

std.linux

std.c
 std.c.stdio

std.c.windows

std.c.linux

std.math

const real PI
const real LOG2
const real LN2
const real LOG2T
const real LOG2E
const real E
const real LOG10E
const real LN10
const real PI_2
const real PI_4
const real M_1_PI
const real M_2_PI
const real M_2_SQRTPI
const real SQRT2
const real SQRT1_2
Math constants.

real acos(real)
real asin(real)
real atan(real)
real atan2(real, real)

real cos(real x)
Compute cosine of x. x is in radians.
Special values:
x return value invalid?
±∞ NAN yes

real sin(real x)
Compute sine of x. x is in radians.
Special values:
x return value invalid?
±0.0 ±0.0 no
±∞ NAN yes

real tan(real x)
Compute tangent of x. x is in radians.
Special values:
x return value invalid?
±0.0 ±0.0 no
±∞ NAN yes

real cosh(real)
real sinh(real)
real tanh(real)
real exp(real)

real frexp(real value, out int exp)
Calculate and return x and exp such that:
value=x*2exp
.5 <= |x| < 1.0
x has same sign as value.
Special values:
value x exp
±0.0 ±0.0 0
+∞ +∞ int.max
-∞ -∞ int.min
±NAN ±NAN int.min

real ldexp(real n, int exp)
Compute n * 2exp

real log(real x)
Calculate the natural logarithm of x.
Special values:
x return value divide by 0? invalid?
±0.0 -∞ yes no
< 0.0 NAN no yes
+∞ +∞ no no

real log10(real x)
Calculate the base-10 logarithm of x.
Special values:
x return value divide by 0? invalid?
±0.0 -∞ yes no
< 0.0 NAN no yes
+∞ +∞ no no

real modf(real, real*)

real pow(real, real)

real sqrt(real x)
creal sqrt(creal x)
Compute square root of x.
Special values:
x return value invalid?
-0.0 -0.0 no
<0.0 NAN yes
+∞ +∞ no

real ceil(real)
real floor(real)

real log1p(real x)
Calculates the natural logarithm of 1 + x. For very small x, log1p(x) will be more accurate than log(1 + x).
Special values:
x log1p(x) divide by 0? invalid?
±0.0 ±0.0 no no
-1.0 -∞ yes no
<-1.0 NAN no yes
+∞ -∞ no no

real expm1(real x)
Calculates the value of the natural logarithm base (e) raised to the power of x, minus 1. For very small x, expm1(x) is more accurate than exp(x)-1.
Special values:
x ex-1
±0.0 ±0.0
+∞ +∞
-∞ -1.0

real atof(char*)
Math functions.

real hypot(real x, real y)
Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y:
	sqrt(x2 + y2)
Note that hypot(x,y), hypot(y,x) and hypot(x,-y) are equivalent.
Special values:
x y return value invalid?
x ±0.0 fabs(x) no
±∞ y +∞ no
±∞ NAN +∞ no

int isnan(real e)
Is number a nan?

int isfinite(real e)
Is number finite?

int isnormal(float f)
int isnormal(double d)
int isnormal(real e)
Is number normalized?

int issubnormal(float f)
int issubnormal(double d)
int issubnormal(real e)
Is number subnormal? (Also called "denormal".) Subnormals have a 0 exponent and a 0 most significant mantissa bit.

int isinf(real e)
Is number infinity?

int signbit(real e)
Get sign bit.

real copysign(real to, real from)
Copy sign.

int feqrel(real x, real y)
To what precision is x equal to y?
Returns the number of mantissa bits which are equal in x and y. eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.
If x == y, then feqrel(x, y) == real.mant_dig.
If x and y differ by a factor of two or more, or if one or both is a nan, the return value is 0.

Feedback and Comments

Add feedback and comments regarding this page.
Copyright © 1999-2005 by Digital Mars, All Rights Reserved