Hello,
When I use the Math.Cos and Math.Sin function I get wrong result because it get the value as 0,1 instead of 0.1.
Here is an example
14,9896229 * sin(0,525) = 14
14,9896229 * cos(0,525) = 0
(those values are imputed automatically)
BUT
14.9896229 * sin (0.525) = 12,970879571269 5
14.9896229 * cos(0.525) = 7,5129939326361 7
(those values I edited then manually while running the program)
Here is my code :
Note: I changed the decimal, interger, single and may more ... I get the same result ...
Note2: I use Visual Basic from Visual Studio 2008
Note3: I need results like the second example
Can some help me ?
Thank you
When I use the Math.Cos and Math.Sin function I get wrong result because it get the value as 0,1 instead of 0.1.
Here is an example
14,9896229 * sin(0,525) = 14
14,9896229 * cos(0,525) = 0
(those values are imputed automatically)
BUT
14.9896229 * sin (0.525) = 12,970879571269 5
14.9896229 * cos(0.525) = 7,5129939326361 7
(those values I edited then manually while running the program)
Here is my code :
Code:
Public Class AdUL
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles TextBox1.TextChanged
TextBox3.Text = Val(TextBox1.Text) * 299792458 * 0.00000001
TextBox4.Text = Val(TextBox2.Text) * (Math.PI / 180)
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles TextBox2.TextChanged
TextBox3.Text = Val(TextBox1.Text) * 299792458 * 0.00000001
TextBox4.Text = Val(TextBox2.Text) * (Math.PI / 180)
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles TextBox3.TextChanged
Dim R As Decimal = Val(TextBox3.Text)
Dim a As Decimal = Val(TextBox4.Text)
TextBox5.Text = R * Math.Cos(a)
TextBox6.Text = R * Math.Sin(a)
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles TextBox4.TextChanged
Dim R As Decimal = Val(TextBox3.Text)
Dim a As Decimal = Val(TextBox4.Text)
TextBox5.Text = R * Math.Cos(a)
TextBox6.Text = R * Math.Sin(a)
End Sub
End Class
Note2: I use Visual Basic from Visual Studio 2008
Note3: I need results like the second example
Can some help me ?
Thank you
Comment