Skip to content

Commit abb4d81

Browse files
committed
Update belt_Float.mli doc headers
1 parent 4609b2e commit abb4d81

File tree

1 file changed

+66
-3
lines changed

1 file changed

+66
-3
lines changed

jscomp/others/belt_Float.mli

+66-3
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,85 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
(** [`Belt.Float`]()
26-
Utililites for Float
27-
*)
25+
(** This module includes convenience methods for handling `float` types. *)
2826

2927
external toInt: float -> int = "%intoffloat"
28+
(**
29+
Converts a given `float` to an `int`.
30+
31+
```res example
32+
Js.log(Belt.Float.toInt(1.0) === 1) /* true */
33+
```
34+
*)
3035

3136
external fromInt: int -> float = "%identity"
37+
(**
38+
Converts a given `int` to a `float`.
39+
40+
```res example
41+
Js.log(Belt.Float.fromInt(1) === 1.0) /* true */
42+
```
43+
*)
3244

3345
val fromString: string -> float option
46+
(**
47+
Converts a given `string` to a `float`. Returns `Some(float)` when the input is a number, `None` otherwise.
48+
49+
```res example
50+
Js.log(Belt.Float.fromString("1.0") === Some(1.0)) /* true */
51+
```
52+
*)
53+
3454

3555
external toString: float -> string = "String" [@@bs.val]
56+
(**
57+
Converts a given `float` to a `string`. Uses the JavaScript `String` constructor under the hood.
58+
59+
```res example
60+
Js.log(Belt.Float.toString(1.0) === "1.0") /* true */
61+
```
62+
*)
3663

3764
external ( + ) : float -> float -> float = "%addfloat"
65+
(**
66+
Addition of two `float` values.
67+
Can be opened in a module to avoid dot-notation (`+.`), however this yields a shadow warning (Warning number 44) in the default configuration.
68+
69+
```res example
70+
open Belt.Float
71+
Js.log(2.0 + 2.0 === 4.0) /* true */
72+
```
73+
*)
3874

3975
external ( - ) : float -> float -> float = "%subfloat"
76+
(**
77+
Subtraction of two `float` values.
78+
Can be opened in a module to avoid dot-notation (`-.`), however this yields a shadow warning (Warning number 44) in the default configuration.
79+
80+
```res example
81+
open Belt.Float
82+
Js.log(2.0 - 1.0 === 1.0) /* true */
83+
```
84+
*)
4085

4186
external ( * ) : float -> float -> float = "%mulfloat"
87+
(**
88+
Multiplication of two `float` values.
89+
Can be opened in a module to avoid dot-notation (`*.`), however this yields a shadow warning (Warning number 44) in the default configuration.
90+
91+
```res example
92+
open Belt.Float
93+
Js.log(2.0 * 2.0 === 4.0) /* true */
94+
```
95+
*)
4296

4397
external ( / ) : float -> float -> float = "%divfloat"
98+
(**
99+
Division of two `float` values.
100+
Can be opened in a module to avoid dot-notation (`/.`), however this yields a shadow warning (Warning number 44) in the default configuration.
101+
102+
```res example
103+
open Belt.Float
104+
Js.log(4.0 / 2.0 === 2.0) /* true */
105+
```
106+
*)

0 commit comments

Comments
 (0)