kit

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

6_5_36_fp_arith.c (420B)


      1 /* FP arithmetic — addition, subtraction, multiplication, division on
      2  * `double`. Pre-kit this lowered through the integer BO_IADD path; the
      3  * parser now dispatches BO_FADD/FSUB/FMUL/FDIV when either operand is a
      4  * floating type. */
      5 int test_main(void) {
      6   double a = 100.0;
      7   double b = 4.0;
      8   double c = 3.0;
      9   /* (100 + 4) / 4 * 3 - 36 = 26*3 - 36 = 42 */
     10   double r = (a + b) / b * c - 36.0;
     11   return (int)r;
     12 }