Contact Us 1-800-596-4880

cos

cos(angle: Number): Number

Returns the trigonometric cosine of an angle from a given number of radians.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

angle

Number of radians in an angle.

Example

This example shows how cos behaves with different inputs.

Source

%dw 2.0
import * from dw::util::Math
output application/json
---
{
  "cos0": cos(0),
  "cos13": cos(0.13),
  "cos-1": cos(-1)
}

Output

{
  "cos0": 1.0,
  "cos13": 0.9915618937147881,
  "cos-1": 0.5403023058681398
}