PureBasic 4.20 Beta 4 (Windows)

Developed or developing a new product in PureBasic? Tell the world about it.
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

Thank you! 8)
Proud registered Purebasic user.
Because programming should be fun.
peterb
User
User
Posts: 60
Joined: Sun Oct 02, 2005 8:55 am
Location: Czech Republic
Contact:

wrong float

Post 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
Fred
Administrator
Administrator
Posts: 18237
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Float are not exactly accurate, why is it wierd ?
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Post 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
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
User avatar
Demivec
Addict
Addict
Posts: 4270
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post 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.
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Post 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
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
LCD
Enthusiast
Enthusiast
Posts: 206
Joined: Sun Jun 01, 2003 10:55 pm
Location: Austria, Vienna
Contact:

Post 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.
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Ide shortcut problem

Post 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
Tipperton
Addict
Addict
Posts: 1286
Joined: Thu Jun 19, 2003 7:55 pm

Re: Ide shortcut problem

Post 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:
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Debugger error

Post 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.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Debugger error

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
freak
PureBasic Team
PureBasic Team
Posts: 5941
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Debugger error

Post 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.
quidquid Latine dictum sit altum videtur
Post Reply