Ruby Math Precision

Shabbur

Veteran
Veteran
Joined
Feb 4, 2015
Messages
44
Reaction score
0
Primarily Uses
Is there a way to have Ruby be precise with division?

It seems putting whole numbers in an expanded form (8.00000) increases the significant number places by 5, but is there something that estimates infinite precision?

Edit: Nvm just a .0 makes it precise.
 
Last edited by a moderator:

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses
I'm not sure what you mean but just use integers. There are also rational numbers. If you need precise decimal numbers, then you're out of luck. Ruby has them but RGSS doesn't.


Oh, you should read: http://floating-point-gui.de/
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
How precise do you need them? Can you just round them off or limit your inputs to "good" numbers?
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Believed Shabbur wanted to return a floating point with no rounding so instead of getting 0 when dividing a number by a larger number you get a floating point number. (i.e 3 / 9 returns 0 but 3.0 / 9 returns 0.3333333333333333 which is the same as 3.fdiv(9)). Also to round it you can do something like this (2.0 / 9).round(6) returns 0.666667.

If you need precise decimal numbers, then you're out of luck. Ruby has them but RGSS doesn't.
Wait what?? I'm confused by this as I have been able to return the same results in my IDE as in RGSS.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top