Misleading error message for @floatToInt
#12829
Labels
error message
This issue points out an error message that is unhelpful and should be improved.
Milestone
Zig Version
0.10.0-dev.3880+e2bb92b2e
Steps to Reproduce
Call
@floatToInt
for anan
value, like this:Expected Behavior
The error message should either explicitely list the nan/infinity case:
panic: integer part of floating point value out of bounds or not finite
Or there should be seperate error message for nan values:
panic: cannot cast nan value to int
I'd personally prefer the second one, because it gives me more data that I can use for debugging, but the first one would also be fine.
Actual Behavior
panic: integer part of floating point value out of bounds
To me this error message implies that the float has an integer part and therefor is finite.
The text was updated successfully, but these errors were encountered: