flex - Weird behaviour on Numeric Stepper decimals -


i making editor field numbers. tried text field, since it's number datatype coming in, didn't go smoothly -- despite recasting strings numbers etc.. kept giving me nan value. decided best go numeric stepper.

when loaded drop decimals , display numbers integers. changed stepincrement 0.1 , show decimals (a weird requirement imo).. when step gives me value '17.700000000000003' when expect 17.7. of numbers in data have single decimal place. know can write dataformatter, seems shouldn't necessary in situation.

is there way deal this?

you've stumbled upon compromise of trying represent decimal numbers in floating point binary formats ieee 754. not decimal numbers can represented. can read on issue in great detail here:

http://en.wikipedia.org/wiki/floating_point#representable_numbers.2c_conversion_and_rounding

you can use number.tofixed(fractiondigits:uint) display arbitrary number of decimal places.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -