One way is to use a Decimal Variable (called d below) and a Number Variable (called i below) . If you want 2 decimal points you'd do this, assuming the value is in the decimal variable (d)
Set i to d * 100
Set d to i / 100
Setting the integer variable lops off the decimal portion of the decimal number, which has been multiplied by 100, leaving the two decimals. Then, dividing by 100 returns it to decimal format.
Thanks Bruce!
This is the "brute force" method I alluded to. I was wondering is there is a more succinct method, but I will try this. The down-side is that the result will be truncated to 'n' decimal places, whereas if the *X number is a decimal and is round()ed before dividing by ten, it should be rounded up as appropriate.
Additionally, if stringizing methods are available, is it possible to create the line as a string and use format specs to insert multiple numbers in the line?
Could one use var.toFixed(2) for multiple decimal numbers into a string, or something of that nature?
Definitely. I've done programs with arithmetic in integer-only, producing up to 4 decimal places in the result, but maintained integer all the way through, including storage.
In the end, I have 3 numbers to enter into a file. One of the numbers is money, so I wanted to control format to prevent things like '$2.20' from being printed as '2.2', which is what happens, although not often. None of these techniques can fix that, I'm afraid. I also have a number that is 'days', and often comes to something like '30.12345678' and such.
In the end, I think I'll just be content with whatever the default formatting produces, since it's just academic to pretty the output, and the final numbers don't especially matter. They're just for historic review.