Home
Products
Community
Manuals
Contact
Login or Signup

BlitzMax Docs -> 2D - Category -> Basic -> Abs

Abs

Returns:

Nothing.

Description:

Numeric 'absolute value' unary operator

Example:

Rem
Abs is a mathematical operator that performs the Absolute function.
End Rem

For f#=-1 To 1 Step 0.125
	Print "Abs "+f+"="+Abs f
Next 

Comments

Nate the Great(Posted 1+ years ago)
I was just wondering... why does it say this was posted 2008 years ago??? Unless I am terribly mistaken... we didn't have internet back then... or electricity for that matter. :)

Oh... ok sorry


Plash(Posted 1+ years ago)
Please do not flood the manual pages with unnecessary posts. If you want to know please ask in the forums.

EDIT:
Oh... ok sorry
np :)


Arabia(Posted 1+ years ago)
I'm new to blitz and I'm sry if I am "flooding"

but you say it returns "nothing" - isn't it returning the absolute of the value passed to it? :S


Floyd(Posted 1+ years ago)
This is an oversight. Most of the documentation here is generated automatically from the source code in various modules.

But Abs() is not a function. It is an operator, built into the language. So there is no source code available.

Notice that Abs() returns a value of the same type as the argument passed to it. Here are the three most common. You can tell these apart by the decimal point and the number of digits displayed.

Print

OneI:Int = 1

OneF:Float = 1
OneD:Double = 1

Print Abs(oneI)

Print Abs(oneF)
Print Abs(oneD)


I've just checked Sin() and Floor() and found that they say 'nothing' is returned as well. So my explanation is flawed. However if you browse the module source you will see that the information given here is contained in the source. So Sin(), Floor() etc. just didn't get documented properly. But the relevant information is in there somewhere.


ProfJake(Posted 1+ years ago)
So there is not source code available.


The source code for the Abs operator as well as many others can be found in brl.mod/blitz.mod/blitz_cclib.c :)


BlitzMax Manual Forum

Blitz3D Equivalent Command