Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c

What is expm1 in C?

Sheza Munir

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The expm1 function calculates the e (Euler’s number, i.e., 2.7182818) raised to the given argument provided in the parameter, with the subtraction of 1.

Library

The exmp1 function is accessible via the math.h header.

Parameters

The parameter provided to the function is a single argument of double datatype.

Return value

If the function encounters no errors, the calculated value is returned. In case of range errors, the correct value may not be returned. If the function encounters an underflowa number lower than the range of long double, the correct result (after rounding) is returned. If the function encounters an overflowa number larger than the range of long double error, +HUGE_VAL +HUGE_VALF or +HUGE_VALL, is returned.

Code

#include <stdio.h>
#include <math.h>
int main()
{
double power = 2.3;
double returned = expm1(power);
printf("e^2.3 - 1 = %f", returned);
}

RELATED TAGS

c

CONTRIBUTOR

Sheza Munir
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring