 # How to calculate sine

How to calculate the sine of 1? like sin(1)

You might want to try out the Numerics package (particularly the Real module).

(Although sin(1) is statically known, so you might as well just replace it with the actual value).

1 Like

thanx! but i cant find the way to calculate it anyway. i just started to learn swift and i got a task to improve my skills in google solutions of tasks we have not yet studied. so i have to find the sine of 1 using Swift. i found how to calculate sine of 90 degrees but i cant find how to calculate sine of 1

and should i also import smth before calculating sine of 1?

The Standard Library (which is the one you implicitly use when working with arrays, calling `print` etc.) does not provide its own trigonometric functions, so yes, you would need to download and install a package for that. If you don't know how to do this, you can learn it here. Then you will be able to import it.

1 Like

You can alternatively use the one provided in `Foundation`:

``````import Foundation

sin(1.0)  // returns 0.8414709848078965
``````
5 Likes

yeeeeeeees !!!!! it worked!!! thanx!!!

Even though you got an answer now, I would encourage you to actually spend at least an hour or two trying to research these things for yourself instead of asking others. Especially if the assignment is explicitly about googling things. Being able to find solutions in areas you're not closely familiar with is (imo) one of if not the most important skill a programmer can have, and you won't get better without actually doing it.

1 Like

thanx for advise. i spend a lot of time to find solution, but failed. i thought that to find the answer on a forum is the same thing as googling. but i guess now you are right, i have to google better