[Info-vax] New VSI Roadmap (yipee!)

JF Mezei jfmezei.spamnot at vaxination.ca
Mon Mar 2 18:27:10 EST 2015


On 15-03-02 17:44, Scott Dorsey wrote:

> When that is the case, you use integers for cents, then you use input and
> output routines that deal with the decimal point.


I have not thought about this fully but...

if you have

internet total_cents
float output_number

you do all the math with total_cents.

But when it comes to display, you do :
	 output_number = total_cents /100.0


And then you print the output_number with a format that allows only 2
decimals.

Would this work in every circumstance and be totally safe, or would
there be cases where the displayed number would be off ?


BTW, for SWIFT financial transfers, if I recall correctly, it had
support for at least 4 or more decimals for currency amounts.  This was
to allow the specification of say 100,000 widgets priced at USD $1.1234
each based on current exchange rates.



More information about the Info-vax mailing list