I have a situation where I have rounding rules to apply the the results of 2 fields based on the results value. >10 rounded to the nearest integer. No problem there. The other 2 are: <=10 >5 is rounded to the nearest .5 and >5 rounded to the nearest .1 I understand Switch and case, just trying to work out the math for the rounding Thanks for the assist David
Round to .1 decimal: var rounded =Math.round(number *10)/10; Round to integer: var rounded = Math.round(number); Round to .5 decimal - will require an if else statement if > .5 or >= .5
Thank you much. Been messing around with the math. Working well. I am trying to get my head around switch. Seems straight forward, but no output to the field 'gd_TTTmm_rnd.value' The values output by themselves until I added the switch var tttmm = ((.2*(((.025*pd)+(.3*mod))+19))*sqrrtexp) switch (tttmm) { case (tttmm > 10): gd_TTTmm_rnd.value = Math.round(tttmm); break; case (tttmm < 10 && tttmm > 5): gd_TTTmm_rnd.value = Math.round((tttmm*10)/10); break; }