ref: 16c6e1242f50320bf8531e979bcb75ecfe88f9b5
dir: /lib/math/test/round-impl.myr/
use std use math use testr const main = { testr.run([ [.name = "round-01", .fn = round01], [.name = "round-02", .fn = round02], ][:]) } const round01 = {c var inputs : (flt32, int32)[:] = [ (123.4, 123), (0.0, 0), (-0.0, 0), (1.0, 1), (1.1, 1), (0.9, 1), (15.3, 15), (15.5, 16), (15.7, 16), (16.3, 16), (16.5, 16), (16.7, 17), (-102.1, -102), (-102.5, -102), (-102.7, -103), (-103.1, -103), (-103.5, -104), (-103.7, -104), (2147483641.5, -2147483648), (2147483646.5, -2147483648), (2147483647.5, -2147483648), (2147483649.0, -2147483648), (-2147483641.5, -2147483648), (-2147483646.5, -2147483648), (-2147483647.5, -2147483648), (-2147483649.0, -2147483648), ][:] for (f, g) : inputs testr.eq(c, math.rn(f), g) ;; } const round02 = {c var inputs : (flt64, int64)[:] = [ (123.4, 123), (0.0, 0), (-0.0, 0), (1.0, 1), (1.1, 1), (0.9, 1), (15.3, 15), (15.5, 16), (15.7, 16), (16.3, 16), (16.5, 16), (16.7, 17), (-102.1, -102), (-102.5, -102), (-102.7, -103), (-103.1, -103), (-103.5, -104), (-103.7, -104), (2147483641.5, 2147483642), (2147483646.5, 2147483646), (2147483647.5, 2147483648), (2147483649.0, 2147483649), (-2147483641.5, -2147483642), (-2147483646.5, -2147483646), (-2147483647.5, -2147483648), (-2147483649.0, -2147483649), (9223372036854775806.1, -9223372036854775808), (-9223372036854775806.1, -9223372036854775808), ][:] for (f, g) : inputs testr.eq(c, math.rn(f), g) ;; }