Number.Cos

Number

Returns the cosine of an angle specified in radians.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Number.Cos(number as nullable number) as nullable number

Parameters

NameTypeRequiredDescription
numbernumberYesThe angle in radians.

Return Value

numberThe cosine of the angle in radians, in the range [-1, 1].

Remarks

Number.Cos returns the trigonometric cosine of an angle measured in radians. The result is always in the range [-1, 1]. This is a fundamental point of confusion: Power Query M (like most programming environments) uses radians, not degrees. To convert a degree value to radians before computing the cosine, multiply by Number.PI / 180.

The cosine function is even (cos(-x) = cos(x)) and periodic with period 2π. Key reference values: Number.Cos(0) = 1, Number.Cos(Number.PI / 2) ≈ 0 (not exactly 0 due to floating-point), Number.Cos(Number.PI) = -1. Due to floating-point representation, values like Number.Cos(60 * Number.PI / 180) may not be exactly 0.5 — expect results like 0.5000000000000001. Use Number.Round if you need a clean value for display.

Common uses in data transformation include rotating 2D coordinates, computing angular similarity between unit vectors, and implementing physics or geometry calculations in Power Query.

Examples

Example 1: Cosine of 0 radians

Result
Result
11

Example 2: Cosine of π radians (180 degrees) returns -1

Result
Result
1-1

Example 3: Convert degrees to radians then compute cosine

Number.Cos(60 * Number.PI / 180)
Result
Result
10.50

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks