Skip to content

Conversation

@SupunS
Copy link
Member

@SupunS SupunS commented Aug 27, 2025

Fix #4172

Implements FLIP: onflow/flips#344

Description

Use truncation division (big.Int.Quo()) instead of rounding, for number types backed by big.Int, to be consistent with the rest of the number types that are backed by Go's primitive values.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@github-actions
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 26e0f76
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Collapsed results for better readability

@SupunS SupunS marked this pull request as ready for review August 27, 2025 18:45
@SupunS SupunS self-assigned this Aug 27, 2025
@SupunS SupunS added the Bugfix label Aug 27, 2025
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@j1010001 j1010001 mentioned this pull request Aug 29, 2025
1 task
@SupunS
Copy link
Member Author

SupunS commented Aug 29, 2025

Going to merge this PR, so that we can get a preview release (and then a CLI build) out for people to test the new behaviour.

Merging the implementation doesn't mean this change is final, but rather is still very much subject to the outcome of the FLIP onflow/flips#344. If the sentiment is not positive on the FLIP, we can revert the PR. It's much more easier to revert, than having to manage separate branches for all the downstream dependencies needed for the CLI preview release.

@SupunS SupunS merged commit f69e3d8 into master Aug 29, 2025
12 checks passed
@SupunS SupunS deleted the supun/number-type-rounding branch September 19, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unusual rounding behaviour (Fix64, Int128, Int256, Int)

4 participants