Average Error: 24.7 → 12.1
Time: 6.0s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.128219015475836 \cdot 10^{-90} \lor \neg \left(a \le 6.27623202358413759 \cdot 10^{-6}\right):\\ \;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -1.128219015475836 \cdot 10^{-90} \lor \neg \left(a \le 6.27623202358413759 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}\\

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((a <= -1.128219015475836e-90) || !(a <= 6.276232023584138e-06))) {
		VAR = ((double) (((double) (((double) (t - x)) * ((double) (((double) (y - z)) / ((double) (a - z)))))) + x));
	} else {
		VAR = ((double) (((double) (((double) (((double) (x * y)) / z)) + t)) - ((double) (((double) (t * y)) / z))));
	}
	return VAR;
}

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

Original24.7
Target12.0
Herbie12.1
\[\begin{array}{l} \mathbf{if}\;z \lt -1.25361310560950359 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.44670236911381103 \cdot 10^{64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -1.128219015475836e-90 or 6.276232023584138e-06 < a

    1. Initial program 22.9

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Simplified7.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef7.5

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right) + x}\]
    5. Using strategy rm
    6. Applied clear-num7.7

      \[\leadsto \color{blue}{\frac{1}{\frac{a - z}{y - z}}} \cdot \left(t - x\right) + x\]
    7. Applied associate-*l/7.6

      \[\leadsto \color{blue}{\frac{1 \cdot \left(t - x\right)}{\frac{a - z}{y - z}}} + x\]
    8. Simplified7.6

      \[\leadsto \frac{\color{blue}{t - x}}{\frac{a - z}{y - z}} + x\]
    9. Using strategy rm
    10. Applied clear-num7.7

      \[\leadsto \frac{t - x}{\color{blue}{\frac{1}{\frac{y - z}{a - z}}}} + x\]
    11. Applied associate-/r/7.5

      \[\leadsto \color{blue}{\frac{t - x}{1} \cdot \frac{y - z}{a - z}} + x\]
    12. Simplified7.5

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

    if -1.128219015475836e-90 < a < 6.276232023584138e-06

    1. Initial program 27.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef19.1

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right) + x}\]
    5. Taylor expanded around inf 19.9

      \[\leadsto \color{blue}{\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification12.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.128219015475836 \cdot 10^{-90} \lor \neg \left(a \le 6.27623202358413759 \cdot 10^{-6}\right):\\ \;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020114 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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