
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
log() function in C++
The C/C++ library function double log(double x) returns the natural logarithm (basee logarithm) of x. Following is the declaration for log() function.
double log(double x)
The parameter is a floating point value. And this function returns natural logarithm of x.
Example
#include <iostream> #include <cmath> using namespace std; int main () { double x, ret; x = 2.7; /* finding log(2.7) */ ret = log(x); cout << "log("<< x <<") = " << ret; return(0); }
Output
log(2.7) = 0.993252
- Related Articles
- log() function for complex number in C++
- log() function in PHP
- PHP log() Function
- Log functions in C#
- Write an iterative O(Log y) function for pow(x, y) in C++
- Find minimum number of Log value needed to calculate Log upto N in C++
- Program to compute Log n in C
- If a, b, and c are in G.P., prove thatlog a, log b, and log c are in A.P.
- Evaluate: $log\ sin1^o.log\ sin 2^o. log\ sin3^o\ ........log\ sin90^o$.
- Log functions in Python
- Log functions in Java
- Log functions in Python Program
- Prime Factorization using Sieve O(log n) for multiple queries in C++
- Program for power of a complex number in O(log n) in C++
- How to remove scientific notation from a Matplotlib log-log plot?

Advertisements