Skip to content
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

Error printing negative values with fmt.println and fmt.print #19

Closed
kevinend opened this issue Feb 8, 2017 · 1 comment
Closed

Error printing negative values with fmt.println and fmt.print #19

kevinend opened this issue Feb 8, 2017 · 1 comment
Labels

Comments

@kevinend
Copy link

kevinend commented Feb 8, 2017

Hey Bill,

I was playing around with Odin last night (I love what you have done so far) and noticed a bug in trying to print the value -1 using fmt.print and fmt.println. The value produced was -18,446,744,073,709,551,615. I am using v0.0.6 of the compiler btw in case this has since been fixed. It may just be a conversion error in the printing functions since I used the value containing -1 elsewhere in other expressions and everything worked fine.

FYI: I just tried it again this morning and the error still occurs. It looks like it is happening with negative values in general. I didn't test too many numbers but thought I should update my comment.

@kevinend kevinend changed the title Error printing -1 with fmt.println and fmt.print Error printing negative values with fmt.println and fmt.print Feb 8, 2017
@gingerBill
Copy link
Member

This is just a library bug. It will be fixed in the next update but if you want to fix it now, in fmt.odin and procedure fmt_integer, change:

u = abs(u); // from
u = cast(u64)abs(cast(i64)u); // to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants