not ok 9 - 1073741824 + 1073741824 : got -2147483648, expected 2147483648.
# Failed test '1073741824 + 1073741824 : got -2147483648, expected 2147483648.'
# at ../math-anyint/test.pl line 28.
# got: '-2147483648'
# expected: '2147483648'
not ok 10 - Testing NERDVANA's C additon calc()
# Failed test 'Testing NERDVANA's C additon calc()'
# at ../math-anyint/test.pl line 34.
# got: '-2147483648'
# expected: '2147483648'
1..10
# Looks like you failed 2 tests of 10.
####
use strict;
use warnings;
use Inline C => <<'EOC';
/* As the function appears in AnyInt.pm */
long calc_32bit_signed_in_C(long input) {
return (int32_t)((int32_t)input);
}
/* The same function, renamed to begin with an
underscore, and return type altered to int */
int _calc_32bit_signed_in_C(int input) {
return (int32_t)((int32_t)input);
}
EOC
print calc_32bit_signed_in_C(1073741824 + 1073741824), "\n";
print _calc_32bit_signed_in_C(1073741824 + 1073741824), "\n";
__END__
Outputs:
-2147483648
-2147483648
####
2147483648
2147483648