• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Sign does not treat -0.00/0.00 as 0

emmyarty

Member
I can work around it, but an amendment to the online documentation would have saved me a good amount of time and may save someone the same in the future.

There is a variable 'hspd' which tracks the character's horizontal speed. Positive is right, negative is left. It increments by multiples of 0.1.

It appears that when 0.10 hits zero, it actually becomes -0.00 for the remainder of the step event. Negative hitting zero yields a positive 0.00. This is later 'cleaned up'.

You can probably see the problem. When evaluating sign(hspd) during the same event, it returns -1 rather than 0, because it does not treat -0.00 as a 0 despite being listed as a Real Number function.

This function should only be used in conjunction with known non-zero values. Throwing Reals and negative zeroes at it are guaranteed headaches. Is there any chance at making a slight amendment to the following online resource?

https://docs.yoyogames.com/index.html?page=source/dadiospice/002_reference/maths/real valued functions/sign.html
 

TsukaYuriko

☄️
Forum Staff
Moderator
It increments by multiples of 0.1.

It appears that when 0.10 hits zero, it actually becomes -0.00 for the remainder of the step event. Negative hitting zero yields a positive 0.00. This is later 'cleaned up'.
Float alert.


Whatever your number is, it's not 0. Output it via string_format with a lot of decimal places and you'll see what it actually is.


Round/truncate/etc. numbers before passing them to this function. It is working correctly, floating points just aren't working in your favor here.
 

emmyarty

Member
Float alert.


Whatever your number is, it's not 0. Output it via string_format with a lot of decimal places and you'll see what it actually is.


Round/truncate/etc. numbers before passing them to this function. It is working correctly, floating points just aren't working in your favor here.
Thanks, but very soon after posting this thread (while it was still awaiting moderator approval) I had realised this on my own and attempted to delete the thread.

Instead I got a notification telling my the nuke was reverted (even though I 'nuked' it before it went live). Not really sure why a mod accused me of trying to nuke a thread which had been resolved before anyone had even seen it, let alone replied, but the combined result of me and that person has wasted your time. Apologies for that!

Edit: Ah, you're the mod. I guess I nuked it as you were replying, and by the time you replied you saw the thread vanish. My bad. Once again, thanks for coming back to me anyway.
 
Last edited:
Top