Ruby Rounding to a Fraction (Precision)

Post any examples or modules that you want to share here
Post Reply
User avatar
DaveyBoy
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK

Ruby Rounding to a Fraction (Precision)

Post by DaveyBoy »

Came across this while searching for something else and though I'd share it with you guys.

When doing float calculations in ruby we often get 16 decimal places in the result. This little patch will round to a specific fraction:

Image

Precision.fsm
(384 Bytes) Downloaded 1595 times


Very useful for drawing with pixel accuracy and also for knobs and sliders when you want to increment/decrement by a specific amount.
Post Reply