casco
New Member
Posts: 16
|
Post by casco on Feb 11, 2020 10:23:58 GMT
Why does a percent sign appear in the negative result?
pos=sqr(2) neg=-1*sqr(2) print "pos = ";using ("#.####", pos) print "neg = ";using ("#.####", neg) end
|
|
|
Post by Rod on Feb 11, 2020 10:35:07 GMT
It is telling you that you are overflowing the space you allowed. The - is being treated as a digit and -1 is more than # it would need ##
Its a presentation tool, so if it matters you might add the sign separately and use the abs() value for the #.####
|
|
|
Post by tsh73 on Feb 11, 2020 13:45:25 GMT
Just use "##.####" so you allocate place for minus sign as well.
|
|
casco
New Member
Posts: 16
|
Post by casco on Feb 11, 2020 14:46:14 GMT
Aha. So in anticipation of negative values, one more # is needed in the integer part. Thanks.
|
|