Created
October 22, 2019 21:30
-
-
Save Schmavery/b54f53a66098dadf04c3191bf9ce7b5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BigInt = { | |
type t = float; | |
[@bs.val] external ofString: string => t = "BigInt"; | |
[@bs.val] external ofInt: int => t = "BigInt"; | |
external (<): (t, t) => bool = "%lessthan"; | |
external (<=): (t, t) => bool = "%lessequal"; | |
external (>): (t, t) => bool = "%greaterthan"; | |
external (>=): (t, t) => bool = "%greaterequal"; | |
external (==): (t, t) => bool = "%equal"; | |
external (+): (t, t) => t = "%addfloat"; | |
external (-): (t, t) => t = "%subfloat"; | |
external ( * ): (t, t) => t = "%mulfloat"; | |
external (/): (t, t) => t = "%divfloat"; | |
let zero = ofInt(0); | |
let one = ofInt(1); | |
}; | |
/* | |
let test = (n1, n2) => { | |
open! BigInt; | |
Js.log(n1 + n2); | |
Js.log(n1 - n2); | |
Js.log(n1 / n2); | |
Js.log(n1 * n2); | |
Js.log(n1 > n2); | |
Js.log(n1 >= n2); | |
Js.log(n1 < n2); | |
Js.log(n1 <= n2); | |
Js.log(n1 == n2); | |
(); | |
}; | |
test(BigInt.ofInt(1), BigInt.ofInt(2)); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment