Topic: Sine of angle

What is wrong?
Edit2 is angle, edit1 should be sinus of this angle.
     

 procedure Form1_Edit2_OnChange (Sender: TObject);
begin
       form1.edit1.value :=   SIN(form1.edit2.value*PI/180 ) ;   
end;

Re: Sine of angle

Hello markOS

Can this help you ?

A simple example of code that needs the MATH unit:
: Enter degrees, minutes and seconds of an angle in 3 edit boxes, and display the sine and the cosine of the angle. Of course, in real life you have to do some error checking on what is entered into the TEdit boxes.

: procedure TForm1.btnCalculateClick(Sender: TObject);
: var
: Deg, Min, Sec: integer;
: D, R, S, C: real;
: begin
: Deg := StrToInt(editDeg.Text);
: Min := StrToInt(editMin.Text);
: Sec := StrToInt(editSec.Text);
: D := Deg + Min / 60 + Sec / 3600; // degrees plus decimal fraction
: R := DegToRad(D); // convert degrees to radians
: S := Sin(R);
: C := Cos(R);
: labelDegDec.Caption := FloatToStr(D);
: labelRad.Caption := FloatToStr(R);
: labelSin.Caption := FloatToStr(S);
: labelCos.Caption := FloatToStr(C);
: end;

JB

3

Re: Sine of angle

Try it.

Post's attachments

Attachment icon SinofAngle.zip 335.28 kb, 281 downloads since 2020-07-02 

Re: Sine of angle

Thanks , NX,
It is simple and correct.
MarkoS