Merge pull request #87 from influxdata/flux/math-functions
Flux math package and functionspull/89/head
commit
782ed4f55f
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Flux functions
|
||||
description: Flux functions allows you to retrieve, transform, process, and output data easily.
|
||||
v2.0/tags: [flux, functions]
|
||||
title: Flux packages and functions
|
||||
description: Flux packages and functions allows you to retrieve, transform, process, and output data easily.
|
||||
v2.0/tags: [flux, functions, package]
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Flux functions
|
||||
name: Flux packages and functions
|
||||
parent: Flux query language
|
||||
weight: 101
|
||||
---
|
||||
|
||||
Flux's functional syntax allows you to retrieve, transform, process, and output data easily.
|
||||
There is a large library of built-in and importable functions:
|
||||
There is a large library of built-in functions and importable packages:
|
||||
|
||||
{{< children >}}
|
||||
|
|
|
@ -4,7 +4,7 @@ description: View the full library of documented Flux functions.
|
|||
menu:
|
||||
v2_0_ref:
|
||||
name: View all functions
|
||||
parent: Flux functions
|
||||
parent: Flux packages and functions
|
||||
weight: 299
|
||||
---
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
---
|
||||
title: Flux built-in functions
|
||||
description: >
|
||||
Built-in functions provide a necessary foundation for working with data using Flux.
|
||||
Built-in functions provide a foundation for working with data using Flux.
|
||||
They do not require an import statement and are usable without any extra setup.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Built-in
|
||||
parent: Flux functions
|
||||
parent: Flux packages and functions
|
||||
weight: 201
|
||||
v2.0/tags: [built-in, functions]
|
||||
v2.0/tags: [built-in, functions, package]
|
||||
---
|
||||
|
||||
Built-in functions provide a necessary foundation for working with data using Flux.
|
||||
Built-in functions provide a foundation for working with data using Flux.
|
||||
Because these functions are "built-in," they do not require an `import` statement and are usable without any extra setup.
|
||||
|
||||
Built-in functions are grouped into the following categories:
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
---
|
||||
title: Flux InfluxDB v1 functions
|
||||
title: Flux InfluxDB v1 package
|
||||
description: >
|
||||
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x
|
||||
The Flux InfluxDB v1 package provides functions for managing data from an InfluxDB v1.x
|
||||
database or structured using the InfluxDB v1 data structure.
|
||||
To use them, import the `influxdata/influxdb/v1` package.
|
||||
Import the `influxdata/influxdb/v1` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: InfluxDB v1
|
||||
parent: Flux functions
|
||||
weight: 202
|
||||
v2.0/tags: [functions, influxdb-v1]
|
||||
parent: Flux packages and functions
|
||||
weight: 203
|
||||
v2.0/tags: [functions, influxdb-v1, package]
|
||||
---
|
||||
|
||||
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x
|
||||
database or structured using the InfluxDB v1 data structure.
|
||||
To use them, import the `influxdata/influxdb/v1` package:
|
||||
Import the `influxdata/influxdb/v1` package:
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: Flux math package
|
||||
description: >
|
||||
The Flux math package provides basic constants and mathematical functions.
|
||||
Import the `math` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Math
|
||||
parent: Flux packages and functions
|
||||
weight: 202
|
||||
v2.0/tags: [math, functions]
|
||||
---
|
||||
|
||||
The Flux math package provides basic constants and mathematical functions.
|
||||
Import the `math` package.
|
||||
|
||||
```js
|
||||
import "math"
|
||||
```
|
||||
|
||||
## Mathematical constants
|
||||
That `math` package includes the following mathematical constants.
|
||||
|
||||
```js
|
||||
math.e = 2.71828182845904523536028747135266249775724709369995957496696763 // https ://oeis.org/A001113
|
||||
math.pi = 3.14159265358979323846264338327950288419716939937510582097494459 // https ://oeis.org/A000796
|
||||
math.phi = 1.61803398874989484820458683436563811772030917980576286213544862 // https ://oeis.org/A001622
|
||||
|
||||
math.sqrt2 = 1.41421356237309504880168872420969807856967187537694807317667974 // https ://oeis.org/A002193
|
||||
math.sqrte = 1.64872127070012814684865078781416357165377610071014801157507931 // https ://oeis.org/A019774
|
||||
math.sqrtpi = 1.77245385090551602729816748334114518279754945612238712821380779 // https ://oeis.org/A002161
|
||||
math.sqrtphi = 1.27201964951406896425242246173749149171560804184009624861664038 // https ://oeis.org/A139339
|
||||
|
||||
math.ln2 = 0.693147180559945309417232121458176568075500134360255254120680009 // https://oeis.org/A002162
|
||||
math.log2e = 1 ÷ math.ln2
|
||||
math.ln10 = 2.30258509299404568401799145468436420760110148862877297603332790 // https ://oeis.org/A002392
|
||||
math.log10e = 1 ÷ math.ln10
|
||||
|
||||
math.maxfloat = 1.797693134862315708145274237317043567981e+308 // 2**1023 * (2**53 - 1) / 2**52
|
||||
math.maxint = 1<<63 - 1
|
||||
math.minint = -1 << 63
|
||||
math.maxuint = 1<<64 - 1
|
||||
```
|
||||
|
||||
## Mathematical functions
|
||||
{{< children type="functions" show="pages" >}}
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.abs() function
|
||||
description: The math.abs() function returns the absolute value of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.abs
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.abs()` function returns the absolute value of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.abs(x: -1.22)
|
||||
|
||||
// Returns 1.22
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.abs(x: ±Inf) // Returns +Inf
|
||||
math.abs(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.acos() function
|
||||
description: The math.acos() function returns the arccosine of `x` in radians.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.acos
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.acos()` function returns the arccosine of `x` in radians.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.acos(x: 0.22)
|
||||
|
||||
// Returns 1.3489818562981022
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.acos(x: <-1) // Returns NaN
|
||||
math.acos(x: >1) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.acosh() function
|
||||
description: The math.acosh() function returns the inverse hyperbolic cosine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.acosh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.acosh()` function returns the inverse hyperbolic cosine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.acosh(x: 1.22)
|
||||
|
||||
// Returns 0.6517292837263385
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
`x` should be greater than 1.
|
||||
If less than 1, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.acosh(x: +Inf) // Returns +Inf
|
||||
math.acosh(x: <1) // Returns NaN
|
||||
math.acosh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.asin() function
|
||||
description: The math.asin() function returns the arcsine of `x` in radians.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.asin
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.asin()` function returns the arcsine of `x` in radians.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.asin(x: 0.22)
|
||||
|
||||
// Returns 0.22181447049679442
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the function will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.asin(x: ±0) // Returns ±0
|
||||
math.asin(x: <-1) // Returns NaN
|
||||
math.asin(x: >1) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.asinh() function
|
||||
description: The math.asinh() function returns the inverse hyperbolic sine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.asinh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.asinh()` function returns the inverse hyperbolic sine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.asinh(x: 3.14)
|
||||
|
||||
// Returns 1.8618125572133835
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.asinh(x: ±0) // Returns ±0
|
||||
math.asinh(x: ±Inf) // Returns ±Inf
|
||||
math.asinh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.atan() function
|
||||
description: The math.atan() function returns the arctangent of `x` in radians.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.atan
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.atan()` function returns the arctangent of `x` in radians.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.atan(x: 3.14)
|
||||
|
||||
// Returns 1.262480664599468
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.atan(x: ±0) // Returns ±0
|
||||
math.atan(x: ±Inf) // Returns ±Pi/2
|
||||
```
|
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
title: math.atan2() function
|
||||
description: >
|
||||
The math.atan2() function returns the arc tangent of `y`/`x`, using the signs of
|
||||
the parameters to determine the quadrant of the return value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.atan2
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.atan2()` function returns the arc tangent of `y`/`x`, using the signs
|
||||
of the two to determine the quadrant of the return value.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.atan2(y: 1.22, x: 3.14)
|
||||
|
||||
// Returns 0.3705838802763881
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### y
|
||||
The y coordinate used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### x
|
||||
The x coordinate used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.atan2(y:y, x:NaN) // Returns NaN
|
||||
math.atan2(y: NaN, x:x) // Returns NaN
|
||||
math.atan2(y: +0, x: >=0) // Returns +0
|
||||
math.atan2(y: -0, x: >=0) // Returns -0
|
||||
math.atan2(y: +0, x: <=-0) // Returns +Pi
|
||||
math.atan2(y: -0, x: <=-0) // Returns -Pi
|
||||
math.atan2(y: >0, x: 0) // Returns +Pi/2
|
||||
math.atan2(y: <0, x: 0) // Returns -Pi/2
|
||||
math.atan2(y: +Inf, x: +Inf) // Returns +Pi/4
|
||||
math.atan2(y: -Inf, x: +Inf) // Returns -Pi/4
|
||||
math.atan2(y: +Inf, x: -Inf) // Returns 3Pi/4
|
||||
math.atan2(y: -Inf, x: -Inf) // Returns -3Pi/4
|
||||
math.atan2(y:y, x: +Inf) // Returns 0
|
||||
math.atan2(y: >0, x: -Inf) // Returns +Pi
|
||||
math.atan2(y: <0, x: -Inf) // Returns -Pi
|
||||
math.atan2(y: +Inf, x:x) // Returns +Pi/2
|
||||
math.atan2(y: -Inf, x:x) // Returns -Pi/2
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.atanh() function
|
||||
description: The math.atanh() function returns the inverse hyperbolic tangent of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.atanh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.atanh()` function returns the inverse hyperbolic tangent of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.atanh(x: 0.22)
|
||||
|
||||
// Returns 0.22365610902183242
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.atanh(x: 1) // Returns +Inf
|
||||
math.atanh(x: ±0) // Returns ±0
|
||||
math.atanh(x: -1) // Returns -Inf
|
||||
math.atanh(x: <-1) // Returns NaN
|
||||
math.atanh(x: >1) // Returns NaN
|
||||
math.atanh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.cbrt() function
|
||||
description: The math.cbrt() function returns the cube root of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.cbrt
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.cbrt()` function returns the cube root of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.cbrt(x: 1728.0)
|
||||
|
||||
// Returns 12.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.cbrt(±0) // Returns ±0
|
||||
math.cbrt(±Inf) // Returns ±Inf
|
||||
math.cbrt(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.ceil() function
|
||||
description: The math.ceil() function returns the least integer value greater than or equal to `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.ceil
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.ceil()` function returns the least integer value greater than or equal to `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.ceil(x: 3.14)
|
||||
|
||||
// Returns 4.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.ceil(±0) // Returns ±0
|
||||
math.ceil(±Inf) // Returns ±Inf
|
||||
math.ceil(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: math.copysign() function
|
||||
description: The math.copysign() function returns a value with the magnitude of `x` and the sign of `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.copysign
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.copysign()` function returns a value with the magnitude of `x` and the sign of `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.copysign(x: 1.0, y: 2.0)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The magnitude used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The sign used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.cos() function
|
||||
description: The math.cos() function returns the cosine of the radian argument `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.cos
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.cos()` function returns the cosine of the radian argument `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.cos(x: 3.14)
|
||||
|
||||
// Returns -0.9999987317275396
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.cos(±Inf) // Returns NaN
|
||||
math.cos(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.cosh() function
|
||||
description: The math.cosh() function returns the hyperbolic cosine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.cosh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.cosh()` function returns the hyperbolic cosine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.cosh(x: 1.22)
|
||||
|
||||
// Returns 1.8412089502726743
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.cosh(±0) // Returns 1
|
||||
math.cosh(±Inf) // Returns +Inf
|
||||
math.cosh(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: math.dim() function
|
||||
description: The math.dim() function returns the maximum of `x`-`y` or 0.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.dim
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.dim()` function returns the maximum of `x - y` or 0.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.dim(x: 12.2, y: 8.1)
|
||||
|
||||
// Returns 4.1
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.dim(x: +Inf, y: +Inf) // Returns NaN
|
||||
math.dim(x: -Inf, y: -Inf) // Returns NaN
|
||||
math.dim(x:x, y : NaN) // Returns NaN
|
||||
math.dim(x: NaN, y :y) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.erf() function
|
||||
description: The math.erf() function returns the error function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erf()` function returns the error function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erf(x: 22.6)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erf(+Inf) // Returns 1
|
||||
math.erf(-Inf) // Returns -1
|
||||
math.erf(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.erfc() function
|
||||
description: The math.erfc() function returns the complementary error function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erfc
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erfc()` function returns the complementary error function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erfc(x: 22.6)
|
||||
|
||||
// Returns 3.7726189138490583e-224
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erfc(+Inf) // Returns 0
|
||||
math.erfc(-Inf) // Returns 2
|
||||
math.erfc(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: math.erfcinv() function
|
||||
description: The math.erfcinv() function returns the inverse of `math.erfc()`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erfcinv
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erfcinv()` function returns the inverse of `math.erfc()`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erfcinv(x: 0.42345)
|
||||
|
||||
// Returns 0.5660037715858239
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than 0 and less than 2.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erfcinv(x: 0) // Returns +Inf
|
||||
math.erfcinv(x: 2) // Returns -Inf
|
||||
math.erfcinv(x: <0) // Returns NaN
|
||||
math.erfcinv(x: >2) // Returns NaN
|
||||
math.erfcinv(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: math.erfinv() function
|
||||
description: The math.erfinv() function returns the inverse error function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erfinv
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erfinv()` function returns the inverse error function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erfinv(x: 0.22)
|
||||
|
||||
// Returns 0.19750838337227364
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erfinv(x: 1) // Returns +Inf
|
||||
math.erfinv(x: -1) // Returns -Inf
|
||||
math.erfinv(x: <-1) // Returns NaN
|
||||
math.erfinv(x: > 1) // Returns NaN
|
||||
math.erfinv(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.exp() function
|
||||
description: The math.exp() function returns `e**x`, the base-e exponential of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.exp
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.exp()` function returns `e**x`, the base-e exponential of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.exp(x: 21.0)
|
||||
|
||||
// Returns 1.3188157344832146e+09
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.exp(x: +Inf) // Returns +Inf
|
||||
math.exp(x: NaN) // Returns NaN
|
||||
```
|
||||
|
||||
Very large values overflow to 0 or +Inf. Very small values underflow to 1.
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.exp2() function
|
||||
description: The math.exp2() function returns `2**x`, the base-2 exponential of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.exp2
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.exp2()` function returns `2**x`, the base-2 exponential of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.exp2(x: 21.0)
|
||||
|
||||
// Returns 2.097152e+06
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.exp2(x: +Inf) // Returns +Inf
|
||||
math.exp2(x: NaN) // Returns NaN
|
||||
```
|
||||
|
||||
Very large values overflow to 0 or +Inf. Very small values underflow to 1.
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.expm1() function
|
||||
description: >
|
||||
The math.expm1() function returns `e**x - 1`, the base-e exponential of `x` minus 1.
|
||||
It is more accurate than `math.exp(x:x) - 1` when `x` is near zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.expm1
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.expm1()` function returns `e**x - 1`, the base-e exponential of `x` minus 1.
|
||||
It is more accurate than `math.exp(x:x) - 1` when `x` is near zero.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.expm1(x: 1.22)
|
||||
|
||||
// Returns 2.3871877336213343
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.expm1(+Inf) // Returns +Inf
|
||||
math.expm1(-Inf) // Returns -1
|
||||
math.expm1(NaN) // Returns NaN
|
||||
```
|
||||
|
||||
Very large values overflow to -1 or +Inf.
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: math.float64bits() function
|
||||
description: The math.float64bits() function returns the IEEE 754 binary representation of `f`, with the sign bit of `f` and the result in the same bit position.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.float64bits
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.float64bits()` function returns the IEEE 754 binary representation of `f`, with the sign bit of `f` and the result in the same bit position.
|
||||
|
||||
_**Output data type:** UInteger_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.float64bits(f: 1234.56)
|
||||
|
||||
// Returns 4653144467747100426
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.floor() function
|
||||
description: The math.floor() function returns the greatest integer value less than or equal to `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.floor
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.floor()` function returns the greatest integer value less than or equal to `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.floor(x: 1.22)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.floor(±0) // Returns ±0
|
||||
math.floor(±Inf) // Returns ±Inf
|
||||
math.floor(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
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).
|
||||
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}
|
||||
```
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: math.gamma() function
|
||||
description: The math.gamma() function returns the Gamma function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.gamma
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.gamma()` function returns the Gamma function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.gamma(x: 2.12)
|
||||
|
||||
// Returns 1.056821007887572
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.gamma(x: +Inf) = +Inf
|
||||
math.gamma(x: +0) = +Inf
|
||||
math.gamma(x: -0) = -Inf
|
||||
math.gamma(x: <0) = NaN for integer x < 0
|
||||
math.gamma(x: -Inf) = NaN
|
||||
math.gamma(x: NaN) = NaN
|
||||
```
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: math.hypot() function
|
||||
description: >
|
||||
The math.hypot() function returns the square root of `p*p + q*q`,
|
||||
taking care to avoid unnecessary overflow and underflow.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.hypot
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.hypot()` function returns the square root of `p*p + q*q`,
|
||||
taking care to avoid overflow and underflow.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.hypot(p: 2.0, q: 5.0)
|
||||
|
||||
// Returns 5.385164807134505
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### p
|
||||
The p value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### q
|
||||
The q value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.hypot(p: ±Inf, q:q) // Returns +Inf
|
||||
math.hypot(p:p, q: ±Inf) // Returns +Inf
|
||||
math.hypot(p: NaN, q:q) // Returns NaN
|
||||
math.hypot(p:p, q: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.ilogb() function
|
||||
description: The math.ilogb() function returns the binary exponent of `x` as an integer.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.ilogb
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.ilogb()` function returns the binary exponent of `x` as an integer.
|
||||
|
||||
_**Output data type:** Integer_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.ilogb(x: 123.45)
|
||||
|
||||
// Returns 6.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.ilogb(x: ±Inf) // Returns MaxInt32
|
||||
math.ilogb(x: 0) // Returns MinInt32
|
||||
math.ilogb(x: NaN) // Returns MaxInt32
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.isInf() function
|
||||
description: The math.isInf() function reports whether `f` is an infinity, according to `sign`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.isInf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.isInf()` function reports whether `f` is an infinity, according to sign.
|
||||
|
||||
_**Output data type:** Boolean_
|
||||
|
||||
- If `sign > 0`, `math.isInf` reports whether `f` is positive infinity.
|
||||
- If `sign < 0`, `math.isInf` reports whether `f` is negative infinity.
|
||||
- If `sign == 0`, `math.isInf` reports whether `f` is either infinity.
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.isInf(f: 2.12, sign: 3)
|
||||
|
||||
// Returns false
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the evaluation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### sign
|
||||
The sign used in the evaluation.
|
||||
|
||||
_**Data type:** Integer_
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: math.isNaN() function
|
||||
description: The math.isNaN() function reports whether `f` is an IEEE 754 “not-a-number” value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.isNaN
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.isNaN()` function reports whether `f` is an IEEE 754 “not-a-number” value.
|
||||
|
||||
_**Output data type:** Boolean_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.isNaN(f: 12.345)
|
||||
|
||||
// Returns false
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the evaluation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.j0() function
|
||||
description: The math.j0() function returns the order-zero Bessel function of the first kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.j0
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.j0()` function returns the order-zero Bessel function of the first kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.j0(x: 1.23)
|
||||
|
||||
// Returns 0.656070571706025
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.j0(x: ±Inf) // Returns 0
|
||||
math.j0(x: 0) // Returns 1
|
||||
math.j0(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.j1() function
|
||||
description: The math.j1() function returns the order-one Bessel function of the first kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.j1
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.j1()` function returns the order-one Bessel function of the first kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.j1(x: 1.23)
|
||||
|
||||
// Returns 0.5058005726280961
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.j1(±Inf) // Returns 0
|
||||
math.j1(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: math.jn() function
|
||||
description: The math.jn() function returns the order-n Bessel function of the first kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.jn
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.jn()` function returns the order-n Bessel function of the first kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.jn(n: 2, x: 1.23)
|
||||
|
||||
// Returns 0.16636938378681407
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### n
|
||||
The order number.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.jn(n:n, x: ±Inf) // Returns 0
|
||||
math.jn(n:n, x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: math.ldexp() function
|
||||
description: The math.ldexp() function is the inverse of `math.frexp()`. It returns `frac × 2**exp`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.ldexp
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.ldexp()` function is the inverse of [`math.frexp()`](/v2.0/reference/flux/functions/math/frexp).
|
||||
It returns `frac × 2**exp`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.ldexp(frac: 0.5, exp: 6)
|
||||
|
||||
// Returns 32.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### frac
|
||||
The fraction used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### exp
|
||||
The exponent used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.ldexp(frac: ±0, exp:exp) // Returns ±0
|
||||
math.ldexp(frac: ±Inf, exp:exp) // Returns ±Inf
|
||||
math.ldexp(frac: NaN, exp:exp) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.lgamma() function
|
||||
description: The math.lgamma() function returns the natural logarithm and sign (-1 or +1) of `math.gamma(x:x)`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.lgamma
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.lgamma()` function returns the natural logarithm and sign (-1 or +1) of `math.gamma(x:x)`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.lgamma(x: 3.14)
|
||||
|
||||
// Returns {lgamma: 0.8261387047770286, sign: 1}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.lgamma(x: +Inf) // Returns +Inf
|
||||
math.lgamma(x: 0) // Returns +Inf
|
||||
math.lgamma(x: -integer) // Returns +Inf
|
||||
math.lgamma(x: -Inf) // Returns -Inf
|
||||
math.lgamma(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.log() function
|
||||
description: The math.log() function returns the natural logarithm of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log()` function returns the natural logarithm of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log(x: 3.14)
|
||||
|
||||
// Returns 1.144222799920162
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log(x: +Inf) // Returns +Inf
|
||||
math.log(x: 0) // Returns -Inf
|
||||
math.log(x: <0) // Returns NaN
|
||||
math.log(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.log10() function
|
||||
description: The math.log10() function returns the decimal logarithm of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log10
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log10()` function returns the decimal logarithm of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log10(x: 3.14)
|
||||
|
||||
// Returns 0.4969296480732149
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log10(x: +Inf) // Returns +Inf
|
||||
math.log10(x: 0) // Returns -Inf
|
||||
math.log10(x: <0) // Returns NaN
|
||||
math.log10(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.log1p() function
|
||||
description: >
|
||||
The math.log1p() function returns the natural logarithm of 1 plus its argument `x`.
|
||||
It is more accurate than `math.log(x: 1 + x)` when `x` is near zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log1p
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log1p()` function returns the natural logarithm of 1 plus its argument `x`.
|
||||
It is more accurate than `math.log(x: 1 + x)` when `x` is near zero.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log1p(x: 0.56)
|
||||
|
||||
// Returns 0.44468582126144574
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log1p(x: +Inf) // Returns +Inf
|
||||
math.log1p(x: ±0) // Returns ±0
|
||||
math.log1p(x: -1) // Returns -Inf
|
||||
math.log1p(x: <-1) // Returns NaN
|
||||
math.log1p(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.log2() function
|
||||
description: The math.log2() function returns the binary logarithm of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log2
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log2()` function returns the binary logarithm of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log2(x: 3.14)
|
||||
|
||||
// Returns 1.6507645591169022
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log2(x: +Inf) // Returns +Inf
|
||||
math.log2(x: 0) // Returns -Inf
|
||||
math.log2(x: <0) // Returns NaN
|
||||
math.log2(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.logb() function
|
||||
description: The math.logb() function returns the binary exponent of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.logb
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.logb()` function returns the binary exponent of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.logb(x: 3.14)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.logb(x: ±Inf) // Returns +Inf
|
||||
math.logb(x: 0) // Returns -Inf
|
||||
math.logb(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: math.m_inf() function
|
||||
description: The math.m_inf() function returns positive infinity if `sign >= 0`, negative infinity if `sign < 0`.
|
||||
|
||||
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.m_inf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.m_inf()` function returns positive infinity if `sign >= 0`, negative infinity if `sign < 0`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.m_inf(sign: 1)
|
||||
|
||||
// Returns +Inf
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### sign
|
||||
The sign value used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: math.m_max() function
|
||||
description: The math.m_max() function returns the larger of `x` or `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.m_max
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.m_max()` function returns the larger of `x` or `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.m_max(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 4.56
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.m_max(x:x, y:+Inf) // Returns +Inf
|
||||
math.m_max(x: +Inf, y:y) // Returns +Inf
|
||||
math.m_max(x:x, y: NaN) // Returns NaN
|
||||
math.m_max(x: NaN, y:y) // Returns NaN
|
||||
math.m_max(x: +0, y: ±0) // Returns +0
|
||||
math.m_max(x: ±0, y: +0) // Returns +0
|
||||
math.m_max(x: -0, y: -0) // Returns -0
|
||||
```
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
title: math.m_min() function
|
||||
description: The math.m_min() function returns the smaller of `x` or `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.m_min
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.m_min()` function returns the smaller of `x` or `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.m_min(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 1.23
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
Min(x:x, y: -Inf) // Returns -Inf
|
||||
Min(x: -Inf, y:y) // Returns -Inf
|
||||
Min(x:x, y: NaN) // Returns NaN
|
||||
Min(x: NaN, y:y) // Returns NaN
|
||||
Min(x: -0, y: ±0) // Returns -0
|
||||
Min(x: ±0, y: -0) // Returns -0
|
||||
```
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: math.mod() function
|
||||
description: >
|
||||
The math.mod() function returns the floating-point remainder of `x`/`y`.
|
||||
The magnitude of the result is less than `y` and its sign agrees with that of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.mod
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.mod()` function returns the floating-point remainder of `x`/`y`.
|
||||
The magnitude of the result is less than `y` and its sign agrees with that of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.mod(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 1.23
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.mod(x: ±Inf, y:y) // Returns NaN
|
||||
math.mod(x: NaN, y:y) // Returns NaN
|
||||
math.mod(x:x, y: 0) // Returns NaN
|
||||
math.mod(x:x, y: ±Inf) // Returns x
|
||||
math.mod(x:x, y: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.modf() function
|
||||
description: >
|
||||
The math.modf() function returns integer and fractional floating-point numbers that sum to `f`.
|
||||
Both values have the same sign as `f`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.modf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.modf()` function returns integer and fractional floating-point numbers that sum to `f`.
|
||||
Both values have the same sign as `f`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.modf(x: 3.14)
|
||||
|
||||
// Returns {int: 3, frac: 0.14000000000000012}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.modf(x: ±Inf) // Returns {int: ±Inf, frac: NaN}
|
||||
math.modf(x: NaN) // Returns {int: NaN, frac: NaN}
|
||||
```
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: math.NaN() function
|
||||
description: The math.NaN() function returns an IEEE 754 “not-a-number” value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.NaN
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.NaN()` function returns an IEEE 754 “not-a-number” value.
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.NaN()
|
||||
|
||||
// Returns NaN
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.nextafter() function
|
||||
description: The math.nextafter() function returns the next representable float value after `x` towards `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.nextafter
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.nextafter()` function returns the next representable float value after `x` towards `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.nextafter(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 1.2300000000000002
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.nextafter(x:x, y:x) // Returns x
|
||||
math.nextafter(x: NaN, y:y) // Returns NaN
|
||||
math.nextafter(x:x, y:NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
title: math.pow() function
|
||||
description: The math.pow() function returns `x**y`, the base-x exponential of y.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.pow
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.pow()` function returns `x**y`, the base-x exponential of y.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.pow(x: 2.0, y: 3.0)
|
||||
|
||||
// Returns 8.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
// In order of priority
|
||||
math.pow(x:x, y:±0) // Returns 1 for any x
|
||||
math.pow(x:1, y:y) // Returns 1 for any y
|
||||
math.pow(x:X, y:1) // Returns x for any x
|
||||
math.pow(x:NaN, y:y) // Returns NaN
|
||||
math.pow(x:x, y:NaN) // Returns NaN
|
||||
math.pow(x:±0, y:y) // Returns ±Inf for y an odd integer < 0
|
||||
math.pow(x:±0, y:-Inf) // Returns +Inf
|
||||
math.pow(x:±0, y:+Inf) // Returns +0
|
||||
math.pow(x:±0, y:y) // Returns +Inf for finite y < 0 and not an odd integer
|
||||
math.pow(x:±0, y:y) // Returns ±0 for y an odd integer > 0
|
||||
math.pow(x:±0, y:y) // Returns +0 for finite y > 0 and not an odd integer
|
||||
math.pow(x:-1, y:±Inf) // Returns 1
|
||||
math.pow(x:x, y:+Inf) // Returns +Inf for |x| > 1
|
||||
math.pow(x:x, y:-Inf) // Returns +0 for |x| > 1
|
||||
math.pow(x:x, y:+Inf) // Returns +0 for |x| < 1
|
||||
math.pow(x:x, y:-Inf) // Returns +Inf for |x| < 1
|
||||
math.pow(x:+Inf, y:y) // Returns +Inf for y > 0
|
||||
math.pow(x:+Inf, y:y) // Returns +0 for y < 0
|
||||
math.pow(x:-Inf, y:y) // Returns math.pow(-0, -y)
|
||||
math.pow(x:x, y:y) // Returns NaN for finite x < 0 and finite non-integer y
|
||||
```
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.pow10() function
|
||||
description: The math.pow10() function returns `10**n`, the base-10 exponential of `n`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.pow10
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.pow10()` function returns `10**n`, the base-10 exponential of `n`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.pow10(n: 3)
|
||||
|
||||
// Returns 1000
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### n
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.pow10(n: <-323) // Returns 0
|
||||
math.pow10(n: >308) // Returns +Inf
|
||||
```
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: math.remainder() function
|
||||
description: The math.remainder() function returns the IEEE 754 floating-point remainder of `x / y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.remainder
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.remainder()` function returns the IEEE 754 floating-point remainder of `x / y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.remainder(x: 21.0, y: 4.0)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The numerator used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### x
|
||||
The denominator used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.remainder(x: ±Inf, y:y) // Returns NaN
|
||||
math.remainder(x: NaN, y:y) // Returns NaN
|
||||
math.remainder(x:x, y: 0) // Returns NaN
|
||||
math.remainder(x:x, y: ±Inf) // Returns x
|
||||
math.remainder(x:x, y: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.round() function
|
||||
description: The math.round() function returns the nearest integer, rounding half away from zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.round
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.round()` function returns the nearest integer, rounding half away from zero.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.round(x: 2.12)
|
||||
|
||||
// Returns 2.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.round(x: ±0) // Returns ±0
|
||||
math.round(x: ±Inf) // Returns ±Inf
|
||||
math.round(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.roundtoeven() function
|
||||
description: The math.roundtoeven() function returns the nearest integer, rounding ties to even.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.roundtoeven
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.roundtoeven()` function returns the nearest integer, rounding ties to even.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.roundtoeven(x: 3.14)
|
||||
// Returns 3.0
|
||||
|
||||
math.roundtoeven(x: 3.5)
|
||||
// Returns 4.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.roundtoeven(x: ±0) // Returns ±0
|
||||
math.roundtoeven(x: ±Inf) // Returns ±Inf
|
||||
math.roundtoeven(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: math.signbit() function
|
||||
description: The math.signbit() function reports whether `x` is negative or negative zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.signbit
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.signbit()` function reports whether `x` is negative or negative zero.
|
||||
|
||||
_**Output data type:** Boolean_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.signbit(x: -1.2)
|
||||
|
||||
// Returns true
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.sin() function
|
||||
description: The math.sin() function returns the sine of the radian argument `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sin
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sin()` function returns the sine of the radian argument `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sin(x: 3.14)
|
||||
|
||||
// Returns 0.0015926529164868282
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The radian value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sin(x: ±0) // Returns ±0
|
||||
math.sin(x: ±Inf) // Returns NaN
|
||||
math.sin(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.sincos() function
|
||||
description: The math.sincos() function returns the values of `math.sin(x:x)` and `math.cos(x:x)`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sincos
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sincos()` function returns the values of `math.sin(x:x)` and `math.cos(x:x)`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sincos(x: 1.23)
|
||||
|
||||
// Returns {sin: 0.9424888019316975, cos: 0.3342377271245026}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sincos(x: ±0) // Returns {sin: ±0, cos: 1}
|
||||
math.sincos(x: ±Inf) // Returns {sin: NaN, cos: NaN}
|
||||
math.sincos(x: NaN) // Returns {sin: NaN, cos: NaN}
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.sinh() function
|
||||
description: The math.sinh() function returns the hyperbolic sine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sinh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sinh()` function returns the hyperbolic sine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sinh(x: 1.23)
|
||||
|
||||
// Returns 1.564468479304407
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sinh(x: ±0) // Returns ±0
|
||||
math.sinh(x: ±Inf) // Returns ±Inf
|
||||
math.sinh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.sqrt() function
|
||||
description: The math.sqrt() function returns the square root of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sqrt
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sqrt()` function returns the square root of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sqrt(x: 4.0)
|
||||
|
||||
// Returns 2.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sqrt(x: +Inf) // Returns +Inf
|
||||
math.sqrt(x: ±0) // Returns ±0
|
||||
math.sqrt(x: <0) // Returns NaN
|
||||
math.sqrt(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.tan() function
|
||||
description: The math.tan() function returns the tangent of the radian argument `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.tan
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.tan()` function returns the tangent of the radian argument `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.tan(x: 3.14)
|
||||
|
||||
// Returns -0.001592654936407223
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.tan(x: ±0) // Returns ±0
|
||||
math.tan(x: ±Inf) // Returns NaN
|
||||
math.tan(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.tanh() function
|
||||
description: The math.tanh() function returns the hyperbolic tangent of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.tanh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.tanh()` function returns the hyperbolic tangent of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.tanh(x: 1.23)
|
||||
|
||||
// Returns 0.8425793256589296
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.tanh(x: ±0) // Returns ±0
|
||||
math.tanh(x: ±Inf) // Returns ±1
|
||||
math.tanh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.trunc() function
|
||||
description: The math.trunc() function returns the integer value of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.trunc
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.trunc()` function returns the integer value of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.trunc(x: 3.14)
|
||||
|
||||
// Returns 3.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.trunc(x: ±0) // Returns ±0
|
||||
math.trunc(x: ±Inf) // Returns ±Inf
|
||||
math.trunc(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.y0() function
|
||||
description: The math.y0() function returns the order-zero Bessel function of the second kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.y0
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.y0()` function returns the order-zero Bessel function of the second kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.y0(x: 3.14)
|
||||
|
||||
// Returns 0.3289375969127807
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.y0(x: +Inf) // Returns 0
|
||||
math.y0(x: 0) // Returns -Inf
|
||||
math.y0(x: <0) // Returns NaN
|
||||
math.y0(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.y1() function
|
||||
description: The math.y1() function returns the order-one Bessel function of the second kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.y1
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.y1()` function returns the order-one Bessel function of the second kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.y1(x: 3.14)
|
||||
|
||||
// Returns 0.35853138083924085
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.y1(x: +Inf) // Returns 0
|
||||
math.y1(x: 0) // Returns -Inf
|
||||
math.y1(x: <0) // Returns NaN
|
||||
math.y1(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: math.yn() function
|
||||
description: The math.yn() function returns the order-n Bessel function of the second kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.yn
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.yn()` function returns the order-n Bessel function of the second kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.yn(n: 3, x: 3.14)
|
||||
|
||||
// Returns -0.4866506930335083
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### n
|
||||
The order number used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.yn(n:n, x: +Inf) // Returns 0
|
||||
math.yn(n: ≥0, x: 0) // Returns -Inf
|
||||
math.yn(n: <0, x: 0) // Returns +Inf if n is odd, -Inf if n is even
|
||||
math.yn(n:n, x: <0) // Returns NaN
|
||||
math.yn(n:n, x:NaN) // Returns NaN
|
||||
```
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
title: Flux string functions
|
||||
title: Flux strings package
|
||||
description: >
|
||||
String functions provide tools for manipulating strings in Flux.
|
||||
To use them, import the `strings` package.
|
||||
The Flux string package provides functions to manipulate UTF-8 encoded strings.
|
||||
Import the `strings` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Strings
|
||||
parent: Flux functions
|
||||
weight: 203
|
||||
v2.0/tags: [strings, functions]
|
||||
parent: Flux packages and functions
|
||||
weight: 204
|
||||
v2.0/tags: [strings, functions, package]
|
||||
---
|
||||
|
||||
String functions provide tools for manipulating strings in Flux.
|
||||
To use them, import the `strings` package:
|
||||
The Flux string package provides functions to manipulate UTF-8 encoded strings.
|
||||
Import the `strings` package:
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
title: Flux testing functions
|
||||
title: Flux testing package
|
||||
description: >
|
||||
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
|
||||
To use them, import the `testing` package.
|
||||
The Flux testing package provides functions that test piped-forward data in specific ways.
|
||||
Import the `testing` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Testing
|
||||
parent: Flux functions
|
||||
weight: 204
|
||||
v2.0/tags: [testing, functions]
|
||||
parent: Flux packages and functions
|
||||
weight: 205
|
||||
v2.0/tags: [testing, functions, package]
|
||||
---
|
||||
|
||||
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
|
||||
To use them, import the `testing` package:
|
||||
Import the `testing` package:
|
||||
|
||||
```js
|
||||
import "testing"
|
||||
|
|
Loading…
Reference in New Issue