![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing global variable to a function which is called by another function | sars | Shell Programming and Scripting | 4 | 6 Days Ago 08:39 AM |
| Dynamic loader taking function from wrong lib | rimon | High Level Programming | 1 | 01-29-2008 03:46 AM |
| Wrong date function | Asteroid | Shell Programming and Scripting | 3 | 04-04-2007 01:09 AM |
| Function within function (Recurance) | chassis | UNIX for Dummies Questions & Answers | 2 | 09-19-2006 06:32 AM |
| Whats wrong with my function?? <newbie> | riwa | Shell Programming and Scripting | 4 | 03-04-2006 01:14 PM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
what is wrong with the log function in c?
Hi I looked up the reference but couldn't figure out whats wrong with my log funtions in ANSI C, need this log functions for a memory compiler, please help!!
#include <stdio.h> #include <math.h> int main(void) { double d ; double logB(double x, double base); printf(" natural log :\n"); for ( d = 1; d <= 10; d++) printf(" ln(%f) = %f\n", d, log(d)); printf("\n\n\n 2base log :\n"); for ( d = 1.0; d <= 10.0; d++) printf(" log2(%f) = %f\n", d, logB(d, 2)); return 0; } double logB(double x, double base) { return( log(x) / log(base)); } |
| Forum Sponsor | ||
|
|