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
  • Learn & ask questions
Solved

How to take antilog of any number in c++

Posted on 2004-04-01
6
3,843 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

808 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