Format$ doesn't seem to format fractional negative values right. In my case I'm
tying to format a number like "-.23" so that it comes out "-0.23000". So I use
Format$(-.23, "0.00000")
But the output is actually "-.23000", contrary to what the docs say about adding
leading zero to the format string.
However, this does work for positive numbers:
Format$(.23, "0.00000")
will output "0.23000"
I can work around this by using "*0.00000" for the formatting string, but I'd
like to know what's going on. Here's a short sample program:
------------------
Mark Newman
[This message has been edited by Mark Newman (edited August 22, 2000).]
tying to format a number like "-.23" so that it comes out "-0.23000". So I use
Format$(-.23, "0.00000")
But the output is actually "-.23000", contrary to what the docs say about adding
leading zero to the format string.
However, this does work for positive numbers:
Format$(.23, "0.00000")
will output "0.23000"
I can work around this by using "*0.00000" for the formatting string, but I'd
like to know what's going on. Here's a short sample program:
Code:
$COMPILE EXE $REGISTER NONE FUNCTION PBMAIN() AS LONG DIM sTmp AS STRING ' This should display "-0.23000", but it doesn't sTmp = FORMAT$(-.23,"0.00000") MSGBOX sTmp, 0, "Should show '-0.23000'" ' Workaround sTmp = FORMAT$(-.23,"*0.00000") MSGBOX sTmp, 0, "Should show '-0.23000'" ' This should display "+0.23000", and it does sTmp = FORMAT$(.23,"+0.00000") MSGBOX sTmp, 0, "Should show '+0.23000'" END FUNCTION
Mark Newman
[This message has been edited by Mark Newman (edited August 22, 2000).]
Comment