Logo

Programming-Idioms

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).
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
d = (s?-1:1) * m * double.Exp10(e);
  if (s) then
    d = -m * radix(d)**e
  else
    d =  m * radix(d)**e
  end if

import "math"
if s {
	m = -m
}
d := math.Ldexp(m, e)
uses SysUtils;
d.buildup(s, m, e);
$d = ($s?-1:1) * "${m}e${e}"; 
import math
sign = -1 if s else 1
d = math.ldexp(sign*m,e)
d = (s ? -1 : 1) * Math::ldexp(m, e)
let d = if s { -1.0 } else { 1.0 } * m as f64 * 2.0f64.powf(e as f64);