Floating point recursion - Is this a bug?

Post bugreports for the Windows version here
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Floating point recursion - Is this a bug?

Post by Trond »

Run the code to see what I mean. Is this a bug?

Code: Select all

Global Zf.f = 1
Global Z.l = 1

Procedure.f Testf(Valf.f)
  If Valf > 0
    Debug Valf
    ProcedureReturn Zf*Testf(Valf-1)
  EndIf
EndProcedure
Procedure.l Test(Val.l)
  If Val > 0
    Debug Val
    ProcedureReturn Z*Test(Val-1)
  EndIf
EndProcedure

Debug "FLOAT VERSION:"
Debug Testf(100)

Debug ""
Debug "LONG VERSION:"
Debug Test(100)
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

It looks like a bug to me.

(It doesn't like the expression in the ProcedureReturn for some reason, remove the Zf* and it works).
@}--`--,-- A rose by any other name ..
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

"Some reason" is that the floating point stack/registers are not preserved on procedure calls and there are only 8 of them so in a 10 times recursive calling procedure like that all of them are filled up.

Edit: It's the same as this:

Code: Select all

Test.f = 1
a.f = Test*(Test*(Test*(Test*(Test*(Test*(Test*(Test*(Test*Test))))))))
Debug a
dell_jockey
Enthusiast
Enthusiast
Posts: 768
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

testing with PB4b10, only the recursion with the float value failed.

[edit]: Trond beat me to it... / I think the webmaster should move this to 'Bug Reports' as it really appears to be one.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

Old bug, same in PB3.94.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Can we get a comment on this?
Fred
Administrator
Administrator
Posts: 14351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, it's bug when you are running out of float registers, i will take a look.
Jilocasin
New User
New User
Posts: 5
Joined: Thu Nov 27, 2008 7:09 pm

Re:

Post by Jilocasin »

Fred wrote:i will take a look.
Nothing happened, Bug is still bugging around.. :?
Tested today with 4.50 RC 2
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8182
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Floating point recursion - Is this a bug?

Post by netmaestro »

Tested today with 4.50 RC 2
That's the second time in the last few days someone referenced RC2. There's no such thing yet!
BERESHEIT
Jilocasin
New User
New User
Posts: 5
Joined: Thu Nov 27, 2008 7:09 pm

Re: Floating point recursion - Is this a bug?

Post by Jilocasin »

The titlebar and aboutbox says "PureBasic 4.50 RC 2 (x86)".

However, it was the "Download PureBasic 4.50 full version for Windows"-Link.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8182
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Floating point recursion - Is this a bug?

Post by netmaestro »

Ok, I didn't notice the 4.50. It's 4.51 that's still at RC1. Mystery solved :mrgreen:
BERESHEIT
moogle
Enthusiast
Enthusiast
Posts: 372
Joined: Tue Feb 14, 2006 9:27 pm
Location: London, UK

Re: Floating point recursion - Is this a bug?

Post by moogle »

netmaestro wrote:
Tested today with 4.50 RC 2
That's the second time in the last few days someone referenced RC2. There's no such thing yet!
Must be a secret build we don't know of :shock:
Image
User avatar
NicTheQuick
Enthusiast
Enthusiast
Posts: 787
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Floating point recursion - Is this a bug?

Post by NicTheQuick »

The Bug is still here. When it will be fixed?
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
NicTheQuick
Enthusiast
Enthusiast
Posts: 787
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Floating point recursion - Is this a bug?

Post by NicTheQuick »

Now this bug looks strange. On my system the debugger gives this output:

Code: Select all

FLOAT VERSION:
20.0
19.0
18.0
17.0
16.0
15.0
14.0
13.0
NaN

LONG VERSION:
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 591
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Floating point recursion - Is this a bug?

Post by Kurzer »

Same output here.
Windows XP SP3, 32 Bit, PB 5.10b5
PB 5.73 x64, OS: Windows 7 Pro x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age: 53y
"Happiness is a pet." | "Never run a changing system!"
Post Reply