Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

How to take antilog of any number in c++

Posted on 2004-04-01
Medium Priority
4,562 Views
Hi experts!

I have a problem and i m sure not a great one for you.please help me ant tell how to take antilogarithm of any number in c++ by using any function or in whatever way?

plz help me and solve my this problem...???
0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 2

LVL 1

Accepted Solution

Lescha earned 50 total points
ID: 10731326
Huh? You mean calculate the exponent?
There are functions like 'exp' and 'pow' for that.
1

LVL 11

Expert Comment

ID: 10733448
yep, exp is the function you want.

#include <cmath>
using namespace std;

cout << exp(log(1.3)) << endl;

prints 1.3 (as you would hope).

-bcl
0

LVL 12

Expert Comment

ID: 10733455
Yep, exp is the inverse logarithm or antilogarithm.
0

LVL 1

Expert Comment

ID: 10740453
You don't have to include cmath, or to use namespace. It is enough to

#include <math.h>

and then either cout or printf whatever you like.
0

LVL 11

Expert Comment

ID: 10740503
#include <math.h>

includes the standard C math header

#include <cmath>

includes the standard C++ header (wraps the C standard file functionality (the c at the front of the file name) in the C++ std namespace).

So, actually, either works.

-bcl
0

LVL 1

Expert Comment

ID: 10756374
Excuse me, but why "C"? What was wrong or unsatisfactory with my answer?
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base classâ€¦
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationâ€¦
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month8 days, 23 hours left to enroll