Float

A multiprecision float. TODO: needs to be implemented using BigInt.

Constructors

this
this()

Constructs a Float initialized to NaN.

this
this(Float x)

Constructs from a Float. Copies x.

this
this(real x)

Constructs from a real.

this
this(int x)

Constructs from an int.

this
this(uint x)

Constructs from a uint.

this
this(long x)

Constructs from a long.

this
this(ulong x)

Constructs from a ulong.

this
this(double x)

Constructs from a double.

this
this(cstring x, int base = 10)

Constructs from a string.

this
this(cchar* x, int base = 10)

Constructs from a zero-terminated string.

this
this(out int retcode, cstring str)

Constructs from a string and outputs a precision return code.

Members

Functions

abs
Float abs()

Sets the number to its absolute value. Returns itself.

acos
Float acos()

Calculates acos(x). Returns itself.

asin
Float asin()

Calculates asin(x). Returns itself.

atan
Float atan()

Calculates atan(x). Returns itself.

atan2
Float atan2(Float x)

Calculates atan(y/x). Returns itself.

cos
Float cos()

Calculates cos(x). Returns itself.

dup
Float dup()

Returns a deep copy of this number.

equals
bool equals(Float x, uint bits)

Returns true if the first bits of $(f) and x are equal.

exp
Float exp()

Calculates e$(SUP x). Returns itself.

fraction
Float fraction()

Sets $(f) to frac($(f)). Returns itself.

hypot
Float hypot(Float y)

Calculates hypot(x, y) = √(x² + y²). Returns itself.

isInf
bool isInf()

Returns true for an infinite number.

isNInf
bool isNInf()

Returns true for negative infinity.

isNaN
bool isNaN()

Returns true for a NaN.

isNeg
bool isNeg()

Returns true if negative.

isPInf
bool isPInf()

Returns true for positive infinity.

isZero
bool isZero()

Returns true for zero.

ln
Float ln()

Calculates ln(x). Returns itself.

log10
Float log10()

Calculates log10(x). Returns itself.

log2
Float log2()

Calculates log2(x). Returns itself.

neg
Float neg()

Negates this number.

opAdd
Float opAdd(T x)

Calculates $(f) + x.

opAddAssign
Float opAddAssign(Float x)

Calculates $(f) += x.

opAddAssign
Float opAddAssign(uint x)

Calculates $(f) += x.

opCmp
int opCmp(Float x)
int opCmp(double x)
int opCmp(int x)
int opCmp(uint x)

Compares $(f) to x.

opDiv
Float opDiv(T x)

Calculates $(f) / x.

opDivAssign
Float opDivAssign(Float x)

Calculates $(f) /= x.

opDivAssign
Float opDivAssign(uint x)

Calculates $(f) /= x.

opDiv_r
Float opDiv_r(uint x)

Calculates x / $(f).

opEquals
bool opEquals(Object x)

Compares $(f) to x.

opEquals
bool opEquals(Float x)
bool opEquals(double x)
bool opEquals(int x)
bool opEquals(uint x)

Compares $(f) to x.

opMod
Float opMod(Float x)

Calculates $(f) % x.

opModAssign
Float opModAssign(Float x)

Calculates $(f) %= x.

opMul
Float opMul(T x)

Calculates $(f) * x.

opMulAssign
Float opMulAssign(Float x)

Calculates $(f) *= x.

opMulAssign
Float opMulAssign(uint x)

Calculates $(f) *= x.

opNeg
Float opNeg()

Returns a negated copy of this number.

opSub
Float opSub(T x)

Calculates $(f) - x.

opSubAssign
Float opSubAssign(Float x)

Calculates $(f) -= x.

opSubAssign
Float opSubAssign(uint x)

Calculates $(f) -= x.

opSub_r
Float opSub_r(uint x)

Calculates x - $(f).

pow
Float pow(uint x)

Calculates $(f)$(SUP x). Returns itself.

sin
Float sin()

Calculates sin(x). Returns itself.

sqrt
Float sqrt()

Calculates √$(f). Returns itself.

square
Float square()

Calculates $(f)². Returns itself.

tan
Float tan()

Calculates tan(x). Returns itself.

toHex
char[] toHex()

Returns the internals of the data structure as a hex string.

toString
string toString()

Returns this float as a string.

toString
char[] toString(uint precision)

Returns this float as a string. Formatted in the scientific representation.

Static functions

opCall
Float opCall(Params P)

For convenient construction of Floats.

sqrt
Float sqrt(uint x)

Calculates √x. Returns a new Float.

Variables

f
real f;

Implemented using a 'real' for now.

Meta