libcg / bfp

Beyond Floating Point - Posit C/C++ implementation
MIT License
289 stars 25 forks source link

The posit implementation seems to return a NaN #18

Closed certik closed 6 years ago

certik commented 6 years ago

I am confused by this introduction in the README:

there is no "Not-a-Number" (NaN) value

and this line:

https://github.com/libcg/bfp/blob/c813ea56671ca735263dca2e0adb26c1d4f57041/lib/posit.cpp#L135

which returns a posit number that is a NaN. Isn't this a contradiction?

I think this should be clarified in the README.

libcg commented 6 years ago

bfp doesn't implement any NaN value, however some operations are invalid, such as 0/0. In that case, we must generate an exception. Right now bfp handles that by raising a NaN flag. But it's not able to represent it as a posit value.

certik commented 6 years ago

@libcg ah I see. Thanks for the explanation.