Documentation for ABS function is confusing


On page

It says the ABS function will return:

x: if x is greater than or equal to 0.

-x: if x is less than 0.

This is a bit unclear! Now, I realise that if x is negative, then -x is positive, but not everyone will so this is a bit too confusing.

Why not simply say:

The abs(x) function returns the absolute value of x, that is to say it returns x without the sign.

and provide some examples :

x= 4.5 returns 4.5
x= -3.2 returns 3.2
x= 0 returns 0

Hope that can be updated. :slight_smile:

Warmest regards,


Well firstly, your chance of having anything in the tutorials/ references altered, is close to |x| = -(x2).

However the definition

x: if x is greater than or equal to 0.

-x: if x is less than 0.

is actually entirely accurate in terms of the function’s implementation.

You're not the first to (incorrectly IMO) report this one. ;)


bcraigie: Hope that can be updated. :-)

Create an issue here...


Fork the repository...

Change abs.adoc...

Commit the change. Create a pull request.

Thanks Coding Badly, I shall follow your instructions. :-)

Re: AWOL, how can it be incorrect to want to clarify or improve the documentation? :-)

Thanks everyone.

Warmest wishes,