ref: 156c048f0239b99b870cf1694c6886e39b85ae09
dir: /lib/math/test/trunc-impl.myr/
use std use math use testr const main = { math.fptrap(false) testr.run([ [.name = "trunc-01", .fn = trunc01], [.name = "trunc-02", .fn = trunc02], [.name = "floor-01", .fn = floor01], [.name = "floor-02", .fn = floor02], [.name = "ceil-01", .fn = ceil01], [.name = "ceil-02", .fn = ceil02], ][:]) } const trunc01 = {c var flt32s : (flt32, flt32)[:] = [ (123.4, 123.0), (0.0, 0.0), (-0.0, -0.0), (1.0, 1.0), (1.1, 1.0), (0.9, 0.0), (10664524000000000000.0, 10664524000000000000.0), (-3.5, -3.0), (101.999, 101.0), (std.flt32nan(), std.flt32nan()), ][:] for (f, g) : flt32s testr.eq(c, math.trunc(f), g) ;; } const trunc02 = {c var flt64s : (flt64, flt64)[:] = [ (0.0, 0.0), (-0.0, -0.0), (1.0, 1.0), (1.1, 1.0), (0.9, 0.0), (13809453812721350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0, 13809453812721350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0), (-3.5, -3.0), (101.999, 101.0), (std.flt64nan(), std.flt64nan()), ][:] for (f, g) : flt64s testr.eq(c, math.trunc(f), g) ;; } const floor01 = {c var flt32s : (flt32, flt32)[:] = [ (0.0, 0.0), (-0.0, -0.0), (0.5, 0.0), (1.1, 1.0), (10664524000000000000.0, 10664524000000000000.0), (-3.5, -4.0), (-101.999, -102.0), (-126.999, -127.0), (-127.999, -128.0), (-128.999, -129.0), (std.flt32nan(), std.flt32nan()), ][:] for (f, g) : flt32s testr.eq(c, math.floor(f), g) ;; } const floor02 = {c var flt64s : (flt64, flt64)[:] = [ (0.0, 0.0), (-0.0, -0.0), (0.5, 0.0), (1.1, 1.0), (13809453812721350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0, 13809453812721350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0), (-3.5, -4.0), (-101.999, -102.0), (std.flt64nan(), std.flt64nan()), ][:] for (f, g) : flt64s testr.eq(c, math.floor(f), g) ;; } const ceil01 = {c var flt32s : (flt32, flt32)[:] = [ (0.0, 0.0), (-0.0, -0.0), (0.5, 1.0), (-0.1, -0.0), (1.1, 2.0), (10664524000000000000.0, 10664524000000000000.0), (-3.5, -3.0), (-101.999, -101.0), (std.flt32nan(), std.flt32nan()), ][:] for (f, g) : flt32s testr.eq(c, math.ceil(f), g) ;; } const ceil02 = {c var flt64s : (flt64, flt64)[:] = [ (0.0, 0.0), (-0.0, -0.0), (0.5, 1.0), (-0.1, -0.0), (1.1, 2.0), (13809453812721350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0, 13809453812721350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0), (-3.5, -3.0), (-101.999, -101.0), (std.flt64nan(), std.flt64nan()), ][:] for (f, g) : flt64s testr.eq(c, math.ceil(f), g) ;; }