Skip to content

Instantly share code, notes, and snippets.

@crazymonkyyy
Last active May 18, 2024 06:25
Show Gist options
  • Save crazymonkyyy/7c182295828918bc161c53a9e66adccc to your computer and use it in GitHub Desktop.
Save crazymonkyyy/7c182295828918bc161c53a9e66adccc to your computer and use it in GitHub Desktop.
float lazyexo(byte i){
if(i==-128){return 0;}
if(i<0){return 1/lazyexo(cast(byte)-i);}
enum table1=[0.0,1.0/5,1.0/3,1.0/2];
enum table2=[1,2,5,10];
float frac=table1[i%4];
i/=4;
uint signif1=table2[i%4];
i/=4;
signif1<<=i*4;
return signif1+signif1*frac;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment