Alright everyone...I managed to run into a logic error while trying to make a basic Trigonometric calculator...I'm honestly confused and currious to why this is happening.
I'm fairly new to trig and thought I'd toy around with it a bit
(I know VB.Net Isn't the best language for math 😝)
Heres the code:
and here's a screenshot:Spoiler (Click to View)
The error can be seen in the screenshot where the label says "tan θ = 0.110431526074847"
The tangent should by no means be 0.110431526074847, It should be 9.
If you have any advice (Other than "Don't do math in Vb.Net") I'd love to hear it.
I'm fairly new to trig and thought I'd toy around with it a bit
(I know VB.Net Isn't the best language for math 😝)
Heres the code:
PHP Code
<?php
Public Class Form1
Dim x, y, r, cos, cot, csc, sec, sin, tan As Double
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
x = Double.Parse(txt_X_value.Text)
y = Double.Parse(txt_Y_value.Text)
r = Math.Sqrt((x ^ 2) + (y ^ 2))
cos = x / r
cot = x / y
csc = r / y
sec = r / x
sin = y / r
tan = y / x
lb_cos.Text = cos.ToString
lb_cot.Text = cos.ToString
lb_csc.Text = csc.ToString
lb_r.Text = r.ToString
lb_sec.Text = sec.ToString
lb_sin.Text = sin.ToString
lb_tan.Text = sin.ToString
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click 'Clear Current Values Button
txt_X_value.Text = "0"
txt_Y_value.Text = "0"
lb_r.Text = "0"
lb_cos.Text = "0"
lb_cot.Text = "0"
lb_csc.Text = "0"
lb_sec.Text = "0"
lb_sin.Text = "0"
lb_tan.Text = "0"
End Sub
End Class
The error can be seen in the screenshot where the label says "tan θ = 0.110431526074847"
The tangent should by no means be 0.110431526074847, It should be 9.
If you have any advice (Other than "Don't do math in Vb.Net") I'd love to hear it.

![[Image: 839d5190672115b82f48153d2aebb493.png]](https://i.gyazo.com/839d5190672115b82f48153d2aebb493.png)
