当前位置:网站首页>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 .
边栏推荐
- Redis installation test
- sql中的Exists用法
- Chapter 8 - two basic problems of data processing
- 剑指 Offer II 016. 不含重复字符的最长子字符串-滑动窗口
- 第四章-第一个程序
- [character set 6] wide string and multi byte character conversion
- 【无标题】Task3 多路召回
- RuntimeError:Input and parameter tensors are not at the same device, found input tensor at cuda:0 an
- The newline character with in the string is converted to an array
- 域名映射到指定IP
猜你喜欢
![(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit](/img/c1/d56ec09663857afa52f20848aeadac.png)
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit

Chapter 8 - two basic problems of data processing

Summary of common character sets

Filters and listeners

Background position - mixed units

Machine learning notes - circular neural network memo list

Can you migrate backwards before the first migration in the south- Can you migrate backwards to before the first migration in South?

Analysis of 43 cases of MATLAB neural network: Chapter 8 prediction of GRNN Network - Freight Volume Prediction Based on generalized regression neural network

2022 safety officer-c certificate special operation certificate examination question bank and simulation examination

Chapter 3 registers (memory access)
随机推荐
Tool classes for extracting zip files
node示例后台搭建
128. longest continuous sequence hash table
解决當打開Unity時 提示項目已經打開,而自己之前並沒有打開過(可能之前异常關閉)的問題
Grab screen and ground glass effect
Flink CheckPoint : Exceeded checkpoint tolerable failure threshold
Binary tree calculation problem
Counting haybales (difference + discretization)
ip、DNS、域名、URL、hosts
Minimum transfer times
Analysis of 43 cases of MATLAB neural network: Chapter 8 prediction of GRNN Network - Freight Volume Prediction Based on generalized regression neural network
(12) Interactive component selectable
Problems that cannot be resolved by tar command
torch. logical_ And() method
Meeting time (topology sorting +dp)
mySql学习记录——二、mySql建表命令
Introduction to Chang'an chain node certificate, role and authority management
(十五) TweenRunner
Top command meaning
MySQL - Import / export operation