bugfix: improper truncation of exponential form

javascript would sometimes print numbers in exponential format instead
of fixed. This messed up the precision truncation code. Updated that
code to parse the number and properly convert it to a fixed format. The
truncation is done as a post-processing step to avoid littering the
code.