当前位置:网站首页>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
边栏推荐
- 几道高频的JVM面试题
- Abstract classes and interfaces
- 图书管理系统小练习
- Comparison between FileInputStream and bufferedinputstream
- String类
- 抽象类和接口
- View UI plus released version 1.2.0 and added image, skeleton and typography components
- Shortest Hamilton path (pressure DP)
- Iterable、Collection、List 的常见方法签名以及含义
- Tyut Taiyuan University of technology 2022 introduction to software engineering
猜你喜欢

Cloud native trend in 2022

如何保障 MySQL 和 Redis 的数据一致性?

凡人修仙学指针-1

继承和多态(上)

架构师怎样绘制系统架构蓝图?

(ultra detailed onenet TCP protocol access) arduino+esp8266-01s access to the Internet of things platform, upload real-time data collection /tcp transparent transmission (and how to obtain and write L

Role movement in the first person perspective

几道高频的JVM面试题

Introduction and use of redis

The earth revolves around the sun
随机推荐
Sharing ideas of on-chip transplantation based on rtklib source code
图书管理系统小练习
View UI Plus 发布 1.1.0 版本,支持 SSR、支持 Nuxt、增加 TS 声明文件
架构师怎样绘制系统架构蓝图?
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
Error: sorting and subscript out of bounds
Alibaba cloud microservices (I) service registry Nacos, rest template and feign client
View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
View UI plus releases version 1.1.0, supports SSR, supports nuxt, and adds TS declaration files
[Topic terminator]
阿里云微服务(四) Service Mesh综述以及实例Istio
Record: solution of 404 error of servlet accessing database in dynamic web project
面渣逆袭:Redis连环五十二问,三万字+八十图详解。
Chromatic judgement bipartite graph
Inheritance and polymorphism (I)
Tyut outline of 2022 database examination of Taiyuan University of Technology
阿里云微服务(三)Sentinel开源流控熔断降级组件
Record: Navicat premium can't connect to MySQL for the first time
Arduino+ds18b20 temperature sensor (buzzer alarm) +lcd1602 display (IIC drive)
2022 National Games RE1 baby_ tree