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 3 of 9 Topic 4580 of 4822
Post > Topic >>

Re: help spot the error in this floating point code

by Terje Mathisen <spamtrap@[EMAIL PROTECTED] > Mar 19, 2008 at 02:02 PM

Tim Roberts wrote:
> Bin Xin  <spamtrap@[EMAIL PROTECTED]
> wrote:
>>  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
[snip]
> 
> 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 is almost certainly right!

The easy way to check this is to call your my_pow() function in a loop, 
preferably while inside the debugger, and watch the x87 stack contents.

Anyway, if you're going to get rid of pow/log, do you still need full 
double precision results?

You can do lots of fun stuff with polynomial approximations. :-)

For a sw DX9/DX10 implementation I came up with ways to do this with 
sufficient precision that were one or two orders of magnitude faster 
than the x87 hw stuff.

Terje

-- 
- <Terje.Mathisen@[EMAIL PROTECTED]
>
"almost all programming can be viewed as an exercise in caching"
 




 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 Tue Oct 7 12:44:15 CDT 2008.