Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions pages/docs/manual/latest/api/js/float.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ Raises `RangeError` if `digits` is not in the range \[0, 20\] (inclusive).

```res example
/* prints "7.71234e+1" */
\"@@"(Js.log, Js.Float.toExponential(77.1234))
Js.Float.toExponential(77.1234)->Js.log
```

```res example
/* prints "7.7e+1" */
\"@@"(Js.log, Js.Float.toExponential(77.))
Js.Float.toExponential(77.)->Js.log
```

## toExponentialWithPrecision
Expand All @@ -89,7 +89,7 @@ Raises `RangeError` if `digits` is not in the range \[0, 20\] (inclusive).

```res example
/* prints "7.71e+1" */
\"@@"(Js.log, Js.Float.toExponentialWithPrecision(77.1234, ~digits=2))
Js.Float.toExponentialWithPrecision(77.1234, ~digits=2)->Js.log
```

## toFixed
Expand All @@ -104,12 +104,12 @@ Raises `RangeError` if `digits` is not in the range \[0, 20\] (inclusive).

```res example
/* prints "12346" (note the rounding) */
\"@@"(Js.log, Js.Float.toFixed(12345.6789))
Js.Float.toFixed(12345.6789)->Js.log
```

```res example
/* print "1.2e+21" */
\"@@"(Js.log, Js.Float.toFixed(1.2e21))
Js.Float.toFixed(1.2e21)->Js.log
```

## toFixedWithPrecision
Expand All @@ -128,12 +128,12 @@ Raises `RangeError` if `digits` is not in the range \[0, 20\] (inclusive).

```res example
/* prints "12345.7" (note the rounding) */
\"@@"(Js.log, Js.Float.toFixedWithPrecision(12345.6789, ~digits=1))
Js.Float.toFixedWithPrecision(12345.6789, ~digits=1)->Js.log
```

```res example
/* prints "0.00" (note the added zeroes) */
\"@@"(Js.log, Js.Float.toFixedWithPrecision(0., ~digits=2))
Js.Float.toFixedWithPrecision(0., ~digits=2)->Js.log
```

## toPrecision
Expand All @@ -150,12 +150,12 @@ Raises `RangeError` if `digits` is not in the range accepted by this function.

```res example
/* prints "12345.6789" */
\"@@"(Js.log, Js.Float.toPrecision(12345.6789))
Js.Float.toPrecision(12345.6789)->Js.log
```

```res example
/* print "1.2e+21" */
\"@@"(Js.log, Js.Float.toPrecision(1.2e21))
Js.Float.toPrecision(1.2e21)->Js.log
```

## toPrecisionWithPrecision
Expand All @@ -177,12 +177,12 @@ Raises `RangeError` if `digits` is not in the range accepted by this function.

```res example
/* prints "1e+4" */
\"@@"(Js.log, Js.Float.toPrecisionWithPrecision(12345.6789, ~digits=1))
Js.Float.toPrecisionWithPrecision(12345.6789, ~digits=1)->Js.log
```

```res example
/* prints "0.0" */
\"@@"(Js.log, Js.Float.toPrecisionWithPrecision(0., ~digits=2))
Js.Float.toPrecisionWithPrecision(0., ~digits=2)->Js.log
```

## toString
Expand All @@ -196,7 +196,7 @@ Returns a `string` representing the given value in fixed-point (usually).

```res example
/* prints "12345.6789" */
\"@@"(Js.log, Js.Float.toString(12345.6789))
Js.Float.toString(12345.6789)->Js.log
```

## toStringWithRadix
Expand All @@ -213,22 +213,23 @@ Raises `RangeError` if `radix` is not in the range \[2, 36\] (inclusive).

```res example
/* prints "110" */
\"@@"(Js.log, Js.Float.toStringWithRadix(6., ~radix=2))
Js.Float.toStringWithRadix(6., ~radix=2)->Js.log
```

```res example
/* prints "11.001000111101011100001010001111010111000010100011111" */
\"@@"(Js.log, Js.Float.toStringWithRadix(3.14, ~radix=2))
Js.Float.toStringWithRadix(3.14, ~radix=2)->Js.log
```

```res example
/* prints "deadbeef" */
\"@@"(Js.log, Js.Float.toStringWithRadix(3735928559., ~radix=16))
Js.Float.toStringWithRadix(3735928559., ~radix=16)->Js.log

```

```res example
/* prints "3f.gez4w97ry0a18ymf6qadcxr" */
\"@@"(Js.log, Js.Float.toStringWithRadix(123.456, ~radix=36))
Js.Float.toStringWithRadix(123.456, ~radix=36)->Js.log
```

## fromString
Expand Down