Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: help spot t...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 9 Topic 4580 of 4728
Post > Topic >>

Re: help spot the error in this floating point code

by Tim Roberts <spamtrap@[EMAIL PROTECTED] > Mar 19, 2008 at 05:13 AM

Bin Xin  <spamtrap@[EMAIL PROTECTED]
> wrote:
>...
>  It's working to some extent.  For example the following code:
>>>>
>  printf("%.3f\n", my_pow(2.0, 35.3));
>
>  //... some other code
>
>  printf("%.3f\n", my_pow(2.0, 35.3));
><<<
>outputs:
>
>42301799935.756
>2.000
>
>In other words, the first invocation get the right results, but not
>the second one.  My intuition is that both log and pow are pure
>function, so this should not happen.  But then again, I have limited
>experience in FP coding at assembly level, so there might be some
>thing I overlooked.  Like maybe the special ways the FP registers or
>FP status register have to be manipulated.

I admit that I lost track part way through, but it looks to me like you
aren't cleaning up the floating point stack when you are done.  If you
leave stuff on the stack, sooner or later the stack will overflow (there
are only 8 entries, after all), which triggers floating point exceptions.
-- 
Tim Roberts, timr@[EMAIL PROTECTED]
 & Boekelheide, Inc.
 




 9 Posts in Topic:
help spot the error in this floating point code
Bin Xin <spamtrap@[EM  2008-03-18 15:26:40 
Re: help spot the error in this floating point code
Tim Roberts <spamtrap  2008-03-19 05:13:52 
Re: help spot the error in this floating point code
Terje Mathisen <spamt  2008-03-19 14:02:16 
Re: help spot the error in this floating point code
nbaker2328 <spamtrap@[  2008-03-18 23:08:55 
Re: help spot the error in this floating point code
Bin Xin <spamtrap@[EM  2008-04-16 15:23:00 
Re: help spot the error in this floating point code
"Wolfgang Kern"  2008-04-17 13:28:18 
Re: help spot the error in this floating point code
Jentje Goslinga <spam  2008-04-17 18:25:15 
Re: help spot the error in this floating point code
Bin Xin <spamtrap@[EM  2008-04-18 13:47:00 
Re: help spot the error in this floating point code
Jentje Goslinga <spam  2008-04-18 19:08:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 0:23:51 CDT 2008.