Home » JavaScript Tutorial

Math.expm1() Method with Example in JavaScript

JavaScript | Math.expm1() Method: Here, we are going to learn about the expm1() method of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on December 05, 2019

JavaScript | Math.expm1() Method

Math operations in JavaScript are handled using functions of math library in JavaScript. In this tutorial on Math.expm1() method, we will learn about the expm1() method and its working with examples.

Math.expm1() is a function in math library of JavaScript that is used to support math's operation of ep-1 of a number p. Where, e is a mathematical constant with value 2.718.

Syntax:

    Math.expm1(p);

Parameter(s):

  • p – It takes only one value which is the number.

Return value:

The return type of this method is number, it returns the result of the expression ep-1.

Example 1:

console.log(Math.expm1(0))

Output

0

The value of e0 - 1 = 0

Example 2: printing valid results for the function

console.log(Math.expm1(2))
console.log(Math.expm1(2.32))
console.log(Math.expm1(-5))
console.log(Math.expm1(Math.log10(43)))

Output

6.38905609893065
9.175674306073333
-0.9932620530009145
4.121608017082989

Example 2: Tring values that will provide invalid results for the function.

console.log(Math.expm1(C))
/*Uncaught ReferenceError: C is not defined
    at <anonymous>:1:24*/

console.log(Math.expm1("include help"))
/*NaN*/






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.