# [C (gcc)], 108 bytes

<!-- language-all: lang-c -->

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

[Try it online!][TIO-jjbbl0v8]

[C (gcc)]: https://gcc.gnu.org/
[TIO-jjbbl0v8]: https://tio.run/##jVJBTsMwELzzCsuokt0mZe3asUPUInHhgPgBl8ht2pXSFLVFHKp@nRAnFMoBaX3Y3bFnpBnbIV2H0N5iE@r35Yrxw3GJu@mGt5Wo6l15ZChPYVPuWZhDMi7n/Alf8Bl58bHBeiVwkee5xDneKdAmmUxC8bbH5lgJPpqOq9FUHx55Eh50KrpdWe/WCgTKe0gwKSdZGsZaFud2W2Ij5OmGdetHr2DJ0gXjCQNZVKIrl6PXhsviP7KKZEUkGx3ZsZLoMWzH7xvNDEBvfuhEiTaDJHaSRIPyUTJ0qjGffTuLAzmN@smjqImMzZzvL@4yEVOBBwd2SHaZae9kjZk55Vz/Wr@AmNIb652D4SddIZpcg8ttbu0gv0K01Mo442eZ6b1fo7/yc/sZqrpcH9q03n4B "C (gcc) – Try It Online"

Ungolfed

<!-- language-all: lang-c -->

    f(float i){
        char c=0, *a="GiMiKi";
        while(i>999)
            i=i/1024, ++c;
        printf("%.*f%.2sB", c?2-(int)log10(i):0, i, a+6-c*2);
    }
Might be a way to get rid of c, currently it's only used for checking whether to print decimal places or not.