Average Error: 0.3 → 0.2
Time: 1.4m
Precision: 64
\[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120\]
\[\frac{60}{z - t} \cdot \left(x - y\right) + 120 \cdot a\]
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\frac{60}{z - t} \cdot \left(x - y\right) + 120 \cdot a
double f(double x, double y, double z, double t, double a) {
        double r39086764 = 60.0;
        double r39086765 = x;
        double r39086766 = y;
        double r39086767 = r39086765 - r39086766;
        double r39086768 = r39086764 * r39086767;
        double r39086769 = z;
        double r39086770 = t;
        double r39086771 = r39086769 - r39086770;
        double r39086772 = r39086768 / r39086771;
        double r39086773 = a;
        double r39086774 = 120.0;
        double r39086775 = r39086773 * r39086774;
        double r39086776 = r39086772 + r39086775;
        return r39086776;
}

double f(double x, double y, double z, double t, double a) {
        double r39086777 = 60.0;
        double r39086778 = z;
        double r39086779 = t;
        double r39086780 = r39086778 - r39086779;
        double r39086781 = r39086777 / r39086780;
        double r39086782 = x;
        double r39086783 = y;
        double r39086784 = r39086782 - r39086783;
        double r39086785 = r39086781 * r39086784;
        double r39086786 = 120.0;
        double r39086787 = a;
        double r39086788 = r39086786 * r39086787;
        double r39086789 = r39086785 + r39086788;
        return r39086789;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.2
Herbie0.2
\[\frac{60}{\frac{z - t}{x - y}} + a \cdot 120\]

Derivation

  1. Initial program 0.3

    \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x - y}{z - t}, 60, 120 \cdot a\right)}\]
  3. Using strategy rm
  4. Applied clear-num0.2

    \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{z - t}{x - y}}}, 60, 120 \cdot a\right)\]
  5. Using strategy rm
  6. Applied fma-udef0.2

    \[\leadsto \color{blue}{\frac{1}{\frac{z - t}{x - y}} \cdot 60 + 120 \cdot a}\]
  7. Simplified0.2

    \[\leadsto \color{blue}{\frac{60}{z - t} \cdot \left(x - y\right)} + 120 \cdot a\]
  8. Final simplification0.2

    \[\leadsto \frac{60}{z - t} \cdot \left(x - y\right) + 120 \cdot a\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z t a)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, B"

  :herbie-target
  (+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0))

  (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))