From 23f0805f2096c9725eb052a062e1c05fda71303c Mon Sep 17 00:00:00 2001 From: David Mak Date: Fri, 3 Nov 2023 10:04:03 +0800 Subject: [PATCH] core: Remove trunc The behavior of trunc is already implemented by casts and is therefore redundant. --- nac3core/src/toplevel/builtins.rs | 9 --------- nac3standalone/demo/src/math.py | 5 ----- 2 files changed, 14 deletions(-) diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index f2d59b54..8c0cd1c4 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -1448,14 +1448,6 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { &[(float, "x")], "llvm.fabs.f64", ), - create_fn_by_intrinsic( - primitives, - &var_map, - "trunc", - float, - &[(float, "x")], - "llvm.trunc.f64", - ), create_fn_by_intrinsic( primitives, &var_map, @@ -1925,7 +1917,6 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { "log10", "log2", "fabs", - "trunc", "sqrt", "rint", "tan", diff --git a/nac3standalone/demo/src/math.py b/nac3standalone/demo/src/math.py index dfbd4cae..52d62749 100644 --- a/nac3standalone/demo/src/math.py +++ b/nac3standalone/demo/src/math.py @@ -95,10 +95,6 @@ def test_ceil64(): for x in [-1.5, -0.5, 0.5, 1.5]: output_int64(ceil64(x)) -def test_trunc(): - for x in [-1.5, -0.5, 0.5, 1.5, dbl_inf(), -dbl_inf(), dbl_nan()]: - output_float64(trunc(x)) - def test_sqrt(): for x in [1.0, 2.0, 4.0, dbl_inf(), -dbl_inf(), dbl_nan()]: output_float64(sqrt(x)) @@ -232,7 +228,6 @@ def run() -> int32: test_floor64() test_ceil() test_ceil64() - test_trunc() test_sqrt() test_rint() test_tan()