Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Logarithm function

Author
Message
ShadowCentaur 2
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 13th Apr 2005 14:34
Can someone please create a function in DBC that can do logarithms? i tried to make one and got stuck. a sort of log(#) kind of thing. thanks

Truth suffers from too much analysis.
-Ancient Fremen Saying
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 20th Apr 2005 18:50
did a search in the code base and found this ...
http://forum.thegamecreators.com/?m=forum_view&t=10746&b=6
ShadowCentaur 2
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 21st Apr 2005 12:26
thanks a lot, this will help. i was planning on using logs to do a charge time to power progression. thanks.

Truth suffers from too much analysis.
-Ancient Fremen Saying
ShadowCentaur 2
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 21st Apr 2005 12:35
GAH! i tried the code there and one was too slow to be practical, and the other kept telling me i was dividing by zero(the bane of all calculus students ). can anyone help me?

Truth suffers from too much analysis.
-Ancient Fremen Saying
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 26th Apr 2005 03:03 Edited at: 26th Apr 2005 03:04
logs will always be slow since the most common ways of calculating em use recursion, what you should do is what we used to do in the 8 bit days when every bit of speed was critical, use a lookup table, calculate the logs for the range you want and stick em in an array, then just use the values in the array for your calculations , we used to do this with sine/cos a lot, 360x2 elements was a lot of memory in those days (about 3k from a 16k machine with 11k free for example), but the speed gain made it worth it.

Mentor.

PC1:XP, P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro, 6 way sound.
PC2: Linux, AMD 2ghz, 512mb ram, Nvidia GeForce4mx, 16 bit SB.
PC3: XP, laptop, intel 2.6ghz celeron, ATI 9000igp, 256mb

Login to post a reply

Server time is: 2025-05-23 13:06:45
Your offset time is: 2025-05-23 13:06:45