ara.t.howard / noaa.gov wrote: > On Thu, 23 Nov 2006, John Kopanas wrote: > >> I have a number that is of type float. I want to format it as dollars >> and cents. How do you recommend I do it? :-) > > never, never, never use floats to represent money. > > http://en.wikipedia.org/wiki/Fixed-point_arithmetic > > > -a *Especially* when the language has "BigDecimal" built in. :) However ... be aware that if you need to deal with compound interest calculations, they are difficult to do in most decimal arithmetic implementations, so at that point, you often need to bite the floating point (and exponential/logarithm) bullet. That's why HP still makes the 12C and still sells it by the carload today -- it does everything exactly the way people expect it to be done. Also, see the other thread about just how badly Excel and VBA do this sort of thing. -- M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P) http://borasky-research.blogspot.com/ If God had meant for carrots to be eaten cooked, He would have given rabbits fire.