-
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch timespan mult/div to use doubles until creating the timespan
- Loading branch information
Showing
2 changed files
with
24 additions
and
9 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
12 changes: 12 additions & 0 deletions
12
src/test/skript/tests/regressions/7645-floating point timespan math.sk
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,12 @@ | ||
options: | ||
max-timespan: 9223372036854775807 milliseconds | ||
|
||
test "floating point timespan math": | ||
assert (0.9 * 5 seconds) is 4.5 seconds with "failed basic floating point multiplication" | ||
assert (1 * 5 seconds) is 5 seconds with "failed basic integer multiplication" | ||
assert (0.0 * 5 seconds) is 0 seconds with "failed multiplication by 0" | ||
assert (5 seconds / 5) is 1 seconds with "failed integer division" | ||
assert (5 seconds / 2.5) is 2 seconds with "failed floating point division" | ||
assert (5 seconds / infinity value) is not set with "Division by infinity unexpectedly returned real value" | ||
|
||
assert (5 seconds * 10 ^ 308) is {@max-timespan} with "failed to clamp to the long max value" |