JasonMendoza2008's blog

By JasonMendoza2008, history, 6 hours ago, In English

Consider this code:

#include <stdio.h>
#include <float.h>

int main() {
    double a = 100.0;
    printf("a: %.6lf\n", a);
    return 0;
}

It should print 100.000000 right? It does on https://www.onlinegdb.com/online_c_compiler, it does on my local computer. But on codeforces: https://i.imgur.com/P2CCY7Q.png

I'm more of a Python user so maybe I'm missing something big and it's actually not a bug?

Tags gcc, bug
»
6 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

i dont know why but seems lf in codeforces is for long double, and f is for double.

»
6 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

I can reproduce. Don't know the exact reason but gcc 5.1 is very old (April 22, 2015), don't use it unless you have a specific reason. For g++6.4 and above look expected.

  • »
    »
    6 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ah, didn't know you could use g++ for C lol but I guess C++ is a superset of C so it makes sense?