Comments (4)
There's a Fix32 type in the Experimental folder if you want to play with it. The big performance advantage would be multiplication because you could write it as simply the multiplication of two 64-bit integers and not have to deal with all the splitting and checking for overflow BS that Fix64 has to do (because there are no hardware 128-bit integers). Also in x86 of course it would be faster because the type fits in registers. Apart from that though I wouldn't expect much difference. Most of the perf. loss vs floating-point math is the poor codegen (lack of inlining, enregistering of function parameters etc.) as far as I can tell.
Good ideas about readonly struct and Min/Max functions. Note that Fix64 is fairly immune to those defensive copy issues because almost all the operations are static methods, but it could help for .ToString()
and .RawValue
.
from fixedmath.net.
Oh, there's a Fix32 already, I'll take a look at it!
You can specify an attribute so the compiler knows you want inlining:
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AgressiveInlining)]
public static void SomeMethod()
{
...
}
from fixedmath.net.
Yeah, and I just noticed it's mistakenly called Fix16 but it's really a 32-bit Q15.16 type. Use at your own risk, it's really a draft I didn't spend much time on.
I played around with AgressiveInlining before but I know some people compile this for .NET 4 (Unity3D). Would be worth revisiting indeed.
from fixedmath.net.
I played around with AgressiveInlining before but I know some people compile this for .NET 4 (Unity3D).
There is already .NET 4.6 support in up-to-date Unity3D which support AggressiveInlining, so forgot worry about legacy for optimizations sake :)
And, anyway, thanks for your work on FixedMath, please keep going!
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
- 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
- Converting float to Fix64 consistent across CPU architectures? HOT 5
- 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.