docs-v2/content/v2.0/reference/flux/stdlib/math/frexp.md

43 lines
994 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: math.frexp() function
description: >
The math.frexp() function breaks `f` into a normalized fraction and an integral power of two.
It returns `frac` and `exp` satisfying `f == frac × 2**exp`, with the absolute
value of `frac` in the interval [½, 1).
aliases:
- /v2.0/reference/flux/functions/math/frexp/
menu:
v2_0_ref:
name: math.frexp
parent: Math
weight: 301
---
The `math.frexp()` function breaks `f` into a normalized fraction and an integral power of two.
It returns `frac` and `exp` satisfying `f == frac × 2**exp`, with the absolute value
of `frac` in the interval `[½, 1)`.
_**Output data type:** Object_
```js
import "math"
math.frexp(f: 22.0)
// Returns {frac: 0.6875, exp: 5}
```
## Parameters
### f
The value used in the operation.
_**Data type:** Float_
## Special cases
```js
math.frexp(f: ±0) // Returns {frac: ±0, exp: 0}
math.frexp(f: ±Inf) // Returns {frac: ±Inf, exp: 0}
math.frexp(f: NaN) // Returns {frac: NaN, exp: 0}
```