Page 2 of 2

Posted: Mon Apr 14, 2008 4:31 am
by byo
Thank you! 8)

wrong float

Posted: Mon Apr 21, 2008 9:55 am
by peterb
hi,
today i use float in new version and result is weird

Code: Select all

For c = 1 To 10
  Debug 0.1 * c
  Debug 1 + ( 0.1 * c )
  Debug 2 + ( 0.1 * c )
  Debug 3 + ( 0.1 * c )
  Debug 4 + ( 0.1 * c )
  Debug 5 + ( 0.1 * c )
  Debug 6 + ( 0.1 * c )
  Debug 7 + ( 0.1 * c )
  Debug 8 + ( 0.1 * c )
  Debug 9 + ( 0.1 * c )
  Debug ""
Next

Code: Select all

RESULT:

0.10000000000000001
1.10000002384186
2.09999990463257
3.09999990463257
4.09999990463257
5.09999990463257
6.09999990463257
7.09999990463257
8.10000038146973
9.10000038146973

0.20000000000000001
1.20000004768372
2.20000004768372
3.20000004768372
4.19999980926514
5.19999980926514
6.19999980926514
7.19999980926514
8.19999980926514
9.19999980926514

0.30000000000000004
1.29999995231628
2.29999995231628
3.29999995231628
4.30000019073486
5.30000019073486
6.30000019073486
7.30000019073486
8.30000019073486
9.30000019073486

0.40000000000000002
1.39999997615814
2.40000009536743
3.40000009536743
4.40000009536743
5.40000009536743
6.40000009536743
7.40000009536743
8.39999961853027
9.39999961853027

0.5
1.5
2.5
3.5
4.5
5.5
6.5
7.5
8.5
9.5

0.60000000000000009
1.60000002384186
2.59999990463257
3.59999990463257
4.59999990463257
5.59999990463257
6.59999990463257
7.59999990463257
8.60000038146973
9.60000038146973

0.70000000000000007
1.70000004768372
2.70000004768372
3.70000004768372
4.69999980926514
5.69999980926514
6.69999980926514
7.69999980926514
8.69999980926514
9.69999980926514

0.80000000000000004
1.79999995231628
2.79999995231628
3.79999995231628
4.80000019073486
5.80000019073486
6.80000019073486
7.80000019073486
8.80000019073486
9.80000019073486

0.90000000000000002
1.89999997615814
2.90000009536743
3.90000009536743
4.90000009536743
5.90000009536743
6.90000009536743
7.90000009536743
8.89999961853027
9.89999961853027

1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0

Posted: Mon Apr 21, 2008 10:06 am
by Fred
Float are not exactly accurate, why is it wierd ?

Posted: Mon Apr 21, 2008 11:15 am
by Falko

Code: Select all

For c = 1 To 10
  Debug StrD(0.1 * c)
  Debug StrD(1 + 0.1 * c )
  Debug StrD(2 + 0.1 * c )
  Debug StrD(3 + 0.1 * c )
  Debug StrD(4 + 0.1 * c )
  Debug StrD(5 + 0.1 * c )
  Debug StrD(6 + 0.1 * c )
  Debug StrD(7 + 0.1 * c )
  Debug StrD(8 + 0.1 * c )
  Debug StrD(9 + 0.1 * c )
  Debug ""
Next

Posted: Mon Apr 21, 2008 5:18 pm
by Demivec
Falko wrote:

Code: Select all

For c = 1 To 10
  Debug StrD(0.1 * c)
  Debug StrD(1 + 0.1 * c )
  Debug StrD(2 + 0.1 * c )
  Debug StrD(3 + 0.1 * c )
  Debug StrD(4 + 0.1 * c )
  Debug StrD(5 + 0.1 * c )
  Debug StrD(6 + 0.1 * c )
  Debug StrD(7 + 0.1 * c )
  Debug StrD(8 + 0.1 * c )
  Debug StrD(9 + 0.1 * c )
  Debug ""
Next
You are comparing Debug StrD() to Debug (which then uses something like StrF() ). When Debug prints the float, it is printing all the decimals. When you used Debug StrD() you are using it's default precision and it rounds the value off. Try your example with Debug StrD(0.1 * c,18 ) or Debug StrF(0.1 * c) to see the difference.

Posted: Tue Apr 22, 2008 9:55 am
by Falko
Yes you have right with Debug.
I've wrote StrD on this, not StrF and not full Decimals.
This would be rounding and is correct.

You can test this and compare Debug and Debug StrD(...) is not the
same as Debug StrF(..)

Code: Select all

For c= 1 To 10
Debug StrD(0.1 * c) + " :Debug StrD"
Debug StrF(0.1 * c) + " :Debug StrF"
Debug "Debug, with no StrF or StrD:"
Debug 0.1*c 
Debug StrD(0.1*c,18)+ " Debug StrD with 18 Decimals" 
Debug StrF(0.1*c,18)+ " Debug StrF with 18 Decimals"
Debug "-------------------------"
Next c
The Floats (StrF) are not exactly accurate as Double (StrD).
The Computer is not a "fast" pocket calculator with high precision


Regards, Falko

Posted: Wed Apr 30, 2008 3:07 pm
by LCD
Tested, removed all double declarations, but with the debugger enabled, compiler still crashes with my program (Sorry, I will post no source because 45000 lines of source code!). Without debugger anything works well.

Ide shortcut problem

Posted: Sat May 03, 2008 12:26 pm
by mag
First, Thank you for the update. really rock..

For the good of purebasic here I found small prob on ide.

When I press Alt + F its open a file menu but when I press N to get command New it not work. It goes to all other command in all menu/submenu

other than that its really great. thanks

Re: Ide shortcut problem

Posted: Sat May 03, 2008 2:30 pm
by Tipperton
mag wrote:When I press Alt + F its open a file menu but when I press N to get command New it not work. It goes to all other command in all menu/submenu
That's not the only one that doesn't work, pressing Alt-C, then E to build an executable doesn't work either.

I've also noticed that the text of the selected menu option stays black so in a black selection back ground you can't see it.

Image

Personally I liked the menu the way it was in v4.10, it worked. :mrgreen:

Debugger error

Posted: Sat May 03, 2008 4:30 pm
by mag
I have this error when I try to run code created on previous version with debug on.

"This executable was not compiled for this version of the debugger!
Please recompile it to match this debugger version."

And I don't know how to recompile it.

Re: Debugger error

Posted: Sat May 03, 2008 5:12 pm
by ts-soft
mag wrote:I have this error when I try to run code created on previous version with debug on.

"This executable was not compiled for this version of the debugger!
Please recompile it to match this debugger version."

And I don't know how to recompile it.
Use the taskmanager and kill the purebasiccompilationX.exe

Re: Debugger error

Posted: Sat May 03, 2008 7:47 pm
by freak
mag wrote:I have this error when I try to run code created on previous version with debug on.

"This executable was not compiled for this version of the debugger!
Please recompile it to match this debugger version."

And I don't know how to recompile it.
Sounds like you updated the IDE, but not the debugger library or vice versa.
Try to apply the update again with all PB related programs closed.