Power operator for PB 3.80

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Power operator for PB 3.80

Post by Psychophanta »

Please, what about a power operator "^" instead of pow() function just now you are working for 3.80 version?
If you add ^ for power arithmetic operations you can remove pow() function.
Keep in mind too that just an operator is better for readability...


Thanx Fred!

_______________
AL
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

i second that! i was quite surprised i couldn't use 2^2 etc.

ehm, and plz for floats as well as integers and even constants...

for example:

a.l = 2 ^ 2
a.f = 2 ^ 2

#DTAREADY = 2 ^ 2

but then again, perhaps i ask too much...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

More good reasons to deprecate Pow:
- Pow is not a typical BASICs word. Few BASIC dialects use it instead ^
- PB syntax philosophy supports keywords as entire names, Pow is an incomplete word.
- There is an inconsitence with other operators. In order to have coherence there should replace '*' by Mul(), '/' by Div(), '+' by Sum(), etc.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Mul and div are complete words?

You request seems to contradict itself - replace pow with ^ but replace * with div.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

I understand what he means:
If power stays Pow(), devide should be changed to Div() etc..


... me, I don't care ...

in fact, Pow() is on a Level like Sqr() or Log().
not an operation on the level like division or multiplication.
it's not even a bijective transformation, like division and multiplication are.
so, it's not that big argument I think.
oh... and have a nice day.
Post Reply