Core Function frexp

From Sputnik Wiki
Jump to: navigation, search
frexp( <x> )

Contents

Description

Returns m and e such that x = m2e, e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).

Parameters

x

Any valid numeric expression.

Return Value

Returns m and e such that x = m2e, e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).

Remarks

None.

Example

List ($m, $n) = frexp(2);
say "$m | $n"; // 0.5 | 2
List ($m, $n) = frexp(3);
say "$m | $n"; // 0.75 | 2
List ($m, $n) = frexp(128);
say "$m | $n"; // 0.5 | 8
List ($m, $n) = frexp(3.1415927);
say "$m | $n"; // 0.785398175 | 2
List ($m, $n) = frexp(1.23456e24);
say "$m | $n"; // 0.51060204851673 | 81
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox