From e983ef4c94a99f033b3e894379978c90c13229ce Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Tue, 7 Apr 2020 19:27:23 +0200 Subject: [PATCH 1/3] Add ediv description --- gitlab-pages/docs/reference/toplevel.md | 45 +++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/gitlab-pages/docs/reference/toplevel.md b/gitlab-pages/docs/reference/toplevel.md index 91a39aa3b..413e3b36b 100644 --- a/gitlab-pages/docs/reference/toplevel.md +++ b/gitlab-pages/docs/reference/toplevel.md @@ -65,7 +65,7 @@ function failwith : string -> unit val failwith : string -> unit -let failwith : string => unit +let failwith: string => unit Cause the contract to fail with an error message. @@ -80,7 +80,48 @@ function assert : bool -> unit val assert : bool -> unit -let assert : bool => unit +let assert: bool => unit Check if a certain condition has been met. If not the contract will fail. + + +function ediv : int -> int -> option (int * nat) + + +function ediv : mutez -> nat -> option (mutez * mutez) + + +function ediv : mutez -> mutez -> option (mutez * nat) + + +function ediv : nat -> nat -> option (nat * nat) + + + +val ediv : int -> int -> (int * nat) option + + +val ediv : mutez -> nat -> (mutez * mutez) option + + +val ediv : mutez -> mutez -> (mutez * nat) option + + +val ediv : nat -> nat -> (nat * nat) option + + + +let ediv: (int, int) => option((int, nat)) + + +let ediv: (mutez, nat) => option((mutez, mutez)) + + +let ediv: (mutez, mutez) => option((mutez, nat)) + + +let ediv: (nat, nat) => option((nat, nat)) + + +Perform one operation to get both the quotient and remainder of a division. From b15694b5bc9a095588c12b30484f5687e2308f37 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Tue, 7 Apr 2020 17:11:19 -0500 Subject: [PATCH 2/3] Fix some types, describe more details --- gitlab-pages/docs/reference/toplevel.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gitlab-pages/docs/reference/toplevel.md b/gitlab-pages/docs/reference/toplevel.md index 413e3b36b..ba311cdec 100644 --- a/gitlab-pages/docs/reference/toplevel.md +++ b/gitlab-pages/docs/reference/toplevel.md @@ -92,7 +92,7 @@ function ediv : int -> int -> option (int * nat) function ediv : mutez -> nat -> option (mutez * mutez) -function ediv : mutez -> mutez -> option (mutez * nat) +function ediv : mutez -> mutez -> option (nat * mutez) function ediv : nat -> nat -> option (nat * nat) @@ -105,7 +105,7 @@ val ediv : int -> int -> (int * nat) option val ediv : mutez -> nat -> (mutez * mutez) option -val ediv : mutez -> mutez -> (mutez * nat) option +val ediv : mutez -> mutez -> (nat * mutez) option val ediv : nat -> nat -> (nat * nat) option @@ -118,10 +118,10 @@ let ediv: (int, int) => option((int, nat)) let ediv: (mutez, nat) => option((mutez, mutez)) -let ediv: (mutez, mutez) => option((mutez, nat)) +let ediv: (mutez, mutez) => option((nat, mutez)) let ediv: (nat, nat) => option((nat, nat)) -Perform one operation to get both the quotient and remainder of a division. +Compiles to Michelson `EDIV`, one operation to get both the quotient and remainder of a division. `ediv x y` returns None if `y` is zero, otherwise returns `Some (quotient, remainder)` such that `x = (quotient * y) + remainder` and `0 <= remainder < y`. From 6613883296a63def44ffcfe1d7746f52e0eb0e44 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Tue, 7 Apr 2020 17:33:20 -0500 Subject: [PATCH 3/3] Fix description --- gitlab-pages/docs/reference/toplevel.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-pages/docs/reference/toplevel.md b/gitlab-pages/docs/reference/toplevel.md index ba311cdec..ce19cfa08 100644 --- a/gitlab-pages/docs/reference/toplevel.md +++ b/gitlab-pages/docs/reference/toplevel.md @@ -124,4 +124,4 @@ let ediv: (mutez, mutez) => option((nat, mutez)) let ediv: (nat, nat) => option((nat, nat)) -Compiles to Michelson `EDIV`, one operation to get both the quotient and remainder of a division. `ediv x y` returns None if `y` is zero, otherwise returns `Some (quotient, remainder)` such that `x = (quotient * y) + remainder` and `0 <= remainder < y`. +Compiles to Michelson `EDIV`, one operation to get both the quotient and remainder of a division. `ediv x y` returns None if `y` is zero, otherwise returns `Some (quotient, remainder)` such that `x = (quotient * y) + remainder` and `0 <= remainder < abs(y)`.