This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 863
/
converting_decimals_to_fractions_2.html
68 lines (61 loc) · 3.21 KB
/
converting_decimals_to_fractions_2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html data-require="math math-format">
<head>
<title>Changing decimals to fractions 2</title>
<script src="../khan-exercise.js"></script>
</head>
<!--
Convert decimals such as 0.3763 to a fraction (3763/10000), convert decimals such as 12.16 into mixed number (12 4/25), reduce to simplest terms
-->
<body>
<div class="exercise">
<div class="problems">
<div id="into-fraction">
<div class="vars">
<var id="NUMERATOR">randRange(0, 1) ? randRange(100, 999) : randRange(1000, 9999)</var>
<var id="D">(NUMERATOR / 10000).toFixed(4)</var>
<var id="GCD">getGCD(round(D * 10000) , 10000)</var>
</div>
<p class="question">Express <code><var>D</var></code> as a fraction. Reduce to lowest terms.</p>
<p class="solution" data-type="rational"><var>D</var></p>
<div class="hints">
<div>
<p><code><var>D</var></code> can be represented as follows.</p>
<p><code>= 0 + <var>fraction(D.substr(2, 1) , 10)</var> + <var>fraction(D.substr(3, 1) , 100)</var> + <var>fraction(D.substr(4, 1), 1000)</var> + <var>fraction(D.substr(5, 1), 10000)</var></code></p>
<p><code>= <var>fraction(NUMERATOR, 10000)</var></code></p>
</div>
<div>
<p>You can also skip a few steps by making a fraction with <code><var>NUMERATOR</var></code> as the numerator and <code>10000</code> (because the decimal extends to the ten thousandths place) as the denominator.</p>
<p><code><var>fraction(NUMERATOR, 10000)</var></code></p>
</div>
<div data-if="GCD > 1">
<p>Then, reduce the fractional part by dividing the numerator and denominator by <code><var>GCD</var></code>.</p>
<p><code>=<var>fractionReduce(round(D * 10000) , 10000)</var></code></p>
</div>
</div>
</div>
<div id="into-mixed">
<div class="vars">
<var id="W">randRange(1, 19)</var>
<var id="D">randRangeExclude(1, 99, [10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90])</var>
<var id="GCD">getGCD(D , 100)</var>
<var id="FIXED">(W + D / 100).toFixed(2)</var>
</div>
<p class="question">Express <code><var>FIXED</var></code> as a mixed number. Reduce to lowest terms.</p>
<p class="solution" data-type="mixed"><var>W + D / 100</var></p>
<div class="hints">
<div>
<p><code><var>FIXED</var></code> can be represented as follows:</p>
<p><code>= <var>W</var> + <var>fraction(floor(D / 10), 10)</var> + <var>fraction(D % 10, 100)</var></code></p>
</div>
<p><code>= <var>W + fraction(D, 100)</var></code></p>
<div data-if="GCD > 1">
<p>Reduce the fractional part by dividing the numerator and denominator by <code><var>GCD</var></code>.</p>
<p><code>=<var>W + fractionReduce(D , 100)</var></code></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>