frexp(n) Tcl Float Decomposition frexp(n)

```

```

# [NAME](#NAME)

frexp - Split a floating-point number into fraction and exponent parts

# [SYNOPSIS](#SYNOPSIS)

**package require tcl 9.1**

**frexp value**

```

```

# [DESCRIPTION](#DESCRIPTION)

The **frexp** command takes a floating-point number, *value*, and returns a list of two values. The first element of the result is the fractional part of *value* (signed, of magnitude between 0.5 and 1.0), and the second element of the result is the integer exponent from *value*. When *value* is infinite, the fraction is also infinite (of the same sign).

# [EXAMPLE](#EXAMPLE)

The **frexp** command is paired with the **ldexp** function, like this:

```
set value 123.456
lassign [frexp $value] frac exp
set recovered [expr { ldexp($frac, $exp) }]
puts "$value -> $frac*2**$exp -> $recovered"
#       123.456 -> 0.9645*2**7 -> 123.456
```

# [SEE ALSO](#SEE_ALSO)

[expr(n)](/man/os/tcl/expr.n), [mathfunc(n)](/man/os/tcl/mathfunc.n), [modf(n)](/man/os/tcl/modf.n)

# [KEYWORDS](#KEYWORDS)

floating point

9.1 Tcl

---

Document: frexp(n) from tcl 9.1.0-r1 (Chainguard OS)
Source: https://downloads.sourceforge.net/project/tcl/Tcl/9.1.0/tcl9.1.0-src.tar.gz
