r/GraphicsProgramming • • 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 Upvotes

7 comments sorted by

6

u/waramped Apr 06 '23 edited Apr 06 '23

4

u/Kevathiel Apr 06 '23

Why google when some dudes on reddit will google for you and probably do some minimal vetting?

1

u/[deleted] 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

u/Spec-Chum Apr 06 '23

Or not, 404 from reddit, but link works elsewhere. Odd.

1

u/Spec-Chum Apr 06 '23

Oops, probably helps if I make it public lol

1

u/[deleted] 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?