Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c

What is exp2l() in C?

Syed Muhammad Ali Mustafa

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.

We use the exp2l() function to compute 2 raised to the power of x for long double in C.

Mathematical representation of the exp2l() function

Library

#include<math.h>

Syntax

Below is the declaration of the exp2l() function.

Here x is a long double exponent passed as the parameter to the function:

long double exp2l(long double x);

The function returns e raised to the power of x as a long double value.

Code

#include <math.h>
#include <stdio.h>
int main()
{
long double var1;
long double var2;
var1 = 5.5;
var2 = -2.3;
printf("2^5.5 = %Lf", exp2l(var1)); //Calculates 2^5.5
printf("\n2^-2.3 = %Lf", exp2l(var2)); //Calculate 2^-2.3
return 0;
}

RELATED TAGS

c

CONTRIBUTOR

Syed Muhammad Ali Mustafa
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