O'Reilly logo

OpenCL Parallel Programming Development Cookbook by Raymond Tay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using trigonometric functions

The trigonometric functions are very useful if you were in the computer graphics industry ,or you are writing a simulation program for weather forecasts, continued fractions, and so on. OpenCL provides the usual suspects when it comes to the trigonometry support with cos, acos, sin, asin, tan, atan, atanh (hyperbolic arc tangent), sinh (hyperbolic sine), and so on.

In this section, we will take a look at the popular trigonometric identity function:

sin2 + cos2 = 1

From the Pythagoras's theorem, we understood that a right-angled triangle with sides a,b,c and angle t at the vertex where a and c meet, cos(t) is by definition a/c, sin(t ) is by definition b/c, and so cos2(t) + sin2(t) = (a/c)2 + (b/c)2 when combined with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required