fabs()

Return the absolute value of an argument

Syntax

 fabs(argument)

Parameters

ParameterDefinition
argumentfloating point value whose absolute value is to be determined

Description

The fabs() function returns the absolute value of argument ; that is,

  • argument if argument ≥ 0
  • argument if argument < 0

Example

The following fabs() function prints the absolute value of -12.3456:

 print(fabs(-12.3456));
Was this page helpful? Yes No Submitting... Thank you

Comments