Giter VIP home page Giter VIP logo

Comments (5)

asik avatar asik commented on June 26, 2024 1

This is the code that does it:

        public static explicit operator Fix64(float value)
        {
            return new Fix64((long)(value * ONE));
        }

Two things happen:

  • the float is multiplied by an integer constant (this is floating point multiplication)
  • then it is cast to a 64-bit integer

The multiplication must be deterministic because the constant is a power of two (so it amounts to incrementing the exponent on the result).
The float->integer cast behavior is specified as per the CLI spec.

So, I don't see how that wouldn't be deterministic.

from fixedmath.net.

asik avatar asik commented on June 26, 2024

Well, except maybe for #9

It's been so long I don't really recall what the exact issue was. Just because that behavior is unspecified doesn't mean it actually varies across architectures.

from fixedmath.net.

benlabbeus avatar benlabbeus commented on June 26, 2024

Totally makes sense. Thanks for the prompt response!

from fixedmath.net.

jpgordon00 avatar jpgordon00 commented on June 26, 2024

I needed this information too. I'm going to ship my product with FixedMath assuming that casting to and from floats are deterministic.

from fixedmath.net.

asik avatar asik commented on June 26, 2024

There's an open issue about this, but I'm not willing to put in the time to research how to best address it.
I'll just archive this repo so people understand that this is not actively maintained anymore. Feel free to fork and improve it.

from fixedmath.net.

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.