rationalize


rationalize(r1, r2)
      

Return the simplest rational number that differs from r1 by no more than r2.

Examples:


rationalize(3/10, 1/10)
// 1/3
rationalize(.3, 1/10)
// .3333333333333333
      

Also see:

floor
abs


Core Module Index | Contents