←back to thread

79 points seg_fault | 1 comments | | HN request time: 0.259s | source

Since there is so much interest on HN in floats lately and their software implementations, I wanted to show mine. It has no use and is just for teaching me floats and C++. Give me your thoughts.
1. account42 ◴[] No.41912579[source]
> std::numeric_limits<fas::Float<std::int16_t, std::int8_t>>::MAX()

Surely you mean ::max()?

> is_fundamental<int16_t, int16_t>::value et al.

Besides the undefined behavior issue mentioned by others, none of these are syntactially correct.

> #include "fas/stream.hpp>

Ok then...

> The Stl's std::numeric_limits is required the limits of the specified types for mantissa and exponent.

Missing a word? Also, the STL [0] does not have std::numeric_limits, perhaps you mean the C++ standard library (or stdlib for short).

[0] https://en.wikipedia.org/wiki/Standard_Template_Library