shuffle( [1, 2, 3, 4, 5, 6, 7, 8, 9], 5 ) +DIGITS.join( "" ) randFromArray([ -2, -3 ]) placesLeftOfDecimal[ -PLACE ] roundTo( PLACE, NUM )

Redondea commafy( NUM ) a la TPLACE más cercana.

ROUNDED

Hay dos formas de resolver este problema.

Primera forma: Mira al digito DIGITS[ 5 + PLACE ] de las placesLeftOfDecimal[ -1 - PLACE ] para ver si se redondea hacia arriba o hacia abajo.

Como es mayor que igual a 5, redondeamos, dando ROUNDED.

Como es menor que 5, redondeamos hacia abajo, lo que nos da commafy( ROUNDED ).

Segunda forma: Considera el extremo de la recta numérica que está más cerca de NUM - el extremo correcto está indicado con un círculo azul.

init({range:[[-.06*pow(10,-PLACE),1.3*pow(10,-PLACE)],[-1,1]],scale:[450*pow(10,PLACE),40]}),numberLine(floorTo(PLACE,NUM),ceilTo(PLACE,NUM)+pow(10,-(PLACE+2)),round(pow(10,-(PLACE+1)))),style({stroke:"#FFA500",fill:"#FFA500",strokeWidth:3.5}),ellipse([10*pow(10,-(PLACE+1))*(NUM-floorTo(PLACE,NUM))/pow(10,-PLACE),0],[pow(10,-PLACE)/115,.1]),label([10*pow(10,-(PLACE+1))*(NUM-floorTo(PLACE,NUM))/pow(10,-PLACE)],NUM,"below"),style({stroke:"#6495ED",fill:"none",strokeWidth:3.5}),DIGITS[5+PLACE]>=5?ellipse([pow(10,-PLACE),-.55],[pow(10,-PLACE-.5)/6.5,.35]):ellipse([0,-.55],[pow(10,-PLACE-.5)/6.5,.35])
shuffle( [1, 2, 3, 4, 5, 6, 7, 8, 9], 6 ) +DIGITS.join( "" ) / 10000 randFromArray([ 0, 1, 2 ]) placesRightOfDecimal[ PLACE ] roundTo( PLACE, NUM )

Redondea commafy( NUM ) a la TPLACE más cercana.

ROUNDED

Hay dos formas de resolver este problema.

Primera forma: Mira al digito DIGITS[ 2 + PLACE ] de las placesRightOfDecimal[ 1 + PLACE ] para ver si se redondea hacia arriba o hacia abajo.

Como es mayor queigual a 5, redondeamos, dando ROUNDED.

Como es menor que 5, redondeamos hacia abajo, lo que nos da commafy( ROUNDED ).

Segunda forma: Considera el extremo de la recta numérica que está más cerca de NUM - el extremo correcto está indicado con un círculo azul.

init({range:[[-.06*pow(10,-PLACE),10.3*pow(10,-PLACE)],[-1,1]],scale:[450*pow(10,PLACE),40]}),numberLine(floorTo(PLACE,NUM),ceilTo(PLACE,NUM)+pow(10,-(PLACE+2)),pow(10,-(PLACE+1))),style({stroke:"#FFA500",fill:"#FFA500",strokeWidth:3.5}),ellipse([10*pow(10,-(PLACE+1))*(NUM-floorTo(PLACE,NUM))/pow(10,-PLACE),0],[pow(10,-PLACE)/115,.1]),label([10*pow(10,-(PLACE+1))*(NUM-floorTo(PLACE,NUM))/pow(10,-PLACE)],NUM,"below"),style({stroke:"#6495ED",fill:"none",strokeWidth:3.5}),DIGITS[2+PLACE]>=5?ellipse([pow(10,-PLACE),-.55],[pow(10,-PLACE-.5)/6.5,.35]):ellipse([0,-.55],[pow(10,-PLACE-.5)/6.5,.35])