Comments (5)
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.
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.
Totally makes sense. Thanks for the prompt response!
from fixedmath.net.
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.
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)
- Thanks HOT 7
- Could you add Pow()? HOT 3
- Seems to be possible to convert into hardware implementation HOT 6
- Is this library correct in terms of Base10 calculations? HOT 1
- ReflectionTypeLoadException: The classes in the module cannot be loaded. HOT 2
- request for Fixed32 too HOT 4
- Function Pow bug report HOT 1
- how to transfer by network? HOT 2
- A bug when use Acos() to 2 normalized vector HOT 2
- Suggestion adding **Fixed Point** keyword in description HOT 1
- Is changing "Fractional_Places" supported? HOT 2
- Using Math. for Fix32 HOT 6
- Debugging Determinism? (discussion) HOT 6
- Determinism HOT 3
- Suggestion: need profiling.
- Problem: Sqrt() for Q48.15 format implementation HOT 1
- FixedMath.Net with Net 3.5 (Unity3D) HOT 6
- Any plans to make all conversions deterministic? HOT 15
- Conversions from float and double are unspecified in case of overflow
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fixedmath.net.