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.

Newcomers DBPro Corner / math troubel

Author
Message
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 28th Mar 2003 20:32
ok this is kinda hard to explain

i have two values 64 and 128 respectively
now my program will only ever see one at a time but in a formula i have displaying a sprite, it takes into account the size of the bitmap (which is either 64 or 128)

i need to add into the formula a sub-formula which will use the variable(128 or 64) and return a 2 if it is 128 and a 4 if it is 64.

i dont want to use ifs or selects because it is in a "high-traffic" function of my program.

i was wondering if there was a way to manipulate those 2 numbers so that it will become 4 for 64 and 2 for 128.

thanks guys
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 28th Mar 2003 20:41
What you need is:

ans = 6 - (n/32)

where n is either 64 or 128

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.
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 28th Mar 2003 20:46
THANK YOU SO MUCH!!!

it was so easy...
dont i feel stupid lol
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 28th Mar 2003 22:04
No, not stupid at all, everyone often misses the simpliest of things that can stare us in the face for hours

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.
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 28th Mar 2003 22:55 Edited at: 28th Mar 2003 22:56
lol that was staring at my face for about 2 days lol

edit: i had my graphing calculator out and was exploring the "wonderful world of trigonometry"... (almost had it worked out too)

Login to post a reply

Server time is: 2024-09-20 00:49:03
Your offset time is: 2024-09-20 00:49:03