Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

57 lines (55 sloc) 2.014 kB
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers-arithmetic">
<head>
<meta charset="UTF-8" />
<title>Subtracting decimals</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars" data-ensure="NEW_A > NEW_B">
<var id="A">randRange( 101, 999 )</var>
<var id="B">randRange( 101, 999 )</var>
<var id="A_DECIMAL">randRange( 1, 3 )</var>
<var id="B_DECIMAL">randRange( 1, 3 )</var>
<var id="NEW_A">A * ( B_DECIMAL &gt; A_DECIMAL ? pow( 10, B_DECIMAL - A_DECIMAL ) : 1)</var>
<var id="NEW_B">B * ( A_DECIMAL &gt; B_DECIMAL ? pow( 10, A_DECIMAL - B_DECIMAL ) : 1)</var>
<var id="A_DIGITS">
(function() {
var result = digits( NEW_A );
for ( var i = 0; i &lt; ( A_DECIMAL - B_DECIMAL ) || result.length &lt; A_DECIMAL + 1; i++ ) {
result.push( 0 );
}
return result;
})()</var>
<var id="B_DIGITS">
(function() {
var result = digits( NEW_B );
for ( var i = 0; i &lt; ( B_DECIMAL - A_DECIMAL ) || result.length &lt; B_DECIMAL + 1; i++ ) {
result.push( 0 );
}
return result;
})()</var>
</div>
<div class="problems">
<div>
<p><code>\Huge{<var>roundTo( A_DECIMAL, A * pow( 10, -A_DECIMAL ) ).toFixed( A_DECIMAL )</var> - <var>roundTo( B_DECIMAL, B * pow( 10, -B_DECIMAL ) ).toFixed( B_DECIMAL )</var> = {?}}</code></p>
<div class="solution" data-type="decimal"><var>A * pow( 10, -A_DECIMAL ) - B * pow( 10, - B_DECIMAL )</var></div>
<div class="graphie" id="numbers">
graph.subtractor = new Subtractor( NEW_A, NEW_B, A_DIGITS, B_DIGITS );
DUMMY = Array( graph.subtractor.getNumHints() );
</div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.subtractor.show();
graph.subtractor.showDecimals( A_DECIMAL, B_DECIMAL );
</div>
<div class="graphie" data-update="numbers" data-each="DUMMY as dummy">
graph.subtractor.showHint();
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.