当前位置:网站首页>On absolute value function in C language
On absolute value function in C language
2022-06-12 09:05:00 【Record dada I】
Make a note of C Absolute value usage in language
First : The header file #include<math.h> Or is it #include<stdlib.h>
One :
about plastic Of ( namely int type ) use abs();
eg:
// I just type in the subject , Show me how to use it
The first one is : assignment
int a=-10;
int b;
b=abs(a);
// When we are calculating
The second kind : operation
int a=10,int b=-20;
if(a>abs(b))//
{
}
Two :
about floating-point That is to say (double perhaps float) use fabs()
// I just type in the subject , Show me how to use it
// assignment
double a=-20.5;
double b;
b= fabs(a);
// operation
double a=10.25,b=-10.5;
if(fabs(a)>fabs(b))
{
}
3、 ... and :
about Long plastic surgery Of ( namely long int type ) use labs();
eg:
// I just type in the subject , Show me how to use it
The first one is : assignment
long int a=-10;
long int b;
b=labs(a);
// When we are calculating
The second kind : operation
long int a=,long int b=;
if(labs(a)>labs(b))
{
}
notes :
1. When we use these absolute value functions , Be sure to pay attention to type definitions , Be sure to pay attention to the same type , Otherwise, it is easy to swallow the number after the decimal point .
2. Call the function to add the header file , As for the function of header file , Novice can search , Easy to understand the principle .
3.long int This type of long term , In the process of our study, we use less , A lot of math can be thrown into an array in the end .
There was a lot to say , Want to finish one piece , As a result, the thought was broken after writing , When you think about it, you should add .
You are welcome to comment if you have your own opinions , Learning together , Common progress .
边栏推荐
- [computer use] how to change a computer disk into a mobile disk?
- (js)三位用逗号隔开,保留两位小数(or 四舍五入取整)
- When the uniapp page jumps with complex data parameters.
- Analysis of 43 cases of MATLAB neural network: Chapter 7 regression of RBF Network -- Realization of nonlinear function regression
- Résoudre le problème de demander à l'élément d'être ouvert lorsque l'unit é est ouverte et que vous n'avez pas été ouvert auparavant (peut - être fermé anormalement auparavant)
- IDEA新版UI申请方法+无测试资格使用方法及相关介绍
- Jenkins Pipeline 语法
- The newline character with in the string is converted to an array
- (十五) TweenRunner
- IP, DNS, domain name, URL, hosts
猜你喜欢

List < string > sort

Filters and listeners

【字符集九】gbk拷贝到Unicode会乱码?

Background fixing effect
![[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function](/img/90/447d601a8c338cdd5a6674a2dc59ae.png)
[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function

node示例后台搭建

43 cas d'analyse du réseau neuronal MATLAB: chapitre 7 régression du réseau RBF - - réalisation de la régression fonctionnelle non linéaire

Flink CheckPoint : Exceeded checkpoint tolerable failure threshold

ERROR 1630 (42000): FUNCTION a.avg does not exist. Check the ‘Function Name Parsing and Resolution‘

利用nvm动态调整nodejs版本,解决因为node版本过高或过低导致项目无法运行和打包
随机推荐
Binlog in mysql:
第八章-数据处理的两个基本问题
(十二)交互组件Selectable
2022 safety officer-c certificate special operation certificate examination question bank and simulation examination
解压缩zip文件的工具类
Occupied occupied occupied occupied occupied
第四章-第一个程序
Tool classes for extracting zip files
Background location case II
MySQL learning records -- III. MySQL query statements
Chapter 7 - more flexible location of memory addresses
(14) Inputfield logic analysis
day5-x
Permutation (greedy strategy)
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit
【字符集七】汉字的宽字符码和多字节码分别是多少
Domain name mapping to specified IP
第五章-[bx]和Loop指令
第七章-更灵活定位内存地址
解决當打開Unity時 提示項目已經打開,而自己之前並沒有打開過(可能之前异常關閉)的問題