On Monday, 14 October 2024 at 20:38:38 UTC, user1234 wrote:
On Monday, 14 October 2024 at 15:59:07 UTC, vinoB wrote:
Hi All,
Request your help in understanding why the below code is
producing different outputs, code 1 output: 4294966806, code
2/3 output: 50331648, and which one is the correct output.
[...]
`cast(unint)` of a `float` does truncation. So none of your
version is correct.
See https://dlang.org/spec/expression.html#cast_floating,
paragraph 2.
Well "Code 1" does the right thing expected for the cast on the
return which wastes it.