Detailed explanation of how to get the absolute value function in C#

黄舟
Release: 2017-03-24 11:35:48
Original
9620 people have browsed it

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);
Copy after login

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template