
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
ldexp Function in C++
The function ldexp() is used to calculate the multiplication of a floating point value ‘a’ by the number 2 raised to the exponent power. It takes two arguments, first is a floating point number and second is an integer value.
Here is the mathematical expression of ldexp(),
ldexp() = a * 2^b
Here is the syntax of ldexp() in C++ language,
float ldexp(float variable1 , int variable2)
Here,
variable1 − Any name given to the variable which is representing the significand.
variable2 − Any name given to the variable which is representing the exponent.
Here is an example of ldexp() in C++ language,
Example
#include <iostream> #include <cmath> using namespace std; int main() { float x = 28.8; int y = 3; cout << "The value : " << ldexp(x, y); return 0; }
Output
Here is the output
The value : 230.4
Advertisements