forked from amber-lang/amber
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(std):
std
math functions. (amber-lang#384)
* feat(std): more rounding `std` math functions. implements the math functions suggested in amber-lang#328 * feat(std): `abs` function * fix(shellcheck)
- Loading branch information
1 parent
f6dca85
commit 0c69b65
Showing
5 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * from "std/math" | ||
|
||
// Output | ||
// 1 | ||
// 1 | ||
|
||
main { | ||
echo abs(1); | ||
echo abs(-1); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * from "std/math" | ||
|
||
// Output | ||
// 2 | ||
// -1 | ||
|
||
main { | ||
echo ceil(1.1); | ||
echo ceil(-1.9); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * from "std/math" | ||
|
||
// Output | ||
// 1 | ||
// -2 | ||
|
||
main { | ||
echo floor(1.9); | ||
echo floor(-1.1); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * from "std/math" | ||
|
||
// Output | ||
// 1 | ||
// 2 | ||
// -1 | ||
// -2 | ||
|
||
main { | ||
echo round(1.1); | ||
echo round(1.5); | ||
echo round(-1.1); | ||
echo round(-1.5); | ||
} |