Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

Cos Function

Class

System.Math

Syntax

Dim result As Double = Math.Cos (d)

d (required; Double)

An angle expressed in radians

Description

The Cos function returns the cosine of an angle, the ratio of the length of the side adjacent to the angle divided by the length of the hypotenuse, in the range of -1 to 1 inclusive.

Usage at a Glance

  • This is a shared member of the System.Math class, so it can be used without an instance.

  • To convert degrees to radians, multiply degrees by p/180.

  • To convert radians to degrees, multiply radians by 180/p.

Version Differences

In VB 6, Cos is an intrinsic VB function. In the .NET platform, it is a member of the System.Math class and not directly part of the VB language.

See Also

Cosh Function, Sin Function, Tan Function

Категории