

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get exponential value of a number using Math.exp in Java
To get the exponential value of a number in Java, we use the java.lang.Math.exp() method. The Math.exp() returns a double value which is the Euler’s number e raised to the power of the argument. If the parameter is NaN, the result obtained is NaN. If the argument is positive infinity, then the result is positive infinity. In case the argument is negative infinity, then the output is positive zero.
Declaration − The java.lang.Math.exp() method is declared as follows:
public static double exp(double a)
where a is the number representing the power to which e is raised to.
Let us see a program to get an exponential value of a number using Math.exp in Java.
Example
import java.lang.Math; public class Example { public static void main(String[] args) { // declaring and initializing some double values double a = -0.7; double b = 1; double c = 5; //printing their exponential values System.out.println("Exponential value of " + a + " = " + Math.exp(a)); System.out.println("Exponential value of " + b + " = " + Math.exp(b)); System.out.println("Exponential value of " + c + " = " + Math.exp(c)); } }
Output
Exponential value of -0.7 = 0.4965853037914095 Exponential value of 1.0 = 2.718281828459045 Exponential value of 5.0 = 148.4131591025766
- Related Questions & Answers
- Get ceiling value of a number using Math.ceil in Java
- Get floor value of a number using Math.floor in Java
- Get square root of a number using Math.sqrt in Java
- Math.exp() function in JavaScript
- Math.Exp() Method in C#
- How to find exponential value in Python?
- How to get a number value of a string in Javascript?
- Get natural logarithm value using Math.log in Java
- Laplace Transform of Real Exponential and Complex Exponential Functions
- How to force a number to display in exponential notation?
- How to get the absolute value of a number in JavaScript?
- Get the hyperbolic cosine of a given value in Java
- Get the hyperbolic sine of a given value in Java
- Get the base 10 logarithm of a value in Java
- Get the hyperbolic tangent of a given value in Java
Advertisements