[Solved] More flexible Debug output

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

[Solved] More flexible Debug output

Post 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.
Last edited by Little John on Thu Sep 05, 2013 10:54 am, edited 1 time in total.
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: More flexible Debug output

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: More flexible Debug output

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: More flexible Debug output

Post 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!
Post Reply