Skip to content

Commit 1da4c92

Browse files
committed
add test
1 parent ce1a9a9 commit 1da4c92

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/float/tfloat8.nim

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
discard """
2+
disabled: windows
3+
"""
4+
5+
{.passL: "-lm".} # not sure how to do this on windows
6+
7+
import strutils
8+
9+
proc nextafter(a,b: float64): float64 {.importc: "nextafter", header: "<math.h>".}
10+
11+
var myFloat = 2.5
12+
13+
for i in 0 .. 100:
14+
let newFloat = nextafter(myFloat, Inf)
15+
let oldStr = $myFloat
16+
let newStr = $newFloat
17+
doAssert parseFloat(newStr) == newFloat
18+
doAssert oldStr != newStr
19+
myFloat = newFloat

0 commit comments

Comments
 (0)