Talk:International Obfuscated C Code Contest: Difference between revisions
Line 22: | Line 22: | ||
Now, run "./r2", the result is "3.141". |
Now, run "./r2", the result is "3.141". |
||
--[[User:Vspaceg|Vspaceg]] 17:27, 22 November 2006 (UTC) |
--[[User:Vspaceg|Vspaceg]] 17:27, 22 November 2006 (UTC) |
||
Interpretation of the program: |
|||
Each first "_" decrement F and OO. Each "-_" decrement only F. |
|||
At the end of "FF_OO" procedure, F contains minus the aproximation of an area of a circle. OO contains le diameter. |
|||
The area of a circle is pi * square of radius, so pi = area / (diameter / 2)² = 4 * area / diameter / diameter . |
|||
Pi is aproximated by "4. * -F / OO / OO" . |
|||
--[[User:Vspaceg|Vspaceg]] 17:43, 22 November 2006 (UTC) |
Revision as of 17:43, 22 November 2006
Visual Studio
Article says:
- (most notably the otherwise very stable Visual Studio)
I don't want to unlaterally make this edit since it seems POV, but this parenthetical remark is problematic to me. I belive "otherwise very stable" is just factually incorrect; visual C++ (which is what the author must be referring to here, since visual studio is not a compiler) has a large number of known bugs (one could see the workarounds in [boost] for examples). These are mostly in the C++ support, to be fair. Removing "otherwise very stable" makes this a dig against VC++, which I think is POV unless there is some way to verify that this compiler dies the most. Perhaps removing the whole parenthetical is the best move. Brighterorange 05:45, 22 Jun 2005 (UTC)
- I agree. I've re-written to be NPOV and explain itself a bit better. -- Jon Dowland 30 June 2005 15:03 (UTC)reqallt u have done well
Notable Contributions
- Worst abuse of the rules. In several years...
This entry is poorly written. I'd correct it myself, but I'm not sure exactly what it's trying to say. Could someone who knows what this is referring to edit it? 01:25, 28 June 2006 (UTC)
Code doesn't work
By the way, if you compile the provided code (or even take it directly from the website itself), it doesn't appear to work. All i get for output is "0.250", which, unless there have been significant changes in mathematics in the past few years, is NOT equal to PI. -(Simulcra 17:34, 2 November 2006 (UTC))
- If I remember correctly, the approximation is not very accurate but gets better for larger circles. — brighterorange (talk) 18:58, 3 November 2006 (UTC)
* OK, I did find what is wrong: Actualy the programmer thinks "-_" is replaced by "--F<00||--F-OO--;". But gcc replace it by "- -F<00||--F-OO--;". If you name the source file "r.c", use this: "gcc -E r.c | sed 's/- -/--/g' > r2.c ; gcc -o r2 r2.c" Now, run "./r2", the result is "3.141". --Vspaceg 17:27, 22 November 2006 (UTC)
Interpretation of the program: Each first "_" decrement F and OO. Each "-_" decrement only F. At the end of "FF_OO" procedure, F contains minus the aproximation of an area of a circle. OO contains le diameter. The area of a circle is pi * square of radius, so pi = area / (diameter / 2)² = 4 * area / diameter / diameter . Pi is aproximated by "4. * -F / OO / OO" . --Vspaceg 17:43, 22 November 2006 (UTC)