Skip to content

Instantly share code, notes, and snippets.

@Schmavery
Created October 22, 2019 21:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Schmavery/b54f53a66098dadf04c3191bf9ce7b5c to your computer and use it in GitHub Desktop.
Save Schmavery/b54f53a66098dadf04c3191bf9ce7b5c to your computer and use it in GitHub Desktop.
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