Hi Stephane,
i uploaded a SLICE-Issue-15471-Cant-round-Float-fmax-to-2-decimal-places-WernerKassens.2 to the inbox with these changes: i corrected RandomTest>>testIfCompletelyBroken, completed tests with some border cases and the usual specifications, and added your comment to Float>>round:.
the testIfCompletelyBroken needed to be changed:
"original in test:
#(0.149243269650845 0.331633021743797 0.75619644800024 0.393701540023881 0.941783181364547 0.549929193942775 0.659962596213428 0.991354559078512 0.696074432551896 0.922987899707159 )"
gen := Random seed: 2345678901.
raw:=    (1 to: 10) collect: [:i | gen next] .
"#(0.14924326965084453 0.3316330217437972 0.7561964480002394 0.3937015400238808 0.9417831813645471 0.5499291939427746 0.6599625962134277 0.991354559078512 0.6960744325518955 0.922987899707159)"
gen seed: 2345678901.
test:=(1 to: 10) collect: [:i | gen next round: 15].
"#(0.149243269650845 0.331633021743797 0.756196448000239 0.393701540023881 0.941783181364547 0.549929193942775 0.659962596213428 0.991354559078512 0.696074432551895 0.922987899707159)"
"rounding here is correct, 5 and higher is rounded up, 4 and lower down"
"differences to the original are the result of originally wrong rounding; compare with the raw result."
werner

Reply via email to