Meme of two women fighting while a man smokes from a pipe in the background.

The women fighting are labeled “mathematicians defining pi” and “engineers just using 3 because it’s within tolerance”

The man smoking is labeled “astrophysicists” and the pipe is labeled “pi = 1”

  • Fushuan [he/him]@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    1 day ago

    As they should, if that’s the only thing you are using it for, don’t introduce a whole header file, just put the following in the constants.h or equivalent that the proj for sure has:

    #define M_PI   3.14159265358979323846264338327950288
    

    Yes, it’s literally what math.h has defined.

    • zaphod@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 hours ago

      If I’m not completely mistaken M_PI is not part of the C standard, so depending on your stdlib or compiler or even compiler flags you will have to define it yourself even in C.