Coder Social home page Coder Social logo

Rescaling a value with significant scale 28 to scale 29 creates a value with scale 29 and overflows on subtraction about rust-decimal HOT 1 CLOSED

david-monroe avatar david-monroe commented on July 24, 2024
Rescaling a value with significant scale 28 to scale 29 creates a value with scale 29 and overflows on subtraction

from rust-decimal.

Comments (1)

paupino avatar paupino commented on July 24, 2024

Thanks for raising this. I performed some analysis and found that (long story short) scale 29 was causing an issue since it was "aligning" to a scale of 29 however reconstructing to a scale of 28. Because a scale of 29 is technically unsupported (except for very small numbers) it made sense to instead force scaling to 28 which effectively solves the issue.

To note, it didn't happen for scale of 30 since the very small number leaked into the high word triggering a full rescale. For scale 28 we didn't see the issue either since it was already within scale.

from rust-decimal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.