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 / Which is better?

Author
Message
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 25th Jan 2003 17:33
I've recently noticed that the command "newxvalue(x#,a#,s#)" is longer to type than its mathamatical equivilent "sin(a#)*s#". Is there actually any difference in how they do the calculations or the speed at which they do them, or is it just a command for people haven't learnt trig?
Thanks!!
Yum! Yum! Yum! Yum!
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 26th Jan 2003 01:08
By running this program:



I found that 3.6 million calculations using x#+(sin(a#)*s#) takes 530ms when compared to the 19311000ms it takes using newxvalue(x#,a#,s#). Sin is faster than newxvalue. Newxvalue just appears to be a substitute for people who can't use sin and cos.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 26th Jan 2003 02:24
I have to correct you Darthstar, line 6 should be r# = timer(), you forgot the brackets.



...as a result, I find newxvalue() is fractionly faster.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 26th Jan 2003 02:26
Darthstar!! Whoops! I mean Darthster. (sigh) I need glasses

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 26th Jan 2003 04:07
Yup, 19311000ms are more than 5 hours.

Ogres have layers.
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 26th Jan 2003 22:26
Actually, I think you'll find that sin() is fractionally faster than newxvalue().

Yum! Yum! Yum! Yum!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 26th Jan 2003 22:39
I tested the above in DBPro which shows me the newxvalue() is a tad quicker. There may be a slight difference between DB's and DBPro's handling of newxvalue(), or it might be due to the way float operations are handled on my AMD.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 26th Jan 2003 23:36
Oops, sorry about that. Newxvalue is faster by 100ms on my Athlon 2000+. I'm still used to QBasic where timer doesn't need brackets.

Login to post a reply

Server time is: 2024-05-05 04:08:03
Your offset time is: 2024-05-05 04:08:03