How to Fetch Absolute Value Function in C

  • 2021-12-12 05:24:38
  • OfStack

Without saying much, 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 look at the c + + Absolute Value Function

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);

Related articles: