Add These Functions/Keywords To PureBasic?

Everything else that doesn't fall into one of the other PB categories.

Should these functions/keywords be added to a future version of PureBasic?

Yes
7
35%
No
13
65%
 
Total votes: 20

chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Add These Functions/Keywords To PureBasic?

Post by chris319 »

Should these functions/keywords be added to a future version of PureBasic?

EXP(X)

SGN(X)

PI

-- POLL QUESTION EDITED TO REFLECT INCLUSION OF ACOS(), ASIN() AND ATAN() --
Last edited by chris319 on Fri Feb 24, 2006 12:56 am, edited 2 times in total.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Are not those last 3 already part of PB?
I may look like a mule, but I'm not a complete ass.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Are not those last 3 already part of PB?

Yes. ACos, ASin, and ATan have existed since at least v3.94:
http://www.purebasic.com/documentation/math/index.html

Also, I was certain the constant #PI existed at one time, but I get an error
with v4.00 Beta 3 if I try to use it... surely I couldn't have been dreaming?

EDIT: Ah, here is where I saw it in the manual:
http://www.purebasic.com/documentation/ ... mulas.html

It says to use PI, but I do "Debug PI" it returns 0 for v4.00 Beta 3. Looks
like it needs fixing for v4.00 Final.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post by Jan Vooijs »

PB

Here is PI:

Code: Select all

Debug ACos(-1)
Now hows that a program in one line giving PI!!!!

The answer is: 3.1415927410125732
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Here is PI:
> Debug ACos(-1)

Hehe, and here's a macro for it (until Fred fixes the PI variable):

Code: Select all

Macro Pie
  ACos(-1)
EndMacro

Debug Pie
;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

What about just:

#PI = 3.1415927410125732

:)


BTW, I don't think PureBasic ever had Pi, did it?
@}--`--,-- A rose by any other name ..
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I don't think PureBasic ever had Pi, did it?

According to the manual/helpfile, yes. See my link above.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Ah.

I think it meant Pi in a general sense as it also shows the Acos(-1) to get Pi. I just tried in 3.94 and pi = 0, "pi" being a long, pi.l

Regardless, we now have pi in several flavours. And macros are going to save Fred and team from writing some commands/fielding some requests down the track, I think. ;)
@}--`--,-- A rose by any other name ..
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Post by chris319 »

This is from the online documentation for 3.94:

Code: Select all

Command Index

    ACos
    ASin
    ATan
    Abs
    Cos
    Int
    Log
    Log10
    Pow
    Round
    Sin
    Sqr
    Tan
No PI.

Bottom line: PI, EXP() AND SGN() are not needed. They are not needed because ... ?
pi = 0, "pi" being a long, pi.l
I would expect PI to be a float or a double, wouldn't you?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

#PI (PB4B4) is a double :wink:
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
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> No PI

Well the manual gives an example in "PureBasic code" as you can see:

Code: Select all

'PI' stands for the constant value "PI = 3.1415...". An example for realizing
such a formula in PureBasic code: A = PI*r^2 will be A = PI*Pow(r,2)
So I thought PI was a reserved variable or something. As I never had to use
PI, I never tested it before, and just assumed it worked per the above code.
But good to see that Fred has officially added it as #PI for the next release. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post by Jan Vooijs »

PB wrote:> Here is PI:
> Debug ACos(-1)

Hehe, and here's a macro for it (until Fred fixes the PI variable):

Code: Select all

Macro Pie
  ACos(-1)
EndMacro

Debug Pie
;)
Your version looks more like a-PIE-in-the-Sky :oops: :lol: :P :roll: :D

Jan V. (no pun intended)
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

:lol: @Jan.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Post by chris319 »

The PureBasic lot are a funny, funny lot.
#PI (PB4B4) is a double
One out of three ain't bad.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Debug pi in 3.94 is debugging a long. :) Does that make it 2 out of 3? :)
@}--`--,-- A rose by any other name ..
Post Reply