GTA3 floating point math increments at 0.0625 at a time #224
KyonkoYuuki
started this conversation in
General
Replies: 5 comments
|
I tried to decompile the .cs file and sure enough, its different |
0 replies
|
This is how floats work in GTA III. |
0 replies
|
Interesting, I'll have to figure out other ways around that then. Thanks! |
0 replies
|
This limitation only affects floating-point literals. You can't use 0@ = 0.3 because the compiler truncates the value to 0.25. But you can bypass it by writing an IIIE-754 representation of the float into a variable (they are 32-bit and contain values as is). let me know if that works. |
0 replies
|
Yes, that works. Interesting too because it can do floating point math fine. I just had to adapt it to look like this and it works fine |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This is a really weird issue. I was debugging why some code wasn't working and made this simple counter CLEO script
One would expect it to go up like
[0.1, 0.2, 0.3, 0.4, 0.5]But instead, it goes up like
[0.0625, 0.1250, 0.1875, 0.25, 0.3125]Adding different values like between 0.0-0.6 causes 0@ to not change,
while adding something like 0.2 causes it to go more like
[0.1875, 0.3125, 0.5625], as if it was rounding to the nearest floating point divisible by 0.625. I'm not sure if this is a Sanny Builder thing or GTA3 thing, but it does work as expected for VC and SA.Setting values like
0@ = 0.3does the same thing as well, where this rounds down to 0.25All reactions