randRange(2, 3) randFromArray([-1, -(NDIGITS - 1)]) (function() { var digits = shuffle([1, 2, 3, 4, 6, 7, 8, 9], NDIGITS); if (rand(3) === 0) { digits[NDIGITS + PLACE] = 5; } return digits; })() +DIGITS.join("") numberPlaceNames[-PLACE] plural_form(numberPlaceNames[-PLACE - 1], 2) Math.round(roundTo(PLACE, NUM)) DIGITS[NDIGITS + PLACE]

Round NUM to the nearest TPLACE.

var mag = pow(10, -PLACE); var lower = floorTo(PLACE, NUM); var upper = ceilTo(PLACE, NUM); init({ range: [[-0.1, 1.4], [-1, 1]], scale: [350, 40] }); style({arrows: ">"}); line([0, 0], [1.06, 0] ); style({arrows: "->"}); line([0, 0], [-0.06, 0]); style({arrows: ""}); for (var x = 0.1; x < 1; x += 0.1 ) { line([x, -0.2], [x, 0.2]); label([x, -0.53], lower + x * mag, "center", { color: GRAY }); } style({ stroke: BLUE, strokeWidth: 3.5 }); line([0, -0.2], [0, 0.2]); label([0, -0.53], lower, "center", { color: BLUE }); line([1, -0.2], [1, 0.2]); label([1, -0.53], upper, "center", { color: BLUE }); addMouseLayer(); graph.movablePoint = addMovablePoint({ coord: [(NUM - lower) / mag, 0], constraints: { constrainY: true }, snapX: 0.025 }); graph.movablePoint.onMove = function(x, y) { return [min(max(0, x), 1), y]; };
Move the orange dot to select your answer.
graph.movablePoint.coord[0]
var ans = ROUNDED < NUM ? 0 : 1; return abs(ans - guess) < 0.001;
graph.movablePoint.setCoord( [ guess, 0 ] );

Because we want to round to the plural_form(TPLACE, 2) place, we need to look at the digit in the TPLACES place.

The digit in the TPLACES place is KEYDIGIT.

Because KEYDIGIT is more than 5, we round up to commafy(ROUNDED).

Because the TPLACES place digit is KEYDIGIT, we round up to commafy(ROUNDED).

Because KEYDIGIT is less than 5, we round down to commafy(ROUNDED).