Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

ACos

ACos( <nCos> ) --> nRet

Calculates the inverse cosine in radians.

ACosAdvPL
01 · OVERVIEW

Overview

ACos receives an angle cosine within -1 to 1 and returns an angle from zero to PI radians. Its input is not degrees. Documentation describes an undefined result outside the domain; validate input rather than depending on an infinity representation. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

ACos( <nCos> ) --> nRet

Parameters

nCos
NumericRequired

Cosine within the closed interval [-1, 1].

Return value

Numeric from 0 to PI, in radians.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function EdAcos()
    Local nCosine := 0
    // Check the domain before calculating.
    If nCosine >= -1 .And. nCosine <= 1
        ConOut(cValToChar(ACos(nCosine)))
    EndIf
Return Nil
Expected result

Expected result approximately 1.5707963268 radians, equivalent to 90 degrees. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Validate numeric type and domain. Clamp rounding drift at the boundaries only when the mathematical specification requires it.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. ACos. TDN. Accessed on 2026-10-25.
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