# Khan/khan-exercises

Make circle round; 10->ten; whitespace

1 parent 982224f commit bf6a2d8496ab763c22b97e738f67afa4a7dbc9f6 beneater committed
Showing with 28 additions and 28 deletions.
1. +28 −28 exercises/understanding_moving_the_decimal.html
56 exercises/understanding_moving_the_decimal.html
 @@ -11,58 +11,58 @@ randRangeNonZero( -1, 1 ) ( PM === 1 ? "multiply" : "divide" ) randRange( 0, 99999 ) - +
randRange( 1, 5 ) randRange( 1, 5 )
- + A / pow( 10, A_DECIMAL ) A / pow( 10, B_DECIMAL ) ( PM === 1 ? ( A_DECIMAL - B_DECIMAL ) : ( B_DECIMAL - A_DECIMAL ) ) - +
-

How many times do you need to OPERATOR A_FLOAT.toFixed( A_DECIMAL ) by 10 to get B_FLOAT.toFixed( B_DECIMAL )?

+

How many times do you need to OPERATOR A_FLOAT.toFixed( A_DECIMAL ) by ten to get B_FLOAT.toFixed( B_DECIMAL )?

- +

POW_DIFF

- +
- +
init({ range: [ [ -1, 11 ], [ -1, 3 ] ], scale: [30, 45] }); - + var digitsA = KhanUtil.digits( A ); - + //Pad zeroes if need be for the decimal point while ( digitsA.length < A_DECIMAL + 1) { digitsA.push( 0 ); } - + var digitsB = digitsA.slice(); - + //For the leading zero 0.# only occurs with division if ( digitsA.length < B_DECIMAL + 1) { digitsA.push( ' ' ); digitsB.push( 0 ); } - + drawDigits( digitsA.reverse(), 0, 1); drawDigits( digitsB.reverse(), 0, 0); - + for ( var i = 0; i < POW_DIFF; i++) { if ( PM === 1 ) { arc( [ digitsA.length - A_DECIMAL + i, 1.5 ], 0.5, 0, 180, { stroke: "blue" } ); label( [ digitsA.length - A_DECIMAL + i, 2 ], i+1, "above" ); - + if ( i === POW_DIFF - 1 ) { //hack for the final arrow...is there a better way? line( [ digitsA.length - A_DECIMAL + i + 0.5, 1.5 ], [ digitsA.length - A_DECIMAL + i + 0.5, 1.46 ], { stroke: "blue", arrows: "->" } ); @@ -73,7 +73,7 @@ if ( i === POW_DIFF - 1 ) { style({ arrows: "->" }); } - + arc( [ digitsA.length - A_DECIMAL - (i + 1), 1.5 ], 0.5, 0, 180, { stroke: "blue" } ); label( [ digitsA.length - A_DECIMAL - (i + 1), 2 ], i+1, "above" ); } @@ -81,29 +81,29 @@ //draw a black ellipse to be used as a decimal point style({ fill: "#000" }); - ellipse( [ digitsA.length - A_DECIMAL - 0.5, 0.8 ], [ 0.09, 0.09 ] ); - ellipse( [ digitsB.length - B_DECIMAL - 0.5, -0.2 ], [ 0.09, 0.09 ] ); - + ellipse( [ digitsA.length - A_DECIMAL - 0.5, 0.8 ], [ 0.09, 0.06 ] ); + ellipse( [ digitsB.length - B_DECIMAL - 0.5, -0.2 ], [ 0.09, 0.06 ] ); + var labelstr = "\\text{The decimal point needs to be moved " + POW_DIFF + " time" + ( POW_DIFF !== 1 ? "s.}" : ".}"); label ([ digitsA.length + 0.5, 0.5 ], labelstr, "right", 1);
- -

Moving the decimal one position to the PM === 1 ? "right" : "left" is the same as PM === 1 ? "multiplying" : "dividing" by 10 once.

- + +

Moving the decimal one position to the PM === 1 ? "right" : "left" is the same as PM === 1 ? "multiplying" : "dividing" by ten once.

+
-

Thus, moving the decimal right POW_DIFF times is the same as multiplying by 10 POW_DIFF times, or multiplying by pow( 10, POW_DIFF ):

+

Thus, moving the decimal right POW_DIFF times is the same as multiplying by ten POW_DIFF times, or multiplying by pow( 10, POW_DIFF ):

{A_FLOAT.toFixed( A_DECIMAL )} * {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

-

Thus, moving the decimal left POW_DIFF times is the same as dividing by 10 POW_DIFF times, or dividing by pow( 10, POW_DIFF ):

+

Thus, moving the decimal left POW_DIFF times is the same as dividing by ten POW_DIFF times, or dividing by pow( 10, POW_DIFF ):

{A_FLOAT.toFixed( A_DECIMAL )} \div {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

- +
-

You need to OPERATOR by 10 POW_DIFF times.

-
- +

You need to OPERATOR by ten POW_DIFF times.

+
+ - +