# Khan/khan-exercises

`Using floor breaks when D = 29, 57 or 58. See #41894`
1 parent e396c47 commit 46b4324c9efc8a4027860b4de79eaae08b7bce49 petercollingridge committed Mar 15, 2013
Showing with 1 addition and 1 deletion.
1. +1 −1 exercises/converting_fractions_to_decimals.html
 @@ -12,7 +12,7 @@
randRange( 1, 30 ) randRange( NUMERATOR + 1, 30 ) - Math.floor( NUMERATOR / DENOMINATOR * 10000 ) / 10000 + Math.round( NUMERATOR / DENOMINATOR * 10000 ) / 10000 roundTo( 3, NUMERATOR / DENOMINATOR )

Express the fraction as a decimal, rounded to the thousandth.

#### 3 comments on commit `46b4324`

Member
commented on `46b4324` Mar 15, 2013
 Sorry, I committed that by mistake. It should be fine, but I actually meant it for converting_decimals_to_fractions. Test plan: Check that Math.round( NUMERATOR / DENOMINATOR * 10000 ) / 10000 gives the right value for a range of values. Or write a loop to test them all. Auditors: beneater, alpert
Member
commented on `46b4324` Mar 15, 2013
 Unfortunately Auditors doesn't work unless you put it in the commit message. :) This looks fine to me.
Member
commented on `46b4324` Mar 15, 2013
 I actually edited directly on Github - it didn't realise that was possible before and didn't realise it would actually commit it. I didn't mean to edit this exercise, but I suspect it could prevent a similar problem with floating point precision errors. NUMERATOR / DENOMINATOR * 10000 should be an integer, so I think round makes sense.