cNum1First text number.
AdvPL GuideMathC(cNum1,cOperacao,cNum2) -> cResultPerforms arithmetic on numbers represented as strings.
MathC takes two text numbers and an operator: +, -, *, / or e for exponentiation. Its return is also text; documentation mentions up to 18 digits of precision. This is not the Match pattern-comparison function. Converting the result with Val may lose properties of its text representation. (Sources: refs. 1–1.)
MathC(cNum1,cOperacao,cNum2) -> cResultcNum1First text number.
cOperacaoArithmetic operator.
cNum2Second text number.
String containing the operation result.
#Include "Protheus.ch"
User Function Ed523()
Local cResult := MathC("12.5","+","2.5")
// The result remains a character string.
ConOut(cResult)
ConOut(ValType(cResult))
Return NilText value corresponding to 15 and type C; verify exact formatting in the runtime. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.