Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use fractions internally in circles_and_arcs and areas_of_circles_and…

…_sectors to avoid precision error
  • Loading branch information...
commit a386b6c2cb6e8cce8bac3d9ebf9c365412cfce2f 1 parent dc17a4f
@osnr osnr authored
View
8 exercises/areas_of_circles_and_sectors.html
@@ -11,16 +11,16 @@
<var id="R">randRange(5, 10)</var>
<var id="C">2 * Math.PI * R</var>
- <var id="PRETTY_C">piFraction(C)</var>
+ <var id="PRETTY_C">2 * R + "\\pi"</var>
<var id="S">ANGLE/360 * C</var>
- <var id="PRETTY_S">piFraction(S, true, 0.0001)</var>
+ <var id="PRETTY_S">fractionReduce(ANGLE * C, 360) + "\\pi"</var>
<var id="A_C">PI * R * R</var>
<var id="A_S">ANGLE/360 * A_C</var>
- <var id="PRETTY_A_C">piFraction(A_C)</var>
- <var id="PRETTY_A_S">piFraction(A_S, true, 0.0001)</var>
+ <var id="PRETTY_A_C">R * R + "\\pi"</var>
+ <var id="PRETTY_A_S">fractionReduce(ANGLE * R * R, 360) + "\\pi"</var>
<var id="ROTATE_ARC">randRange(0, 359)</var>
</div>
View
4 exercises/circles_and_arcs.html
@@ -11,13 +11,13 @@
<var id="R">randRange(5, 10)</var>
<var id="C">2 * Math.PI * R</var>
- <var id="PRETTY_C">piFraction(C)</var>
+ <var id="PRETTY_C">2 * R + "\\pi"</var>
<var id="ROTATE_ARC">randRange(0, 359)</var>
<var id="A">ANGLE/360 * C</var>
- <var id="PRETTY_A">piFraction(A)</var>
+ <var id="PRETTY_A">fractionReduce(ANGLE * 2 * R, 360) + "\\pi"</var>
</div>
<div class="problems">

0 comments on commit a386b6c

Please sign in to comment.
Something went wrong with that request. Please try again.