Skip to main content
Another 2 bytes saved thanks to ceilingcat
Source Link
G. Sliepen
  • 1.3k
  • 9
  • 16

C (clang), 129 123 121 120120 118 bytes (117115 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+(!!~i--),y=n/z);puts("");}

Try it online!Try it online!

7 88 10 bytes shaved off thanks to ceilingcat!

C (clang), 129 123 121 120 bytes (117 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+(!!~i--),y=n/z);puts("");}

Try it online!

7 8 bytes shaved off thanks to ceilingcat!

C (clang), 129 123 121 120 118 bytes (115 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+!!~i--,y=n/z);puts("");}

Try it online!

7 8 10 bytes shaved off thanks to ceilingcat!

Added ceilingcat's suggestion
Source Link
G. Sliepen
  • 1.3k
  • 9
  • 16

C (clang), 129 123 121121 120 bytes (118117 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+(-i!!~i--!=1),y=n/z);puts("");}

Try it online!Try it online!

77 8 bytes shaved off thanks to ceilingcat!

C (clang), 129 123 121 bytes (118 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+(-i--!=1),y=n/z);puts("");}

Try it online!

7 bytes shaved off thanks to ceilingcat!

C (clang), 129 123 121 120 bytes (117 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+(!!~i--),y=n/z);puts("");}

Try it online!

7 8 bytes shaved off thanks to ceilingcat!

added 6 characters in body
Source Link
G. Sliepen
  • 1.3k
  • 9
  • 16

C (clang), 129 123123 121 bytes (120118 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);i>=-l;n=fmod;~i<l;n=fmod(n,z))z=pow(b,i),printf("%d%s"".%d"+(-i--!=1),y=n/z,!!i--+".");puts("");}

Try it online!Try it online!

67 bytes shaved off thanks to ceilingcat!

C (clang), 129 123 bytes (120 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);i>=-l;n=fmod(n,z))z=pow(b,i),printf("%d%s",y=n/z,!!i--+".");puts("");}

Try it online!

6 bytes shaved off thanks to ceilingcat!

C (clang), 129 123 121 bytes (118 + -lm compiler flag)

f(n,b,l,i,y,z)double n,b,l,z;{for(i=log(n)/log(b);~i<l;n=fmod(n,z))z=pow(b,i),printf(".%d"+(-i--!=1),y=n/z);puts("");}

Try it online!

7 bytes shaved off thanks to ceilingcat!

added 55 characters in body
Source Link
G. Sliepen
  • 1.3k
  • 9
  • 16
Loading
Source Link
G. Sliepen
  • 1.3k
  • 9
  • 16
Loading