kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

fparith_float_neg.c (331B)


      1 /* Single-precision FNEG round-trip. volatile int input -> float, negate twice
      2  * so a real FNEG (single) is emitted. -(-42.0f) = 42.0f; (int)42.0f == 42. */
      3 int test_main(void) {
      4   volatile int ia = 42;
      5   float a = (float)ia;
      6   float r = -a; /* FNEG: -42.0f */
      7   float s = -r; /* FNEG: 42.0f  */
      8   return (int)s == 42 ? 42 : 0;
      9 }