mojira.dev
MC-312522

`/compute ... float` with a scale reports exact results as rounded and shows the unscaled value

This also happens in 26.3.

Steps to Reproduce:

  1. Run: /compute default float {type:"constant",value:2} 0.5

  2. Run: /compute default float {type:"constant",value:2.5} 2

Observed Results:
Number provider returned value 2.0 (rounded to 1)
Number provider returned value 2.5 (rounded to 5)

Expected Results:
2 x 0.5 = 1 and 2.5 x 2 = 5 are exact, so the exact message should be shown, for example "Number provider returned
value 1".

Code analysis:
ComputeCommand#computeAsFloat calculates result = Mth.floor(original * scale) but then checks if (result == original),
comparing against the unscaled value. It also passes original instead of original * scale to the rounded message.

Comments 0

No comments.

SamuelTheCheesee

(Unassigned)

Confirmed

Platform HC

Normal

Commands

26.3, 26.4 Snapshot 3

Retrieved