Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log2() Problem

Status
Not open for further replies.

amarg

Programmer
Nov 19, 2002
106
IN
Hi all,

I want to use the function log2(). In my system this function is in sunmath.h. But i don't think this file is in every system.

Is there any standard file for ANSI-C where i can find the log2().


Regards,
Amar
 
Just use the identity

Code:
loga(b) = logx(b) / logx(a);

So long as you have the log function in one base, you can calculate logs in any other base.



--
 
Thanks for your reply. I was using that formula.

I just want to know log2() function exist in math.h or not.

In Linux log2() is in math.h but on the sun machine it is not in math.h.

Regards,
 
log2 isn't a standard function, so it's availability will vary

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top