Page 1 of 1

EXP()

Posted: Thu Nov 24, 2005 5:55 am
by chris319
Please include Exp() in PureBasic. Thanks again to El_Choni for this example:

Code: Select all

#E = 2.71828182

Procedure.f Exp(value.f)
  ProcedureReturn Pow(#E, value)
EndProcedure

Posted: Thu Nov 24, 2005 7:59 am
by Lebostein
And please, please, please add follow functions

- Abs() for integers, best way two functions: Abs() & AbsF()
- Sign()

And this after 5 years PureBasic!! :? This functions are basic BASIC-functions!

Posted: Thu Nov 24, 2005 9:17 pm
by chris319
- Abs() for integers, best way two functions: Abs() & AbsF()
IMO there should be just one Abs() which can (or the compiler can) determine whether it is a float or integer.

As for other requests, we should be able to use a variable after Step in a For...Next loop. Requiring the use of a constant is ridiculous. And preferably not StepW and StepF, just Step.

Also requesting FP(). This is part of the ANSI/ISO standard for BASIC (yes, there IS a standard for BASIC). FP stands for Fractional Part and it returns the fractional part of the argument.

If we're going to have Exp() we're going to need Exp10() as well.

Posted: Thu Nov 24, 2005 10:10 pm
by Trond
chris319 wrote:As for other requests, we should be able to use a variable after Step in a For...Next loop. Requiring the use of a constant is ridiculous. And preferably not StepW and StepF, just Step.
:lol: Image that if all the new variable types that are requested are made! We'll need StepB, StepW, StepF, StepUb, StepUw, StepQ, StepUq, StepD and StepLd! No, let's go for the quickstep.

Posted: Thu Nov 24, 2005 10:46 pm
by Killswitch
I'm a little confused - what does Exp() actually return (obviously value^#E) but whats it for/do?

Posted: Thu Nov 24, 2005 11:12 pm
by Trond
Killswitch wrote:I'm a little confused - what does Exp() actually return (obviously value^#E) but whats it for/do?
No idea. http://no.php.net/exp

Posted: Thu Nov 24, 2005 11:48 pm
by chris319
Sign()
Would you be just as happy with SGN() for compatability with ANSI/ISO and most other BASICs including QB and VB?

Posted: Fri Dec 02, 2005 4:31 pm
by Dr. Dri
Killswitch wrote:I'm a little confused - what does Exp() actually return (obviously value^#E) but whats it for/do?
If you lack some skills for math understanding, it's no big deal...
For example Exp() can be used to calculate Pow()

Code: Select all

Procedure.f Exp(x.f)
  Protected r.f, t.f, i.f
  
  If x >= 0
    r = 1.0
    t = 1.0
    
    While t
      i + 1.0
      t * x / i
      r + t
    Wend
  Else
    r = 1/Exp(-x)
  EndIf
  
  ProcedureReturn r
EndProcedure

x.f = 0.485714
y.f = 1.421053

Debug StrF(Pow(x, y), 17)
Debug StrF(Exp(y*Log(x)), 17)
Dri ;)

Posted: Sat Dec 03, 2005 12:55 am
by Intrigued
we should be able to use a variable after Step in a For...Next loop.
I ran into "needing a variable and not the Constant" deal-e-o in a For..Next loop myself. I second this one!