Solved

How to take antilog of any number in c++

Posted on 2004-04-01
6
3,660 Views
Last Modified: 2007-12-19
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
Comment
Question by:jadoogar
  • 3
  • 2
6 Comments
 
LVL 1

Accepted Solution

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

Expert Comment

by:bcladd
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

by:stefan73
ID: 10733455
Yep, exp is the inverse logarithm or antilogarithm.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:Lescha
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

by:bcladd
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

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now