Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Bug Rounding Floats? (9.245 * 100).round => 924? S/B 925!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="ddoherty03, post: 4644647"] Glenn, Thanks for the explanation. If I could pick your brain for a second on how to generalize your workaround, I would greatly appreciate it. Here is how I tried to implement the "nround" method. ###################################### class Float def nround(n = 0) (self * 10.0 ** n).round / 10.0 ** n end end ###################################### My issue is getting the workaround to deal with the parameter n properly. Regards, [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Bug Rounding Floats? (9.245 * 100).round => 924? S/B 925!
Top