Delphi "invalid floating point operation." error Solution

Source: Internet
Author: User

In the past two days, I used webbrower to write things. Sometimes the "invalid floating point operation." error occurs when I open an SSL encrypted website. I searched the internet and pasted the solution.

 

Cause


In delphi2011, you must use the floating point unit control command to set the floating point operation unit. The floating point unit control command controls the precision of the floating point operation, the rounding method, and whether a specific floating point operation triggers an exception. For more information, see the Intel processor documentation.

In delphi2011, functions can directly access the control commands of the processor. For example, you can use the set8087cw function to change the value of the 8087cw control command, thus changing the floating point computing behavior of the program. Programmers need to reset the command at the end of the program.

 

 

Solution,To directly disable floating point exceptions, use the following method:
In delphi2011, when OpenGL is used for 3D rendering, we recommend that you use the set8087cw function to disable floating point exceptions. You can write set8087cw (0x133f) before calling the OpenGL function, for example, in the oncreate process of mainform)
Instance code:
1. Declare global variables to save the original 8087cw settings
VaR
Saved8087cw: word;
2. Change the value of 8087cw in the oncreate process of mainform. Save the default value before changing the value.
Saved8087cw: = default8087cw;
Set8087cw ($ 133f); {disable all FPU exceptions}
3. Before the program ends, use the default value to reset the 8087cw command value. In the onclose process of mainform
Set8087cw (saved8087cw );
4. note that if scenecontrol is used in the program. when loadsxfile loads a 3D file, you must call the clearlayers method of iscene to clear the layer before set8087cw when the program exits. Otherwise, an exception occurs when the program exits.
Reference code:
Scenecontrol1.scene. clearlayers;
Set8087cw (saved8087cw );
5. You also need to call the following statement before exiting the program.
(Coaoinitialize. Create as iaoinitialize). Shutdown

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.