Re: Format Numbers
Posted: Mon Mar 29, 2010 9:31 pm
StrF() is less accurate than StrD(). Look at what my code above does with:WilliamL wrote:That's a good question. I'm using StrF(#,number of digits after decimal point) and it seems to round up (the rules are made by StrF() ). There needs to be more thought in how the rounding is done. I was most interested in getting, for example the floating 12.34 to be converted into a string as '12.34' and not '12.3399999', and not the problem of 3.66666 being rounded up or 3.3333 not being rounded up.
Actually, this was just an exercise and this was a way to clarify my thinking of how the process could be done. I think it would be nice if a single format function could be developed for everyone (multi-platform) to use in place of having a format function built-in in pb. I am certainly not offering this as that example but as encouragement for further development which might not be this code at all.
Code: Select all
Debug FormatF(12.34, "##.########")
Debug FormatD(12.34, "##.########")