# std/num/double▲toc

Various operations on a 64-bit IEEE `doublestd/core/double: V`.

Return if two doubles are nearly equal with respect to an `epsilon` of `8*dbl-epsilonstd/num/double/dbl-epsilon: double`. See also `nearly-eqstd/num/double/nearly-eq: (x : double, y : double, epsilon : ?double) -> bool` which takes an explicit `epsilon`.

The maximum of the absolute values.

The maximum of a list of absolute values.

Return the arc-cosine of `d`.

The area hyperbolic cosine of `x`.

Return the arc-sine of `d`.

The area hyperbolic sine of `x`.

Return the arc-tangent of `d`.

Return the arc-tangent of a point (`x`,`y`).

The area hyperbolic tangent of `x`.

Return the smallest integer equal or larger than `d`.

Return the cosine of an angle in radians `d`.

The hyperbolic cosine of `d`.

The e) constant.

Machine epsilon: the difference between 1.0 and the next representable `doublestd/core/double: V` value.

The natural logarithm of 10.

The base-10 logarithm of e.

The natural logarithm of 2.

The base-2 logarithm of e.

Maximum double value.

maximal precision in decimal digits of a `doublestd/core/double: V`.

Smallest positive normalized double value.

π.

π/2.

3π/4.

π/4.

`1.0 / sqrtstd/num/double/sqrt: (d : double) -> double(2.0)` (= `sqrtstd/num/double/sqrt: (d : double) -> double(0.5)`).

The square-root of 2.

Smallest positive subnormal value (i.e. `DBL_TRUE_MIN`).

2π.

Decode a double `d` into a tuple `(m,e)` of a mantissa `m` and exponent `e` such that `m`·2`e` = `d` exactly. The mantissa `m` is always either 0 or in the range [252, 253). See also `frexpstd/num/double/frexp: (x : double) -> (double, int)`.

Low-level: create a `doublestd/core/double: V` from the given `lo` and `hi` 32-bits.

Low-level: return the `(lo,hi)` bits of a 64-bit double.

Create a double `d` given a mantissa `man` and exponent `expstd/num/double/exp: (p : double) -> double` such that `man`·2`expstd/num/double/exp: (p : double) -> double` = `d` exactly (if it is representable by a `doublestd/core/double: V`). See also `ldexpstd/num/double/ldexp: (x : double, e : int) -> double`.

Return e to the power of `p`.

Return the 10 to the power of `p`.

Return the 2 to the power of `p`.

Calculate 2·`e` for an integer `e`. Uses efficient bit conversion for exponents between -1022 and 1023 and otherwise falls back to the regular `exp2` function converting `e` to a double.

Return `expstd/num/double/exp: (p : double) -> double(x - 1.0)`. Avoids rounding errors for values of `x` very close to `1.0`.

Return the ‘floored’ fraction of `d`, always greater or equal to zero.
`d.floorstd/num/double/floor: (d : double) -> double + d.ffractionstd/num/double/ffraction: (d : double) -> double === d`
`(-2.4).ffractionstd/num/double/ffraction: (d : double) -> double === 0.6`.

Is this a finite number (i.e. not `nanstd/num/double/nan: double` or infinity).

Return the largest integer equal or less than `d`.

Return the fractional part of a `doublestd/core/double: V` `d`.
`d.truncate + d.fractionstd/num/double/fraction: (d : double) -> double === d`
`(-2.4).fractionstd/num/double/fraction: (d : double) -> double === -0.4`.

‘Fraction/exponent’: return the normalized fraction `f` and exponent `expstd/num/double/exp: (p : double) -> double` for a number `x` such that `x == f`·2`expstd/num/double/exp: (p : double) -> double`. The absolute value of the fraction `f` is always in the range [0.5, 1.0), or one of `0.0`, `-0.0`, `neginfstd/num/double/neginf: double`, `posinfstd/num/double/posinf: double`, or `nanstd/num/double/nan: double`. See also `decodestd/num/double/decode: (d : double) -> (int, int)` which decodes to an integer mantissa.

The hypotenuse of `x` and `y`: `sqrtstd/num/double/sqrt: (d : double) -> double(x*x + y*y)`. Prevents overflow for large numbers.

The square root of the sum of the squares of three doubles. Prevents overflow for large numbers.

The square root of the sum of squares of a list of doubles. Prevents overflow for large numbers and uses Kahan-Babuškan-Neumaier summation for precision.

Is this value equal to negative or positive infinity ?

‘Load exponent’: returns `x`·2`e` for a `finite?std/num/double/finite?: (d : double) -> bool` `x` and otherwise `x` itself. See also `encodestd/num/double/encode: (man : int, exp : int) -> double` which loads an integer mantissa.

Return the natural logarithm (in base e) of a `doublestd/core/double: V` `d`.

Return the logarithm in base 10 of a `doublestd/core/double: V` `d`.

Return `logstd/num/double/log: (d : double) -> double(1.0 + x)`. Avoids potential imprecision for small `x` where adding `1.0` explicitly may lead to rounding errors.

Return the logarithm in base 2 of a `doublestd/core/double: V` `d`.

Returns `logstd/num/double/log: (d : double) -> double(expstd/num/double/exp: (p : double) -> double(x) + expstd/num/double/exp: (p : double) -> double(y))`. Avoids overlow/underflow errors.

Returns `log2std/num/double/log2: (d : double) -> double( exp2(x) + exp2(y) )`. Avoids overlow/underflow errors.

Represents a value that is not a number (NaN).

Is this value equal to NaN ?

Return if two doubles are nearly equal with respect to some `epsilon` (=`8*dbl-epsilonstd/num/double/dbl-epsilon: double`). The epsilon is the nearest difference for numbers around 1.0. The routine automatically scales the epsilon for larger and smaller numbers, and for subnormal numbers.

Negative infinity.

Is this value equal to negative infinity ?

Is this a negative zero value?

Parse a double number. Can be “NaN”, “Inf(inity)” (case-insensitive), a fix-point number (`1.2`) or in scientific notation (`-2.3e-5`). Also allows floats in hexadecimal notation (`0xA.Fp-10`) that can be represented precisely (and are the preferred round trip format).

π.

Positive infinity.

Is this value equal to positive infinity ?

Return the `d` raised to the power of `p`.

Round a double to its nearest integral value. If the value is halfway between two integers, the value is rounded to the even one.

Round a double to a specified precision. Rounds to the even number in case of a tie.
`123.456.round-to-precstd/num/double/round-to-prec: (d : double, prec : int) -> double(2) == 123.46`
`123.456.round-to-precstd/num/double/round-to-prec: (d : double, prec : int) -> double(-1) == 120.0`.

Show a double in hexadecimal notation. An advantage of this format is that it precisely represents the `doublestd/core/double: V` and can reliably (and efficiently) be parsed back, i.e. `d.show-hex.parse-doublestd/num/double/parse-double: (s : string) -> maybe<double> == Juststd/core/Just: forall<a> (value : a) -> maybe<a>(d)`. The significant is the hexadecimal fraction while the exponent after the `p` is the decimal power of 2. For example, `0xA.Fp-10` = (10 + 15/16)·2-10 (not 2-16!) = 0.01068115234375. Equivalently, `0xA.Fp-10 == 0x5.78p-9 == 0x2.BCp-8 == 0x1.5Ep-7`.

```> dbl-min.show-hex
"0x1.0p-1022"
> 0.1.show-hex
"0x1.999999999999Ap-4"
> dbl-max.show-hex
"0x1.FFFFFFFFFFFFFp+1023"
> -0.0.show-hex
"-0x0.0p+0"
> nan.show-hex
"NaN"
> 0.01068115234375.show-hex
"0x1.5Ep-7"
> dbl-minstd/num/double/dbl-min: double.show-hex
"0x1.0p-1022"
> 0.1.show-hex
"0x1.999999999999Ap-4"
> dbl-maxstd/num/double/dbl-max: double.show-hex
"0x1.FFFFFFFFFFFFFp+1023"
> -0.0.show-hex
"-0x0.0p+0"
> nanstd/num/double/nan: double.show-hex
"NaN"
> 0.01068115234375.show-hex
"0x1.5Ep-7"
```

.

Return the sine of an angle in radians `d`.

The hyperbolic sine of `d`.

The square of a double.

Return the square root of a value `d` Returns `nanstd/num/double/nan: double` if `d == nanstd/num/double/nan: double` or if `d` is negative. Returns `inf` if `d == inf` .

Is this a subnormal value? (i.e. `0 < d.abs < dbl-minstd/num/double/dbl-min: double`).

Return the sum of a list of doubles. Uses Kahan-Babuškan-Neumaier summation to minimize rounding errors. This is more precise as Kahan summation and about as fast.
`[1.0e3,1.0e97,1.0e3,-1.0e97].sum == 2000.0`
A. Neumaier, Rundungsfehleranalyse einiger Verfahren zur Summation endlicher Summen. Math. Mechanik, 54:39–51, 1974.

Return the tangent of an angle in radians `d`.

The hyperbolic tangent of `d`.

Return the integral part of a `doublestd/core/double: V` `d` . If `d >= 0.0` , return the largest integer equal or less to `d` , If `d < 0.0` , return the smallest integer equal or larger to `d` .

Return `x` with the sign of `y`.