Hello to everyone,I'm using a Borland BCC55 compiler to describe the logarithm function.
It works fine,but only with numbers higher than 1,if I insert any floating point the result stucks on -46,whatacer number <1 I write.
Here is the function,I made it myself (on a text host):
http://freetexthost.com/kv0rdi4gno
Of course I have to do it with only the stdio.h library,no math.h or it's like cheating.
Anyone explain me why I get this "-46" and how to fix it?
Here's the image,please help me !!
http://img28.imageshack.us/img28/5259/catturados.png
ramy89 0
Newbie Poster
Recommended Answers
Jump to PostPost your code here instead of posting a link on some other computer -- which would not respond when I tried to read it. Just simply copy and paste the code in your post and surround it with [code] ... [/code] code tags.
Jump to PostWhat happens when you compare the float i with the int n? That seems to be the only place where it could be going wrong.
I suggest that you instrument after line 26 with
printf("m=%d, n=%d, i=%f, p = %f\n",m,n,i,p);
. You might also want to print out the …
All 7 Replies
Ancient Dragon 5,243
Achieved Level 70 Team Colleague Featured Poster
ramy89 0
Newbie Poster
ramy89 0
Newbie Poster
griswolf 304
Veteran Poster
mcodesmart -6
Newbie Poster
mcodesmart -6
Newbie Poster
ramy89 0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.