Languages
[Edit]
EN

C# / .NET - Math.Abs() method example

0 points
Created by:
Barmar
338

The Math.Abs() function returns the absolute value of a number. 

The absolute value of the number x denoted |x|, is the non-negative value of x without regard to its sign.

Popular usage examples:

1. Documentation

Edit
Syntax
Parametersvalue - decimaldouble, shortintlong, sbyte or float value (primitive value).
ResultThe absolute value calculated from the number (primitive value).
Description

Math.Abs() is a static method that takes only one parameter and returns absolute number parameter value. The absolute value of the number x denoted |x|, is the non-negative value of x without regard to its sign.

2. Math.Abs() custom implementation

Edit

References

Edit
  1. Absolute value - wikipedia
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

C# / .NET - Math object

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join