On Mon, 25 Feb 2019 17:08:50 -0000
"NY" wrote:
> "Ahem A Rivet's Shot" wrote in message
> news:20190225142618.6663a9845e7fe4eb9c60ad89@eircom.net...
> > On Mon, 25 Feb 2019 12:29:38 +0000
> > Richard Heathfield wrote:
> >
> >> Which is the saving grace of Piet. Piet programs can be rather
> >> attractive.
> >
> > This program is pretty ...
> >
> > #define _ -F<00||--F-OO--;
> > int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
> > {
> > _-_-_-_
> > _-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_-_-_-_-_
> > _-_-_-_-_-_-_-_
> > _-_-_-_
> > }
> >
> >
> > ... but far from readable.
>
> I haven't a hope in hell of working out what it's supposed to do, but
> when I compile and run it on my Pi it prints out "0.250". Mind you, it
> does generate loads of compiler warnings so I bet it's not doing what it
> was intended to do, even though it compiles.
It's in K&R C rather than ANSI C so it needs some fiddling with
compiler options to make it compile correctly on a modern system. It
calculates pi by measuring the area of the crude circle drawn in the source
code.
--
Steve O'Hara-Smith | Directable Mirror Arrays
C:\>WIN | A better way to focus the sun
The computer obeys and wins. | licences available see
You lose and Bill collects. | http://www.sohara.org/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|