c++ comparing two floating point values

前端 未结 5 1296
陌清茗
陌清茗 2020-12-30 15:58

I\'m wondering what is the difference for comparing two double between this two manner :

double a1 = ...;
double a2 = ....;
  1. fabs(a1-a
5条回答
  •  再見小時候
    2020-12-30 16:10

    This article answers your question quite thoroughly, I think. You might want to skip ahead to the section "Epsilon comparisons".

提交回复
热议问题