Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #248 Construct a 64-bit floating-point value

Construct the "double precision" (64-bit) floating point number d from the mantissa m, the exponent e and the sign flag s (true means the sign is negative).

  if (s) then
    d = -m * radix(d)**e
  else
    d =  m * radix(d)**e
  end if

uses SysUtils;
d.buildup(s, m, e);
import math
sign = -1 if s else 1
d = math.ldexp(sign*m,e)

New implementation...
Bart