r/GraphicsProgramming • u/TheRPGGamerMan • Apr 06 '23
Any C# Libraries/Support For 'Fixed' (Float that's actually an Int) Variables?
As the title says. I've noticed that integers running round 4 times faster than floats, meaning fixed value types should run just as fast. Are there any libraries or out of the box classes that support this type? I understand I can just use large scale Integers, but it would be nice if there was an efficient library out there for this.
1
Apr 06 '23
Are you writing a software renderer?
Something like this might work. https://github.com/XMunkki/FixPointCS
1
u/Spec-Chum Apr 06 '23 edited Apr 06 '23
Quite easy to do one yourself to be fair. Here's my simple one https://github.com/spec-chum/Fixed32
Should get you started.
1
1
Apr 13 '23
In what circumstances do ints outperform floats? I was under the impression that floats are faster for most graphics related uses. Or is that just on GPUs?
6
u/waramped Apr 06 '23 edited Apr 06 '23
Not to be THAT GUY, but have you even tried Google? I did, and found at least 3 immediately.
Edit: guilt has consumed me, try this: https://github.com/XMunkki/FixPointCS
Or
https://www.reddit.com/r/gamedev/comments/b4otuk/fixed_point_number_library_for_c/?utm_source=share&utm_medium=android_app&utm_name=androidcss&utm_term=1&utm_content=share_button