Average Error: 7.8 → 7.8
Time: 8.8s
Precision: binary64
Cost: 704
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\frac{x \cdot y}{a} - \frac{z \cdot t}{a}\]
\frac{x \cdot y - z \cdot t}{a}
\frac{x \cdot y}{a} - \frac{z \cdot t}{a}
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
(FPCore (x y z t a) :precision binary64 (- (/ (* x y) a) (/ (* z t) a)))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
double code(double x, double y, double z, double t, double a) {
	return ((x * y) / a) - ((z * t) / a);
}

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

Original7.8
Target6.0
Herbie7.8
\[\begin{array}{l} \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \end{array}\]

Alternatives

Alternative 1
Error7.8
Cost576
\[\frac{x \cdot y - z \cdot t}{a}\]
Alternative 2
Error20.4
Cost1994
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -1.3836986392095962 \cdot 10^{-71}:\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{elif}\;z \cdot t \leq 6.84225569191814 \cdot 10^{-63}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{elif}\;z \cdot t \leq 1.6121495039056051 \cdot 10^{+25} \lor \neg \left(z \cdot t \leq 2.229508210258736 \cdot 10^{+54}\right):\\ \;\;\;\;\frac{1}{\frac{-a}{z \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{a}\\ \end{array}\]
Alternative 3
Error20.4
Cost1930
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -1.016741672280776 \cdot 10^{-70}:\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{elif}\;z \cdot t \leq 8.354856988827411 \cdot 10^{-63}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{elif}\;z \cdot t \leq 1.7859101474820312 \cdot 10^{+25} \lor \neg \left(z \cdot t \leq 2.229508210258736 \cdot 10^{+54}\right):\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{a}\\ \end{array}\]
Alternative 4
Error20.3
Cost1930
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -2.8877901635419643 \cdot 10^{-66}:\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{elif}\;z \cdot t \leq 4.188131762273379 \cdot 10^{-63}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{elif}\;z \cdot t \leq 1.7859101474820312 \cdot 10^{+25} \lor \neg \left(z \cdot t \leq 2.229508210258736 \cdot 10^{+54}\right):\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y}}\\ \end{array}\]
Alternative 5
Error20.3
Cost1489
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -2.01153258471387 \cdot 10^{-61} \lor \neg \left(z \cdot t \leq 3.431831113818743 \cdot 10^{-63} \lor \neg \left(z \cdot t \leq 1.7859101474820312 \cdot 10^{+25}\right) \land z \cdot t \leq 2.229508210258736 \cdot 10^{+54}\right):\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \end{array}\]
Alternative 6
Error33.0
Cost320
\[\frac{x \cdot y}{a}\]
Alternative 7
Error57.7
Cost64
\[0\]
Alternative 8
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 7.8

    \[\frac{x \cdot y - z \cdot t}{a}\]
  2. Using strategy rm
  3. Applied div-sub_binary64_181567.8

    \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
  4. Simplified7.8

    \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
  5. Final simplification7.8

    \[\leadsto \frac{x \cdot y}{a} - \frac{z \cdot t}{a}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :herbie-target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

  (/ (- (* x y) (* z t)) a))