💾 Archived View for thrig.me › blog › 2023 › 11 › 04 › float-sqrt.c captured on 2024-12-17 at 11:26:53.
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
#include <stdio.h> int main(void) { float x = 2.0; float y = 5.0; asm("fld %1\n\t" "fld %2\n\t" "fxch\n\t" // swap "fsubp\n\t" // subtract and pop "fstp %0\n" // halt FPU and store result : "=m"(x) // output (%0) : "m"(x), "m"(y) // input (%1, %2) ); fprintf(stderr, "%.4f\n", x); }