Legacy GM Irrational numbers

B

Blaster

Guest
So I'm having trouble with coming up with an equation. I'm essentially trying to do 16 / 90 but it leads to 0.17777777777. Is there any way to work with this? I tried inserting testing the formula, but from what I see, it rounds to 0.18 making the objects move farther than they should messing up the alignment.
 

DanMunchie

Member
What is the number being used for?
If you are calculating it with 16/90 then indeed it will be 1.777... - Where are you seeing 1.8?
 
B

Blaster

Guest
What is the number being used for?
If you are calculating it with 16/90 then indeed it will be 1.777... - Where are you seeing 1.8?
I'm using it to pseudo-rotate the screen. With 90 degrees being the initial rotation. In order to make a block look good at 180 degrees, there is a change in value for a variable, 0 - 16. So I wanted to see if I could divide 16 by 90 and get a value I could multiply by the current rotation so the formula would work.
I tried running the program, but at 90 degrees, the images do not line up. I decided to draw text to the screen to see if I messed up anything. The variable that goes from 0-16 worked fine along with rotation showing the right numbers. However the 1.777... was reduced to 1.8. Afterwards, I subbed in 1.8 to see if that was really the number they used, and it was the same result. It's a small difference, but it overshoots everything I have on my grid
 

DanMunchie

Member
The 1.8 from text is not too surprising, depending how you have set it up, draw_text can round values to a certain number of decimal places.

Why not just use variable = 16/90 as the stored value?
 

FrostyCat

Member
draw_text() and string() rounds to 2 digits, if you use string_format() or look at the value from debug there are more digits than that.

Having a limited number of digits is a natural consequence of finite storage on a computer, live with it. This is not a symbolic algebra environment, most non-integer quotients have no exact representations here. You have to change your programming such that small errors like this don't matter, such as using a view to rotate the screen or drawing everything slightly bigger so that the gaps fill in themselves.

Also, I don't think you have a clue what "irrational" means if you think 16/90 is it. Irrational means "cannot be written as a fraction", but you just wrote it out as a fraction.
 
  • Like
Reactions: Pup
P

Pup

Guest
draw_text() and string() rounds to 2 digits, if you use string_format() or look at the value from debug there are more digits than that.

Having a limited number of digits is a natural consequence of finite storage on a computer, live with it. This is not a symbolic algebra environment, most non-integer quotients have no exact representations here. You have to change your programming such that small errors like this don't matter, such as using a view to rotate the screen or drawing everything slightly bigger so that the gaps fill in themselves.

Also, I don't think you have a clue what "irrational" means if you think 16/90 is it. Irrational means "cannot be written as a fraction", but you just wrote it out as a fraction.
FrostyCat? More like SaltyCat. Thank you for the knowledge though :3
 
B

Blaster

Guest
The 1.8 from text is not too surprising, depending how you have set it up, draw_text can round values to a certain number of decimal places.

Why not just use variable = 16/90 as the stored value?

I'll try using the variable that way when I get time to work on it later today, thanks for the help

draw_text() and string() rounds to 2 digits, if you use string_format() or look at the value from debug there are more digits than that.

Having a limited number of digits is a natural consequence of finite storage on a computer, live with it. This is not a symbolic algebra environment, most non-integer quotients have no exact representations here. You have to change your programming such that small errors like this don't matter, such as using a view to rotate the screen or drawing everything slightly bigger so that the gaps fill in themselves.

Also, I don't think you have a clue what "irrational" means if you think 16/90 is it. Irrational means "cannot be written as a fraction", but you just wrote it out as a fraction.
Well I'll try not to do that. Thanks for the info
 

TheouAegis

Member
16/90 will still have rounding errors. You cannot divide 256 or any power thereof evenly by 90. Bits will be dropped and you will get rounding errors along the way.
 
Top