Unfortunately, due to network issues, we are forced to reschedule the round. Let's do it in the coming days. Apologize. ×

TranThuyLuc's blog

By TranThuyLuc, 6 years ago, In English

In many contest problems in Codeforces where the results require float point number, there is often something like this:

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

However, the normal way to check whether two float point numbers are equal is something like this:

const double EPS = 1e-9;

bool isEqual(double x, double y){
    return abs(x - y) < EPS;

Is the way Codeforces use more precise? Should I use this way for comparing float point numbers instead of the normal way?

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it