Author |
Message |
CodeMonkey2000
|
Posted: Fri Aug 24, 2007 7:00 pm Post subject: Integer overflow problem with turing's trig functions. |
|
|
When I run this I keep getting an integer overflow error.
How do I get around this? The number you get in that function isn't even that big (in fact it's quite small), why is it giving me this error? Oh and I need to deal with integers. Using just real variables won't help me. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Fri Aug 24, 2007 7:04 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
tand(90) = infinity =\ how could it be small?
Actually why isin't it complaining of div by zero? |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Fri Aug 24, 2007 7:09 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
Oh right use radian ![Razz Razz](http://compsci.ca/v3/images/smiles/icon_razz.gif) |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Aug 24, 2007 7:10 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
And just to clarify:
tand 90 = sind 90 / cosd 90
tand 90 = 1 / 0
That's why it doesn't work ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Fri Aug 24, 2007 7:12 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
Radians or degrees, either one would result in Infinity.
My concern is why isin't cosd(90) = 0??? |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Aug 24, 2007 7:58 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
I'm not sure Turing represents cosd (90) as 1.22 x 10^-16, yet sind (90) = 1 |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Fri Aug 24, 2007 10:03 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
Another strange thing is that tand(90) won't give you an error. Only when you try to convert it in to an integer through round,ceil or floor will you get an error. So it realizes its mistake when you attempt to convert it. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Aug 24, 2007 10:09 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
Uh... tand(90) definitely gives an error in the way of "Quit #51" |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Fri Aug 24, 2007 10:13 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
That's strange, on my computer it gave me:
8.16423 x10^18 |
|
|
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Fri Aug 24, 2007 10:31 pm Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
You're using a different version of Turing. I'm guess ing ver < 4.1 |
|
|
|
|
![](images/spacer.gif) |
Prince Pwn
|
Posted: Sat Aug 25, 2007 1:45 am Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
How do u ppls know how to use tangent and stuff. I dont understand any of that. |
|
|
|
|
![](images/spacer.gif) |
Nick
![](http://compsci.ca/v3/uploads/user_avatars/19644337547e837b41d67a.png)
|
Posted: Sat Aug 25, 2007 7:52 am Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
you learn in math... i think gr 11 advanced or gr 12 |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Sat Aug 25, 2007 8:59 am Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
@momop, your avatar is too large, please resize it to something smaller.
@rizzix, he's probably the one using 4.1, I'm using 4.0.5
@Prince Pwn, Grade 10 math you start to learn trig... at least... you should have ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Sat Aug 25, 2007 9:32 am Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
I have turing 4.0.3. |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Sat Aug 25, 2007 9:37 am Post subject: RE:Integer overflow problem with turing\'s trig functions. |
|
|
But that's good enough. Trig really isn't that hard. It's not hard to go further than what they teach you either. I'm going into grade 11. |
|
|
|
|
![](images/spacer.gif) |
|