Home > Article > Backend Development > Detailed explanation of how to get the absolute value function in C#
This article mainly introduces the function that takes the absolute value in C#. Has very good reference value. Let’s take a look at it with the editor
Without further ado, please look at the code:
System.Math.Abs(float value); System.Math.Abs(decimal value); System.Math.Abs(int value); System.Math.Abs(double value); System.Math.Abs(sbyte value); System.Math.Abs(long value); System.Math.Abs(short value);
PS: Let’s take a look at the absolute value function in c++
int abs(int i) Returns the absolute value of the integer parameter i
double cabs(struct complex znum) Returns the absolute value of the complex number znum
double fabs(double x) Returns the absolute value of the double precision parameter x
long labs(long n) Returns the absolute value of the long integer parameter n
abs, labs, llabs, imaxabs - compute the absolute value of an integer.
SYNOPSIS
#include <stdlib.h> int abs(int j); long int labs(long int j); long long int llabs(long long int j); #include <inttypes.h> intmax_t imaxabs(intmax_t j);
The above is the detailed content of Detailed explanation of how to get the absolute value function in C#. For more information, please follow other related articles on the PHP Chinese website!