-
-
Save jeremy-rifkin/ff88fb38fae248d1f4d2874e599d6385 to your computer and use it in GitHub Desktop.
A program to print pi which has *absolutely no* UB whatsoever
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
char s[100000]; | |
prime(p,r,i,m,e) { | |
for(e=sizeof(s),r=e/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2*2; r<e>>1; r++) | |
for(i=r+r-r+r; i<e; i+=r) | |
s[+i]++; | |
for(m=(m=2,p=p^m,m=p^m,p=p^m,m); m+m+m+m; p++) | |
!s[p]&&m--; | |
return--p; | |
} | |
main(unsigned long long argc,...) { | |
argc=rand()/100/_Alignof(int)-prime(6322)*5|argc; | |
((typeof(main)*)(argc>>1<<1))("%lf",_Alignof(int)*((typeof(.0)(*)(typeof(.0)))((argc>>1<<1)-0x10))(argc&argc/argc),printf,atan); | |
} | |
// Works on ~~my machine~~ wandbox | |
// Probably will not work on your machine xD | |
// https://wandbox.org/permlink/kwtiCcRgW7n9m6Yw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment