SystemArcTan (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example shows how to use the ArcTan and FloatToStr functions to approximate pi.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Extended ex = 16 * ArcTan(1.0/5.0) - 4.0 * ArcTan(1.0/239.0); // Machin's formula
  String mystring = FloatToStr(ex);
  Edit2->Text = mystring;
}

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  Edit1->Text = "3.14159265358979";
}

Uses