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

Fix #4225 #4226

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Fix #4225 #4226

merged 1 commit into from
Sep 10, 2024

Conversation

Kelimion
Copy link
Member

Fixes #4225. Turns compiler assert into:

W:/Odin/bug/bug.odin(6:26) Error: Cannot cast '42.1' as 'u64' from 'untyped float' 
	v := transmute(i64)(u64(42.1)) 
	                        ^~~^ 
	42.100000 cannot be represented without truncation/rounding as the type 'u64' 

@ghost
Copy link

ghost commented Sep 10, 2024

Great diagnosis Jeroen and wonderful error message. Thank you!

@Kelimion
Copy link
Member Author

Just commenting out the assert also works, so it could be that it's a remnant from before the inexact error message was added. I leave this to @gingerBill to decide which approach is better here.

@Kelimion Kelimion merged commit 4df668f into odin-lang:master Sep 10, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(BUG) Compiler crash (.cpp assertion) due to non-exact integer value from casting
2 participants