Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

half.h #55

Closed
ghost opened this issue Aug 9, 2019 · 4 comments
Closed

half.h #55

ghost opened this issue Aug 9, 2019 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 9, 2019

Hi! Your half-float conversion is broken, because it maps larger numbers (>65536.0) to infinity. So you can't really do any HDR with them.

@CNugteren
Copy link
Owner

I'm no expert on that matter. I took the fp16 conversion functions from http://half.sourceforge.net, which is supposed to implement the IEEE standard. If you think it is incorrect, please point to the part that is incorrect specifically and the documentation of the standard. Perhaps you can check with http://half.sourceforge.net as well?

@ghost
Copy link
Author

ghost commented Aug 10, 2019

Sorry. I've checked it, and fp16 isn't IEEE standard, so it behaves differently from usual float and double. It is optimized solely for [-1.0; 1.0] range, so expects values to be normalized. Although theoretically, a hacked version of it can represent values up to 131072, which can be useful when fp16 is used as index into a lookup table, like i.e. for pow(x,1/2.2), which I'm using it for.

@ghost ghost closed this as completed Aug 10, 2019
@CNugteren
Copy link
Owner

Yes it behaves differently, but it is an IEEE standard I guess (https://en.wikipedia.org/wiki/Half-precision_floating-point_format). Anyway, doesn't matter, this is what it is :-)

@ghost
Copy link
Author

ghost commented Aug 11, 2019

Yeah. They actually standardized it. I remember it being just some NVidia internal thingie. There is also bfloat16 format, which indeed acts as a normal float.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant