New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printf("%d", -2147483648) shows an extra "-" #3148

Closed
tsahara opened this Issue Apr 22, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@tsahara
Member

tsahara commented Apr 22, 2016

(confirmed on OpenBSD/amd64 and MacOS)

% bin/mruby -e 'printf("%d\n", -2147483648)'
--2147483648

It works as expected for -2147483647 and -2147483649:

% bin/mruby -e 'printf("%d\n", -2147483647)'
-2147483647

% bin/mruby -e 'printf("%d\n", -2147483649)'
trace:
    [0] /Users/tsahara/src/mruby/mrbgems/mruby-print/mrblib/print.rb:60:in Kernel#printf
    [1] -e:1
/Users/tsahara/src/mruby/mrbgems/mruby-print/mrblib/print.rb:60: number (-2147483649) too big for integer (ArgumentError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment