256

Was helping somebody with a little C++ issue (disclaimer: I know jackshit about C++).
After a while off reading his code and opening a file called "pi.cpp", I noticed something odd...

This guy literally thought is was a good idea to put 81663 fucking decimals of pi in a #define statement :^)

On the screenshot, that weird "noise" on the right is actually a scrollbar of the code itself...

Comments
  • 55
    Holy mother of dev!
  • 38
    When would you need that kind of precision? I mean a double only has 11 bits of exponent. https://stackoverflow.com/questions...
  • 16
    @olback If only I knew...
  • 37
    @potluck you smoked too much pot :^)
  • 13
    Can you even store that many digits in a double?
  • 19
    Did he wrote them by hand?
  • 6
    @SpaceBearOne There is

    @potluck you're right if you need each of them one by one, but for calculations so many digits are useless... 10 decimal digits should be ok for a simple but accurate program... I think
  • 6
    @dmonkey 15-16 is about as accurate as you'll ever need.
    For most programs tho, 7-8 is more than plenty.
  • 6
    Reminds me of my high school physics course, where a class mate liking accuracy always put all decimals his calculator would give. My teacher went so far as to retract points, because the input data had less significant digits.
  • 1
    @ThreadRipper no
  • 3
    I do a lot of math while programming, use Pi all over but I've only ever needed it at double precision or lower, and usually can get away with just floating point.
  • 17
    You literally only need 39 digits to measure the observable universe. That's accurate enough to within a single hydrogen atom's width.

    This guy is just trying to show off now.
  • 6
    @iSwimInTheC what if you want to make measurements in the microscopic universe or even the quantum universe where thise digits of pi are more significant?

    All im saying is that there could be a valid arguments as to why it woulda
    be better to store the data rather than calculate it. Its the classic "calculation" vs "retrival time" methods of implementation. Each one can be better depending on the goals and implementations behind the code.
  • 6
    @bioDan shhhh don't give the guy an excuse to do what he's doing!
    😂
  • 2
    Oh myyyyy
  • 4
    Why not ask him about it? Maybe he had an out of the box idea for using it. Sometimes genius is indistinguishable from crazy. :p
  • 5
    @floatright he said he didn't want to have to calculate it on runtime xD
  • 2
  • 5
    At least he didn't try to calculate it every time he wanted to use pi
  • 6
    -even if you're doing some crazy space-time shit

    creds: Gregory and Leibniz
  • 3
    @beleg yep. But we are the ones who build those machines 😕
  • 3
    @bioDan exactly. We build machines, and machines compute pi to arbitrary precision.
  • 3
    Yes @beleg but when 20k users a day query your machine-on-a-cloud for a complicated calculation, calculating pi each time will be cpu intensive which will result in higher costs in terms of time and money.

    It would be more cost effective and potentially faster to store the value in the disk or db once, and in memory during run-time.

    Afterall it's not likely that the value of pi is gonna change anytime soon 😁
  • 4
    @bioDan but how can you be SURE, without calculating it every single time? Maybe some fundamental law of math suddenly gets patched/updated automatically by Windows 10 to a new version, and all your other math is off because you used a hardcoded value for pi... 🤡
  • 1
    What the actually fuck 😐
  • 1
  • 1
    FRIGGGINGG FRIGGG
    QUAAAAARAAAANTIIIIIINE
  • 2
    Trust me, just an arcane secret of sacred geometry just for summon some poop.
    *sarcasm*
    Yup, pardon the low-cursery-level.
  • 3
    Actually, you’re better of saving binary π, except if you are doing base 10 calculation
  • 1
    What the π!!
  • 1
    Oh boy, that’s gotta be rough to compile
  • 3
    Holy fucking Jesused jambled bananas in the ass
  • 0
    This is what happens when chemists learn to code.

    I kid you not. I worked with a guy that wanted 0.1 inch precision during testing on a system that an error of +/- 1 inch with an allowed error of 6 inches.. Fuck chemists.
Add Comment