from Hacker News

Underscore Pi (2017)

by PortableCode on 5/1/18, 5:19 AM with 9 comments

  • by igravious on 5/1/18, 11:32 AM

    In all its glory:

       #define _ -F<00||--F-OO--;
       int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
       {
                   _-_-_-_
              _-_-_-_-_-_-_-_-_
           _-_-_-_-_-_-_-_-_-_-_-_
         _-_-_-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
         _-_-_-_-_-_-_-_-_-_-_-_-_-_
           _-_-_-_-_-_-_-_-_-_-_-_
               _-_-_-_-_-_-_-_
                   _-_-_-_
       }
    
    Fierce! Unhinged! Cromulent! Kickass!
  • by saagarjha on 5/1/18, 7:34 AM

    Unfortunately, this doesn't seem to work in Clang because it doesn't support the -traditional-cpp flag. Make sure that you're actually using GCC if you're following along!
  • by jerrre on 5/1/18, 2:08 PM

    > What would happen if you make the circle in the code bigger?

    More precision?

  • by swalladge on 5/1/18, 6:59 AM

  • by dang on 5/1/18, 6:55 AM

    We changed the title from "Underscore Pi – when M_PI from math.h is too mainstream; IOCCC winning entry".

    This is a fine HN submission, but please don't rewrite titles to editorialize!

    https://news.ycombinator.com/newsguidelines.html

  • by quietbritishjim on 5/1/18, 6:28 AM

    M_PI is not part of the C standard (it is part of Posix) so the title is awkward.