Average Error: 11.5 → 2.0
Time: 3.3s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -3.2536737955449917 \cdot 10^{-177}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{elif}\;z \leq 1.1879064539926738 \cdot 10^{-141}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{t - z} - \frac{z}{t - z}\right)\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;z \leq -3.2536737955449917 \cdot 10^{-177}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\

\mathbf{elif}\;z \leq 1.1879064539926738 \cdot 10^{-141}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
 :precision binary64
 (if (<= z -3.2536737955449917e-177)
   (/ x (/ (- t z) (- y z)))
   (if (<= z 1.1879064539926738e-141)
     (* (- y z) (/ x (- t z)))
     (* x (- (/ y (- t z)) (/ z (- t z)))))))
double code(double x, double y, double z, double t) {
	return (x * (y - z)) / (t - z);
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -3.2536737955449917e-177) {
		tmp = x / ((t - z) / (y - z));
	} else if (z <= 1.1879064539926738e-141) {
		tmp = (y - z) * (x / (t - z));
	} else {
		tmp = x * ((y / (t - z)) - (z / (t - z)));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.5
Target2.0
Herbie2.0
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -3.2536737955449917e-177

    1. Initial program 12.9

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied associate-/l*_binary641.2

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]

    if -3.2536737955449917e-177 < z < 1.18790645399267382e-141

    1. Initial program 5.9

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary645.9

      \[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot \left(t - z\right)}}\]
    4. Applied times-frac_binary645.5

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y - z}{t - z}}\]
    5. Simplified5.5

      \[\leadsto \color{blue}{x} \cdot \frac{y - z}{t - z}\]
    6. Using strategy rm
    7. Applied div-sub_binary645.5

      \[\leadsto x \cdot \color{blue}{\left(\frac{y}{t - z} - \frac{z}{t - z}\right)}\]
    8. Using strategy rm
    9. Applied div-inv_binary645.5

      \[\leadsto x \cdot \left(\frac{y}{t - z} - \color{blue}{z \cdot \frac{1}{t - z}}\right)\]
    10. Applied div-inv_binary645.5

      \[\leadsto x \cdot \left(\color{blue}{y \cdot \frac{1}{t - z}} - z \cdot \frac{1}{t - z}\right)\]
    11. Applied distribute-rgt-out--_binary645.5

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{t - z} \cdot \left(y - z\right)\right)}\]
    12. Applied associate-*r*_binary645.5

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{t - z}\right) \cdot \left(y - z\right)}\]
    13. Simplified5.4

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

    if 1.18790645399267382e-141 < z

    1. Initial program 13.2

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6413.2

      \[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot \left(t - z\right)}}\]
    4. Applied times-frac_binary640.9

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y - z}{t - z}}\]
    5. Simplified0.9

      \[\leadsto \color{blue}{x} \cdot \frac{y - z}{t - z}\]
    6. Using strategy rm
    7. Applied div-sub_binary640.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.2536737955449917 \cdot 10^{-177}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{elif}\;z \leq 1.1879064539926738 \cdot 10^{-141}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{t - z} - \frac{z}{t - z}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020231 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (/ x (/ (- t z) (- y z)))

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