4 ms·
> If anyone knows how to control floating point rounding in C reliably, I'd be interesting in hearing it I skimmed over that code and it seems that hack is req
by avar 6y ago
> If anyone knows how to control floating point rounding in C reliably, I'd be interesting in hearing it
I skimmed over that code and it seems that hack is required because a) you're not happy with what the compiler does with a double b) insisting on using a "double" type.
It's easy to get your own semantics for numbers in C, it's not easy to do so while insisting on using C's own types whose behavior are contrary to what you want.
If you want your own floating point semantics why not make a struct with a significand & base and pass that around? Something like that is how established numbers-in-C-without-native-C-semantics libraries do it, e.g. GMP.