GPWiki.org
GPWiki.org
It is currently Wed Jun 19, 2013 5:44 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Am I stupid?
PostPosted: Mon Apr 09, 2012 11:42 pm 
Grand Optimizer
User avatar

Joined: Mon Jan 17, 2005 6:01 pm
Posts: 353
Location: Canada
Code:
 get
            {

                A = ((B / C) * 100);
               
               
                return A;

            }

B) starting value: 11
C) starting value: 100

A evaluates to 0. This isn't complicated math. The logic was working earlier, but now it isn't. I can even take a screenshot in my IDE and clearly show the values that are in the variables at the time i've got the loop paused. Unless im overlooking something embarrasingly simple, ive got an actual arithmetic error on my hands. I didnt think that was possible.

A should evaluate to 11, not 0.

Any help?

Thanks


EDIT: As it turns out, it was an issue to do with ints vs floats and blah blah yeah so to answer my original question: Yes, I am infact stupid. lol.

_________________
"None are more hopelessly enslaved than those who falsely believe they are free."
"It is no measure of health to be well adjusted to a profoundly sick society."
"Hope is the first step on the road to dissapointment." -Jonah Orion
http://tankzgame.blogspot.com


Top
 Profile  
 
 Post subject: Re: Am I stupid?
PostPosted: Tue Apr 10, 2012 7:12 am 
Harmlessness does no harm
User avatar

Joined: Tue Sep 14, 2004 8:37 pm
Posts: 3854
Location: Ferriday, LA, US
Meneliki wrote:
Yes, I am infact stupid. lol.

Welcome to Club Human. :P

(I've encountered this exact problem before, first time when I was learning Java. Took three days of fighting before someone noticed my formula required an explicit cast to avoid the flooring error... so don't feel too special.)

_________________
What most people don't understand about "enlightenment" is that it is not an end-goal; but where you find yourself just before taking a new "first step."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group