Author Topic: Maths function 'e'  (Read 2975 times)

Offline Maxheadroom

  • Mr. Drawsprite
  • **
  • Posts: 62
    • View Profile
    • http://www.hot-apartments.co.uk
Maths function 'e'
« 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?

MrTAToad

  • Guest
Re: Maths function 'e'
« Reply #1 on: 2010-Feb-25 »
Almost certainly

Offline Maxheadroom

  • Mr. Drawsprite
  • **
  • Posts: 62
    • View Profile
    • http://www.hot-apartments.co.uk
Re: Maths function 'e'
« Reply #2 on: 2010-Feb-26 »
Care to shed some light MrTAToad :whip:

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: Maths function 'e'
« Reply #3 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

Quote
GLBasic'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.

Offline Maxheadroom

  • Mr. Drawsprite
  • **
  • Posts: 62
    • View Profile
    • http://www.hot-apartments.co.uk
Re: Maths function 'e'
« Reply #4 on: 2010-Feb-26 »
Your right, I will have to truncate to 64bit.
Thanks for the help.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Maths function 'e'
« Reply #5 on: 2010-Feb-26 »
is there no EXP function?

MrTAToad

  • Guest
Re: Maths function 'e'
« Reply #6 on: 2010-Feb-26 »
No, there isn't...

PI isn't present either  :-[

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