I tried to convert into degrees and it doesn't work for anything.

This only works for sin 90, and when i say sin 180 it doesn't work

Label3.Text = Math.Sin(txtDisplay.Text * (Math.PI / 180))

# Convert sin, cos,tan in degree

Page 1 of 1## 9 Replies - 419 Views - Last Post: 13 December 2019 - 06:57 AM

##
**Replies To:** Convert sin, cos,tan in degree

### #2

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 01:29 PM

First - "txtDisplay.Text" should be converted to a number. .TEXT is a STRING not an number.

If you look at the documentation you'll see the input parameter is a double.

https://docs.microso...etframework-4.8

It would be in your best interest to turn on explicit and strict.

Tools -> options -> project & solutions -> vbdefaults

Option explicit -> on

option strict -> on.

If you look at the documentation you'll see the input parameter is a double.

https://docs.microso...etframework-4.8

It would be in your best interest to turn on explicit and strict.

Tools -> options -> project & solutions -> vbdefaults

Option explicit -> on

option strict -> on.

### #3

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 01:46 PM

I tried this and it's not working, I don't think this is good

Dim sinus As Double sinus = Double.Parse(txtDisplay.Text) sinus = Math.Sin(sinus * (Math.PI / 180)) txtDisplay.Text = System.Convert.ToString(sinus)

### #4

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 01:50 PM

Mkay.. so what is "txtDisplay" supposed to contain? Degrees or radians?

### #5

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 01:54 PM

Well I'm trying to make a calculator, so txtDisplay is a TextBox where I put a number, then hit the sin button and the answer to be in degrees.

For example, my problem is that when I introduce 90 and hit sin it gives me the output in radians and I need it in degrees, like sin 90 to be 1

For example, my problem is that when I introduce 90 and hit sin it gives me the output in radians and I need it in degrees, like sin 90 to be 1

### #6

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 02:02 PM

Look at your formula. Does that look right?

Doing the division first then the multiplication? Shouldn't that be the multiplication first then all of that divided by 180?

https://www.wikihow....rees-to-Radians

Order of operations matters.

sinus * (Math.PI / 180)

Doing the division first then the multiplication? Shouldn't that be the multiplication first then all of that divided by 180?

https://www.wikihow....rees-to-Radians

Order of operations matters.

### #7

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 02:08 PM

OH, right!

But then still does not work, and I just don't understand why because i converted it to calculate in degrees

But then still does not work, and I just don't understand why because i converted it to calculate in degrees

### #8

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 02:15 PM

If your input is in degrees, and you fixed you formula, then it should work.

sin 90 degrees -> 1 sin 45 degrees -> 0.707106781186547 sin 87 degrees -> 0.998629534754574

### #9

## Re: Convert sin, cos,tan in degree

Posted 11 December 2019 - 02:22 PM

For sin pi gives me 5.48311355616075E+19 and it should be 0

Oh sorry, the input it's in radians

Oh sorry, the input it's in radians

### #10

## Re: Convert sin, cos,tan in degree

Posted 13 December 2019 - 06:57 AM

Page 1 of 1