• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to calculate e ^3 using Math.pow

 
sarah sturgeon
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody

I want to calculate e^3 using Math.pow

I understand that I can do the following :

Math.pow (2.718,3) where 2.718 is the value of " e"

Is there anyway i can use " e" rather than its value for better accuracy e.g Math.pow( e,3) ?

Thanks and have a great a weekend.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed there is. Check out the documentation for the Math class and you should find it near the top.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50180
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and if you go through the whole of the Math class, you find how you can dispense with the value of e altogether.
 
Nelson Jumbo
Greenhorn
Posts: 4
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use this e.g:
System.out.println( Math.E+"");
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How does that help to get e^3?
2. To print the value of Math.E, it's unnecessary to concatenate it to an empty String.
 
Nelson Jumbo
Greenhorn
Posts: 4
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Math.pow(Math.E,3);

is working fine for me.

 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and if you go through the whole of the Math class, you find how you can dispense with the value of e altogether.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50180
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike Simmons wrote:. . . and if you go through the whole of the Math class, you find how you can dispense with the value of e altogether.
There is something familiar about that post, but I can't quite put my finger on it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic