gibbsly / gm

A utility datapack for doing math operations
The Unlicense
33 stars 2 forks source link

Fix issue with subtraction #10

Closed GlitchlessCode closed 8 months ago

GlitchlessCode commented 8 months ago

The Problem

When exponent representation of a double or float was used, gm:subtract fails

Solution description

Converting var2 from a string back to a double fixes this issue

gibbsly commented 8 months ago

does negate have the same issue? I checked it for the other thing I fixed and it was fine but this may also be an issue there

GlitchlessCode commented 8 months ago

Unsure, but I can definitely check

GlitchlessCode commented 8 months ago

It does not appear to do so, for some reason

GlitchlessCode commented 8 months ago

Oh, I figured out why.

Subtract needed to use $(v2p)$(var2) in a tp, where as negate just uses it in a data modification.

It's the difference between data modify storage gm:io out set value -1.234E-5 and tp 91bb5-0-0-0-ffff 29999999 ~-1.234E-5 91665

GlitchlessCode commented 8 months ago

First one is valid syntax, second is not

gibbsly commented 8 months ago

yea that was also the deal with the other case