GLBasic forum

Main forum => GLBasic - en => Topic started by: Maxheadroom on 2010-Feb-25

Title: Maths function 'e'
Post by: Maxheadroom on 2010-Feb-25
Hello,  have two questions: i am trying to work with the 'e' function in math in fact 'e' to the power of, i have had to use the below code is there a easier way?

e=2.71828182845905
max = POW (e,tot)

I can't get more than 10 decimal points is this correct?
Title: Re: Maths function 'e'
Post by: MrTAToad on 2010-Feb-25
Almost certainly
Title: Re: Maths function 'e'
Post by: Maxheadroom on 2010-Feb-26
Care to shed some light MrTAToad :whip:
Title: Re: Maths function 'e'
Post by: FutureCow on 2010-Feb-26
The reason will be because of the C data type used to store the number. I'm not knowledgeable on turning a number of bits into an actual number range but if you're more C datatype oriented than I am, this might help :- from the documentation

QuoteGLBasic's default storage for numbers uses 8 bytes (64 bits).
...
These numbers are otherwise known as "double precision floating-point numbers.

My guess is you've used up all 64 bits in describing that decimal number. Sorry I can't be of more help.
Title: Re: Maths function 'e'
Post by: Maxheadroom on 2010-Feb-26
Your right, I will have to truncate to 64bit.
Thanks for the help.
Title: Re: Maths function 'e'
Post by: Kitty Hello on 2010-Feb-26
is there no EXP function?
Title: Re: Maths function 'e'
Post by: MrTAToad on 2010-Feb-26
No, there isn't...

PI isn't present either  :-[

QuoteCare to shed some light MrTAToad
Gernot would also set a limit on how many characters to display/convert to a string too...