Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
krux02 committed Feb 6, 2020
1 parent ce1a9a9 commit 64ac0e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/float/tfloat8.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


{.passL: "-lm".}

import strutils

proc nextafter(a,b: float64): float64 {.importc: "nextafter", header: "<math.h>".}

var myFloat = 2.5

for i in 0 .. 100:
let newFloat = nextafter(myFloat, Inf)
let oldStr = $myFloat
let newStr = $newFloat
doAssert parseFloat(newStr) == newFloat
doAssert oldStr != newStr
myFloat = newFloat

0 comments on commit 64ac0e7

Please sign in to comment.