Replacement for snprintf

berni44 dlang at d-ecke.de
Wed Oct 30 19:28:44 UTC 2019


On Wednesday, 30 October 2019 at 18:16:56 UTC, Rumbu wrote:
> That means that snprintf must use the current rounding mode 
> that can be read using FloatingPointControl.rounding from 
> std.math.

Is it really a "must"? We are not completely bound by the IEEE 
standard and, if good reasons are available, might reject it. For 
example, comparing two floats with <= produces either "false" or 
"true" in D. According to IEEE there should be a third result 
possible, namly "not comparable". Having said this, it would be 
possible to implement it the way you claim, but probably at some 
cost (=slower, more and less easy readable lines of code). I'll 
think about it.


More information about the Digitalmars-d mailing list