Skip to main content
added 1 character in body
Source Link

C (gcc), 108 102 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>=999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999i>=999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}

C (gcc), 108 102 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>=999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}

C (gcc), 108 102 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>=999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>=999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}
deleted 43 characters in body
Source Link

C (gcc), 108 102 101102 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>999i>=999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&1*(i<100)+(*a&i<100?i<10)?2:1:0,i,a);}

Try it online!Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&1*(i<100)+(*a&i<100?i<10)?2:1:0,i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&1*(i<100)+(*a&i<100?i<10)?2:1:0,i,a);}

Try it online!Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&1*(i<100)+(*a&i<100?i<10)?2:1:0,i,a);
}

C (gcc), 108 102 101 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);
}

C (gcc), 108 102 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>=999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&i<100?i<10?2:1:0,i,a);
}
deleted 43 characters in body
Source Link

C (gcc), 108 102102 101 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>=1e3i>999.5)i=ii/1024=1024,a-=2;printf("%.*f%.2sB",*a?2-*a&1*(inti<100)log10+(ii<10):0,i,a);}

Try it online!Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>=1e3i>999.5)
        i=ii/1024=1024,a-=2;
    printf("%.*f%.2sB",*a?2-*a&1*(inti<100)log10+(ii<10):0,i,a);
}

C (gcc), 108 101101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i=ii/1024=1024,a-=2;printf("%.*f%.2sB",*a?2-*a&1*(inti<100)log10+(ii<10):0,i,a);}

Try it online!Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i=ii/1024=1024,a-=2;
    printf("%.*f%.2sB",*a?2-*a&1*(inti<100)log10+(ii<10):0,i,a);
}

C (gcc), 108 102 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>=1e3)i=i/1024,a-=2;printf("%.*f%.2sB",*a?2-(int)log10(i):0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>=1e3)
        i=i/1024,a-=2;
    printf("%.*f%.2sB",*a?2-(int)log10(i):0,i,a);
}

C (gcc), 108 101 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i=i/1024,a-=2;printf("%.*f%.2sB",*a?2-(int)log10(i):0,i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i=i/1024,a-=2;
    printf("%.*f%.2sB",*a?2-(int)log10(i):0,i,a);
}

C (gcc), 108 102 101 bytes

Works as Yimin Rong suggests.

f(float i){char*a="GiMiKi"+6;while(i>999.5)i/=1024,a-=2;printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999.5)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);
}

C (gcc), 108 101 99 bytes

Works as O.O.Balance suggests.

f(float i){char*a="GiMiKi"+6;while(i>999)i/=1024,a-=2;printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);}

Try it online!

Unglofed

f(float i){
    char*a="GiMiKi"+6;
    while(i>999)
        i/=1024,a-=2;
    printf("%.*f%.2sB",*a&1*(i<100)+(i<10),i,a);
}
deleted 78 characters in body
Source Link
Loading
deleted 78 characters in body
Source Link
Loading
Source Link
Loading