LOG function for c++

This is a discussion on LOG function for c++ within the C++ Programming forums, part of the General Programming Boards category; could somebody throw out a function for LOG i know like exponents its in the mathematical function library but i ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    4

    LOG function for c++

    could somebody throw out a function for LOG i know like exponents its in the mathematical function library but i searched and cant seem to find any useful info on it

    any help would be great

    thanks

    -Matt

    oh yea im still pretty green so please try and make it understandable

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    here is an example of log10 in cmath:

    Code:
    #include <iostream>
    #include <cmath>
    
    int main() {
    	int x = 8;
    	double y = 0;
    	
    	y = log10(x);
    	
    	std::cout << y << std::endl;
    	std::cin.get();
    	
    	return 0;
    }
    if you remove the 10 for log10, it will be log, and that represents natural log, while log10 represents the common log.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Brand new to C need favor
    By dontknowc in forum C Programming
    Replies: 5
    Last Post: 09-21-2007, 10:08 AM
  3. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21