 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Kiriakos Guest
|
Posted: Wed Oct 05, 2005 2:24 am Post subject: Side effects of FPU flags |
|
|
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
|
Posted: Wed Oct 05, 2005 3:00 am Post subject: Re: Side effects of FPU flags |
|
|
"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
|
Posted: Wed Oct 05, 2005 8:17 pm Post subject: Re: Side effects of FPU flags |
|
|
Thanks for your help...
|
|
| Back to top |
|
 |
|
|
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
|
|