Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4863
  • Last Modified:

How to take antilog of any number in c++

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
jadoogar
Asked:
jadoogar
  • 3
  • 2
1 Solution
 
LeschaCommented:
Huh? You mean calculate the exponent?
There are functions like 'exp' and 'pow' for that.
1
 
bcladdCommented:
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
 
stefan73Commented:
Yep, exp is the inverse logarithm or antilogarithm.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LeschaCommented:
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
 
bcladdCommented:
#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
 
LeschaCommented:
Excuse me, but why "C"? What was wrong or unsatisfactory with my answer?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now