Page 1 of 1

[Solved] More flexible Debug output

Posted: Thu Sep 05, 2013 10:27 am
by Little John
I would appreciate it, if the output of Debug would be more flexible and thus sometimes more precise.

Currently, e.g.

Code: Select all

Debug 2/5
displays
0
(tested with the internal debugger of PB 5.11 and PB 5.20 beta 16).

In order to see the correct result 0.4, we have to write

Code: Select all

Debug StrD(2/5)
It seems that Debug rounds the result of the division down to an integer, before displaying it.

It would be nice if

Code: Select all

Debug 2/5
would display 0.4.

Thanks for considering this suggestion.

Re: More flexible Debug output

Posted: Thu Sep 05, 2013 10:37 am
by eesau
Little John wrote:It would be nice if

Code: Select all

Debug 2/5
would display 0.4.
2/5 is an integer division, so 0 is the correct result. Have you tried 'Debug 2.0/5.0'? That should work.

Re: More flexible Debug output

Posted: Thu Sep 05, 2013 10:42 am
by PB
Even just "Debug 2.0/5" works. All you need is a float somewhere
in the equation, and the whole equation is done as a float. That's
how PureBasic does calculations.

Re: More flexible Debug output

Posted: Thu Sep 05, 2013 10:53 am
by Little John
PB wrote:All you need is a float somewhere in the equation, and the whole equation is done as a float.
Oops, I had forgotten about that. Thanks!