当前位置:网站首页>Floating point comparison, CMP, tabulation ideas
Floating point comparison, CMP, tabulation ideas
2022-07-06 13:21:00 【Rivers overflow】
Floating point comparison
Core part code
cosnt double eps=1e-8;
const double pi=acos(-1.0);
#define Equ(a,b) ((fabs((a)-(b)))<(eps))
#define More(a,b) (((a)-(b))>(eps))
#define Less(a,b) (((a)-(b))<(-eps))
#define MoreEqu(a,b) (((a)-(b))>(-eps))
#define LessEqu(a,b) (((a)-(b))<(eps))
Be careful !abs And fabs
sort Functional cmp
bool cmp(node a,node b)
{
return a.score<b.score;// Represents the order from small to large
}
The meter
① Calculate all the results needed in the program at one time , For example, the first few values of fiboracci sequence are directly filled into the array and directly queried
② In procedure b Calculate all the results needed in one or more times , Manually write the results in the program A In the array , And so on
③ Violence is a small-scale result , Looking for a regular
边栏推荐
- View UI plus released version 1.2.0 and added image, skeleton and typography components
- arduino+水位传感器+led显示+蜂鸣器报警
- Record: newinstance() obsolete replacement method
- First acquaintance with C language (Part 1)
- Arduino+ds18b20 temperature sensor (buzzer alarm) +lcd1602 display (IIC drive)
- 十分钟彻底掌握缓存击穿、缓存穿透、缓存雪崩
- Tyut Taiyuan University of technology 2022 "Mao Gai" must be recited
- Set container
- 学编程的八大电脑操作,总有一款你不会
- Common method signatures and meanings of Iterable, collection and list
猜你喜欢
Questions and answers of "basic experiment" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
Abstract classes and interfaces
3.C语言用代数余子式计算行列式
Database operation of tyut Taiyuan University of technology 2022 database
Experience summary of autumn recruitment of state-owned enterprises
Edit distance (multi-source BFS)
Inheritance and polymorphism (Part 2)
121道分布式面试题和答案
如何保障 MySQL 和 Redis 的数据一致性?
IPv6 experiment
随机推荐
凡人修仙学指针-1
Sharing ideas of on-chip transplantation based on rtklib source code
vector
Fairygui bar subfamily (scroll bar, slider, progress bar)
Network layer 7 protocol
Share a website to improve your Aesthetics
Common method signatures and meanings of Iterable, collection and list
TYUT太原理工大学2022数据库之关系代数小题
FileInputStream和BufferedInputStream的比较
TYUT太原理工大学2022数据库题库选择题总结
How to ensure data consistency between MySQL and redis?
First acquaintance with C language (Part 2)
Role movement in the first person perspective
TYUT太原理工大学2022软工导论大题汇总
(超详细二)onenet数据可视化详解,如何用截取数据流绘图
Employment of cashier [differential constraint]
抽象类和接口
最新坦克大战2022-全程开发笔记-3
9.指针(上)
MYSQL索引钟B-TREE ,B+TREE ,HASH索引之间的区别和应用场景