mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Incorrect rounding at compile time going from double to int.
This commit is contained in:
14
test/unit/regression/float_compile_time_conversion.c3
Normal file
14
test/unit/regression/float_compile_time_conversion.c3
Normal file
@@ -0,0 +1,14 @@
|
||||
module float_ct;
|
||||
|
||||
fn void float_ct() @test
|
||||
{
|
||||
var $input = 3e25;
|
||||
var $temp = (int128)$input;
|
||||
var $temp2 = (double)$temp;
|
||||
test::eq_approx($temp2, 3e25);
|
||||
|
||||
var $input2 = -3e25;
|
||||
var $temp3 = (int128)$input2;
|
||||
var $temp4 = (double)$temp3;
|
||||
test::eq_approx($temp4, -3e25);
|
||||
}
|
||||
Reference in New Issue
Block a user