mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
merge tmath_misc.nim into tmath.nim (#16591)
This commit is contained in:
@@ -357,5 +357,18 @@ template main =
|
||||
doAssert copySign(10.0, -NaN) == 10.0
|
||||
doAssert copySign(1.0, copySign(NaN, -1.0)) == -1.0 # fails in VM
|
||||
|
||||
block:
|
||||
doAssert 1.0 / abs(-0.0) == Inf
|
||||
doAssert 1.0 / abs(0.0) == Inf
|
||||
doAssert -1.0 / abs(-0.0) == -Inf
|
||||
doAssert -1.0 / abs(0.0) == -Inf
|
||||
doAssert abs(0.0) == 0.0
|
||||
doAssert abs(0.0'f32) == 0.0'f32
|
||||
|
||||
doAssert abs(Inf) == Inf
|
||||
doAssert abs(-Inf) == Inf
|
||||
doAssert abs(NaN).isNaN
|
||||
doAssert abs(-NaN).isNaN
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
discard """
|
||||
targets: "c js"
|
||||
"""
|
||||
|
||||
# TODO merge this to tmath.nim once tmath.nim supports js target
|
||||
|
||||
import math
|
||||
|
||||
proc main() =
|
||||
block:
|
||||
doAssert 1.0 / abs(-0.0) == Inf
|
||||
doAssert 1.0 / abs(0.0) == Inf
|
||||
doAssert -1.0 / abs(-0.0) == -Inf
|
||||
doAssert -1.0 / abs(0.0) == -Inf
|
||||
doAssert abs(0.0) == 0.0
|
||||
doAssert abs(0.0'f32) == 0.0'f32
|
||||
|
||||
doAssert abs(Inf) == Inf
|
||||
doAssert abs(-Inf) == Inf
|
||||
doAssert abs(NaN).isNaN
|
||||
doAssert abs(-NaN).isNaN
|
||||
|
||||
static: main()
|
||||
main()
|
||||
Reference in New Issue
Block a user