BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Side effects of FPU flags

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Kiriakos
Guest





PostPosted: Wed Oct 05, 2005 2:24 am    Post subject: Side effects of FPU flags Reply with quote



I found the following routine In an article
(http://www.axiworld.be/vst_vcl.html) that solved a problem I had in loading
certain Python modules in delphi using PythongForDelphi
([url]www.mmm-experts.com)[/url].

procedure SecureFpu;

begin

Set8087CW(Default8087CW or $3F);

end;

Would anyone know whether there would be any undesired side-effects from
doing this?


Back to top
John Herbster
Guest





PostPosted: Wed Oct 05, 2005 3:00 am    Post subject: Re: Side effects of FPU flags Reply with quote




"Kiriakos" <kvlahos (AT) london (DOT) edu> wrote
Quote:
I found the following routine In an article
(http://www.axiworld.be/vst_vcl.html)
that solved a problem I had in loading certain
Python modules in delphi using PythonForDelphi
([url]www.mmm-experts.com)[/url].

procedure SecureFpu;
begin
Set8087CW(Default8087CW or $3F);
end;

Would anyone know whether there would be
any undesired side-effects from doing this?

That masks-off all exceptions from the FPU for the thread
that executes it. The usual problem is that the programmer
forgets to take care that the FPU control word gets reset to
the default setting when the problem code is finished
executing, which can allow any pending exceptions pop up at
inappropriate times, such as when doing a "trunc" operation.

I would put the problem section of code within a
Try-Finally-End block as follows.

Set8087CW(Default8087CW or $3F);
Try
... section of problem code ...
Finally
Set8087CW(Default8087CW);
End;

If you are using D5 are earlier, let me know;
there may be one more thing required.

Regards, JohnH

Back to top
Kiriakos
Guest





PostPosted: Wed Oct 05, 2005 8:17 pm    Post subject: Re: Side effects of FPU flags Reply with quote



Thanks for your help...


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.