diff --git a/builtin/bigint_nonjs.mbt b/builtin/bigint_nonjs.mbt index 22d55389e..7f0ca4671 100644 --- a/builtin/bigint_nonjs.mbt +++ b/builtin/bigint_nonjs.mbt @@ -588,7 +588,7 @@ pub fn to_string(self : BigInt) -> String { // This is an approximation of the number of slots needed to represent the decimal value. let decimal_len = ((self.len * radix_bit_len).to_double() * decimal_ratio / - decimal_radix_bit_len.to_double()).unchecked_to_int() + + decimal_radix_bit_len.to_double()).to_unchecked_int() + 1 let s = if self.sign == Negative { "-" } else { "" } let v = Array::make(decimal_len, 0L) @@ -637,7 +637,7 @@ pub fn BigInt::from_string(input : String) -> BigInt { } let sign : Sign = if input[0] == '-' { Negative } else { Positive } let mut b_len = ( - (len.to_double() / decimal_ratio).unchecked_to_int() + 1 + radix_bit_len + (len.to_double() / decimal_ratio).to_unchecked_int() + 1 + radix_bit_len ) / radix_bit_len + 1 diff --git a/builtin/double.mbt b/builtin/double.mbt index 369a7dfe8..805bfea3c 100644 --- a/builtin/double.mbt +++ b/builtin/double.mbt @@ -48,6 +48,6 @@ pub fn Double::to_int(self : Double) -> Int { } else if self <= -2147483648 { -2147483648 } else { - self.unchecked_to_int() + self.to_unchecked_int() } } diff --git a/builtin/intrinsics.mbt b/builtin/intrinsics.mbt index 3f50193c2..3e880b6cb 100644 --- a/builtin/intrinsics.mbt +++ b/builtin/intrinsics.mbt @@ -189,7 +189,7 @@ pub fn Double::compare(self : Double, other : Double) -> Int = "%f64_compare" pub fn Double::default() -> Double = "%f64_default" ///| -fn Double::unchecked_to_int(self : Double) -> Int = "%f64_to_i32" +fn Double::to_unchecked_int(self : Double) -> Int = "%f64_to_i32" ///| pub fn Double::convert_uint(val : UInt) -> Double = "%u32.to_f64" diff --git a/float/float.mbt b/float/float.mbt index c301d02b3..2709ad8af 100644 --- a/float/float.mbt +++ b/float/float.mbt @@ -46,7 +46,7 @@ pub fn Float::default() -> Float { } ///| -fn Float::unchecked_to_int(self : Float) -> Int = "%f32.to_i32" +fn Float::to_unchecked_int(self : Float) -> Int = "%f32.to_i32" ///| /// Converts a floating-point number to an integer, with proper handling of @@ -81,6 +81,6 @@ pub fn Float::to_int(self : Float) -> Int { } else if self <= -2147483648 { -2147483648 } else { - self.unchecked_to_int() + self.to_unchecked_int() } }