Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Cos

Cos( <nAngle> ) --> nRet

Calculates an angle cosine in radians.

CosAdvPL
01 · OVERVIEW

Overview

Cos accepts radians; convert degree input first. For calculations near zero or other limits, define an appropriate tolerance instead of relying on text representation or exact equality between computed values. Documentation warns about precision loss for very large angles. The example uses zero for a simple deterministic check. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

Cos( <nAngle> ) --> nRet

Parameters

nAngle
NumericRequired

Angle in radians.

Return value

Numeric cosine value.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed316()
    // Zero radians equals zero degrees.
    ConOut(cValToChar(Cos(0)))
Return Nil
Expected result

Expected result: 1. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Document input units and test calculation tolerance. Do not interpret Cos(90) as the cosine of 90 degrees.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Cos. TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha