docs: Modify specification of trunc_u and trunc_s.#924
Conversation
|
Hmm I may have been a bit hasty -- it looks like rust (at least by default, since 1.45) performs "float-type |
|
There's a good summary on that PR of what other languages do, which is quite variable, but I tend to agree with the author's comment that "overall rounding to zero and saturation is the common case", so am inclined to modify the spec accordingly. (This would mean these functions could not produce an error.) |
|
Was misreading the code. There is a check for finiteness. The only edge case remaining is casting a negative float to an unsigned; this will result in 0, which I think is adequately described by "rounding towards zero". |
Turns out the implementation in the constant-folding code is already in line with this modified specification, so this is not a breaking change.
Closes #771 .