From 068f0d9faf809fcd35c02f78476597f6193e7c6d Mon Sep 17 00:00:00 2001 From: David Mak Date: Fri, 6 Oct 2023 17:35:18 +0800 Subject: [PATCH] core: Do not cast floor/ceil result to int NumPy explicitly states that the return type of the floor/ceil is float. --- nac3core/src/toplevel/builtins.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index cdb8f31f..1b9ef28f 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -762,15 +762,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { .try_as_basic_value() .left() .unwrap(); - Ok(Some( - ctx.builder - .build_float_to_signed_int( - val.into_float_value(), - ctx.ctx.i32_type(), - "fptosi", - ) - .into(), - )) + Ok(val.into()) }, )))), loc: None, @@ -802,15 +794,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { .try_as_basic_value() .left() .unwrap(); - Ok(Some( - ctx.builder - .build_float_to_signed_int( - val.into_float_value(), - ctx.ctx.i32_type(), - "fptosi", - ) - .into(), - )) + Ok(val.into()) }, )))), loc: None,