CustomFloat

Allows user code to define custom floating-point formats. These formats are for storage only; all operations on them are performed by first implicitly extracting them to real first. After the operation is completed the result can be stored in a custom floating-point value via assignment.

  1. template CustomFloat(uint bits)
  2. template CustomFloat(uint precision, uint exponentWidth, CustomFloatFlags flags = CustomFloatFlags.ieee)
  3. struct CustomFloat(uint precision, uint exponentWidth, CustomFloatFlags flags, uint bias)

Constructors

this
this(F input)

Initialize from any real compatible type.

Members

Aliases

opCast
alias opCast = get

Fetches the stored value either as a float, double or real.

Functions

opAssign
void opAssign(F input)

Self assignment

opAssign
void opAssign(F input)

Assigns from any real compatible type.

opBinary
real opBinary(T b)
opBinaryRight
real opBinaryRight(T a)
opCmp
int opCmp(T b)
opOpAssign
void opOpAssign(T b)

Convert the CustomFloat to a real and perform the relevant operator on the result

opUnary
real opUnary()

Convert the CustomFloat to a real and perform the relevant operator on the result

Manifest constants

mant_dig
enum mant_dig;

the number of bits in mantissa

max_exp
enum max_exp;

maximum int value such that 2<sup>max_exp-1</sup> is representable

min_exp
enum min_exp;

minimum int value such that 2<sup>min_exp-1</sup> is representable as a normalized value

Properties

dig
size_t dig [@property getter]
epsilon
CustomFloat epsilon [@property getter]
get
F get [@property getter]

Fetches the stored value either as a float, double or real.

im
CustomFloat im [@property getter]
infinity
CustomFloat infinity [@property getter]
max
CustomFloat max [@property getter]
max_10_exp
int max_10_exp [@property getter]
min_10_exp
int min_10_exp [@property getter]
min_normal
CustomFloat min_normal [@property getter]
nan
CustomFloat nan [@property getter]
re
CustomFloat re [@property getter]

Templates

toString
template toString()

Convert the CustomFloat to a real and perform the relevant operator on the result

Meta