std.math

Contains the elementary mathematical functions (powers, roots, and trigonometric functions), and low-level floating-point operations. Mathematical special functions are available in std.mathspecial.

The functionality closely follows the IEEE754-2008 standard for floating-point arithmetic, including the use of camelCase names rather than C99-style lower case names. All of these functions behave correctly when presented with an infinity or NaN.

The following IEEE 'real' formats are currently supported:

  • 64 bit Big-endian 'double' (eg PowerPC)
  • 128 bit Big-endian 'quadruple' (eg SPARC)
  • 64 bit Little-endian 'double' (eg x86-SSE2)
  • 80 bit Little-endian, with implied bit 'real80' (eg x87, Itanium)
  • 128 bit Little-endian 'quadruple' (not implemented on any known processor!)
  • Non-IEEE 128 bit Big-endian 'doubledouble' (eg PowerPC) has partial support

Unlike C, there is no global 'errno' variable. Consequently, almost all of these functions are pure nothrow.

Modules

algebraic
module std.math.algebraic

This is a submodule of std.math.

constants
module std.math.constants

This is a submodule of std.math.

exponential
module std.math.exponential

This is a submodule of std.math.

hardware
module std.math.hardware

This is a submodule of std.math.

operations
module std.math.operations

This is a submodule of std.math.

remainder
module std.math.remainder

This is a submodule of std.math.

rounding
module std.math.rounding

This is a submodule of std.math.

traits
module std.math.traits

This is a submodule of std.math.

trigonometry
module std.math.trigonometry

This is a submodule of std.math.

Public Imports

std.math.algebraic
public import std.math.algebraic;
std.math.constants
public import std.math.constants;
std.math.exponential
public import std.math.exponential;
std.math.operations
public import std.math.operations;
std.math.hardware
public import std.math.hardware;
std.math.remainder
public import std.math.remainder;
std.math.rounding
public import std.math.rounding;
std.math.traits
public import std.math.traits;
std.math.trigonometry
public import std.math.trigonometry;
std.meta
deprecated public import std.meta : AliasSeq;

Meta

Authors

Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw and David Nadlinger