Skip to main content
gamedev.net
🔒 Locked

antilog

Started by James Sioutis Jun 12, 2004 at 7:00 AM 3 replies 2.6k views
Original Post
James Sioutis
James Sioutis
how do you do the antilog in C++? I''ve looked in the standard math.h library but they only seem to have log, ln, and log10...? [~aussie]
[~aussie]
Muzzafarath
Muzzafarath
Antilog, as in exponentiation? Try exp().
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
James Sioutis
James Sioutis
well i mean if you had a function like... antilog( float x ), then it would do 10 or e to the power of x and then return the number. I tried the exp( ) but it didn''t come out with the right number though.

Also how would you do log with different bases?? ie log base 2?

[~aussie]
[~aussie]
Monder
Monder
Well if you want to do 10x then just use pow( ), exp( ) will give you ex.

quote:
Also how would you do log with different bases?? ie log base 2?


Logab = ln b / ln a or Logab = lg b / lg a where lg is the log in base 10.

[edit]Flicking through some c math libary docs there's a log2( ) function (log in base 2) and there's also a pow10( ) function (which will give you 10x)

[edited by - Monder on June 12, 2004 9:25:15 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.