zoukankan      html  css  js  c++  java
  • Set8087CW

    Set8087CW
    This example accesses the Floating Point Unit (FPU) control register. Try turning floating point exceptions off and on and dividing a number by zero to test it.
    Word Saved8087CW;
     
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      Edit3->Text = FloatToStr(StrToFloat(Edit1->Text) / StrToFloat(Edit2->Text));
    }
     
    void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
    {
      if (RadioGroup1->Items->Strings[RadioGroup1->ItemIndex] == "FPU Exceptions")
        System::Set8087CW(Saved8087CW);
      if (RadioGroup1->Items->Strings[RadioGroup1->ItemIndex] == "No FPU Exceptions")
        System::Set8087CW(0x133f); // Disable all fpu exceptions.
    }
     
    __fastcall TForm1::TForm1(TComponent* Owner)
      : TForm(Owner)
    {
      RadioGroup1->Items->Add("No FPU Exceptions");
      RadioGroup1->Items->Add("FPU Exceptions");
      RadioGroup1->ItemIndex = 2;
      Saved8087CW = Default8087CW;  // Save this, because Set8087CW changes it.
    }
     
    void __fastcall TForm1::FormDestroy(TObject *Sender)
    {
      System::Set8087CW(Saved8087CW); // Default value (with exceptions) is 0x1372.
    }
  • 相关阅读:
    铺地毯
    解方程
    引水入城
    10.16今日暂时停更博客
    聪明的质监员
    CCF NOI plus 201(7)6 初赛题 解题报告
    初赛可能会用到的计算机基础理论知识整理
    火柴排队
    借教室
    10.10今日暂时停更博客
  • 原文地址:https://www.cnblogs.com/cb168/p/4644013.html
Copyright © 2011-2022 走看看