Solved

How to take antilog of any number in c++

Posted on 2004-04-01
6
4,045 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
[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
  • Learn & ask questions
  • 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
Technology Partners: 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!

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c++ syntax question 9 66
sorting efficency of sorting algorithm 30 149
Add values of each row in an array 3 80
Issues with C++ Class 19 119
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…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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.

734 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