Open cardillan opened 1 week ago
this seems like a bug. should submit to bug report. I am curious to know how you found this out though
this seems like a bug. should submit to bug report.
I think I'll do the PR and see whether it gets accepted.
I am curious to know how you found this out though
I'm developing Mindcode,a high-level language for Mindustry Logic. It contains a Mindustry processor emulator, so I sometimes get into quite a lot of detail... :)
Describe what you would like changed, and why.
When using the
print
andformat
instructions, values slightly above an integer value are rounded to the integer value, but values slightly below aren't:produces
on output.
I guess it is an accident - I can't figure out a reason why values should only be rounded down.
Describe the changes you want to propose. Include possible alternatives.
I propose to change
(long)value.numval
inPrintI.run
andFormatI.run
methods to(long)(value.numval+0.5)
, so that the value to be printed is rounded to the nearest integer for comparison/printing. (Edited to add: the same change should be also done on the Vars screen for consistency.)(I can do a PR if it is easier for you.)