Add toFloat, fix toInt truncation, and add MIN/MAX constants to Int64/Int32/UInt64#12836
Merged
Simn merged 3 commits intohaxe-numericfrom Mar 17, 2026
Merged
Add toFloat, fix toInt truncation, and add MIN/MAX constants to Int64/Int32/UInt64#12836Simn merged 3 commits intohaxe-numericfrom
Simn merged 3 commits intohaxe-numericfrom
Conversation
Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Unify numeric types API across all targets
Add toFloat, fix toInt truncation, and add MIN/MAX constants to Int64/Int32/UInt64
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses several gaps in the
Int64/Int32/UInt64API: missingtoFloat, inconsistenttoIntoverflow behavior, and lack ofMIN/MAXconstants.Int64.toFloat()New instance method across all targets. Cross-platform and eval/C++ use
high * 2^32 + unsigned_low; JVM and HL use native signed-to-float casts.Int64.toInt()— silent truncationPreviously threw
"Overflow"when the value exceeded 32-bit range. Now silently returns the low 32 bits, consistent withUInt64.toInt()and all other numeric types. Applied to all implementations (cross-platform, JVM, HL, eval, C++).MIN/MAXconstantsAdded
static final MINandstatic final MAXtohaxe.Int64,haxe.Int32, andhaxe.UInt64:Int64-2^632^63 - 1Int32-2^312^31 - 1UInt6402^64 - 1Tests
TestInt64: removed overflow-throw expectations, addedtestToFloatandtestMinMaxTestInt32: both test files updated to referenceInt32.MAX/Int32.MIN; addedtestMinMaxTestUInt64: addedtestMinMax📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.