Average Error: 11.8 → 2.7
Time: 6.0s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z} \]
\[\begin{array}{l} t_1 := \frac{z}{t - z}\\ \mathbf{if}\;x \leq -1.1573558099256976 \cdot 10^{-117}:\\ \;\;\;\;y \cdot \frac{x}{t - z} - x \cdot t_1\\ \mathbf{elif}\;x \leq 563.0956741630507:\\ \;\;\;\;\frac{x \cdot \left(z - y\right)}{z - t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{t - z} - t_1\right)\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ z (- t z))))
   (if (<= x -1.1573558099256976e-117)
     (- (* y (/ x (- t z))) (* x t_1))
     (if (<= x 563.0956741630507)
       (/ (* x (- z y)) (- z t))
       (* x (- (/ y (- t z)) t_1))))))
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 t_1 = z / (t - z);
	double tmp;
	if (x <= -1.1573558099256976e-117) {
		tmp = (y * (x / (t - z))) - (x * t_1);
	} else if (x <= 563.0956741630507) {
		tmp = (x * (z - y)) / (z - t);
	} else {
		tmp = x * ((y / (t - z)) - t_1);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * (y - z)) / (t - z)
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = z / (t - z)
    if (x <= (-1.1573558099256976d-117)) then
        tmp = (y * (x / (t - z))) - (x * t_1)
    else if (x <= 563.0956741630507d0) then
        tmp = (x * (z - y)) / (z - t)
    else
        tmp = x * ((y / (t - z)) - t_1)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return (x * (y - z)) / (t - z);
}
public static double code(double x, double y, double z, double t) {
	double t_1 = z / (t - z);
	double tmp;
	if (x <= -1.1573558099256976e-117) {
		tmp = (y * (x / (t - z))) - (x * t_1);
	} else if (x <= 563.0956741630507) {
		tmp = (x * (z - y)) / (z - t);
	} else {
		tmp = x * ((y / (t - z)) - t_1);
	}
	return tmp;
}
def code(x, y, z, t):
	return (x * (y - z)) / (t - z)
def code(x, y, z, t):
	t_1 = z / (t - z)
	tmp = 0
	if x <= -1.1573558099256976e-117:
		tmp = (y * (x / (t - z))) - (x * t_1)
	elif x <= 563.0956741630507:
		tmp = (x * (z - y)) / (z - t)
	else:
		tmp = x * ((y / (t - z)) - t_1)
	return tmp
function code(x, y, z, t)
	return Float64(Float64(x * Float64(y - z)) / Float64(t - z))
end
function code(x, y, z, t)
	t_1 = Float64(z / Float64(t - z))
	tmp = 0.0
	if (x <= -1.1573558099256976e-117)
		tmp = Float64(Float64(y * Float64(x / Float64(t - z))) - Float64(x * t_1));
	elseif (x <= 563.0956741630507)
		tmp = Float64(Float64(x * Float64(z - y)) / Float64(z - t));
	else
		tmp = Float64(x * Float64(Float64(y / Float64(t - z)) - t_1));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x * (y - z)) / (t - z);
end
function tmp_2 = code(x, y, z, t)
	t_1 = z / (t - z);
	tmp = 0.0;
	if (x <= -1.1573558099256976e-117)
		tmp = (y * (x / (t - z))) - (x * t_1);
	elseif (x <= 563.0956741630507)
		tmp = (x * (z - y)) / (z - t);
	else
		tmp = x * ((y / (t - z)) - t_1);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1573558099256976e-117], N[(N[(y * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 563.0956741630507], N[(N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
t_1 := \frac{z}{t - z}\\
\mathbf{if}\;x \leq -1.1573558099256976 \cdot 10^{-117}:\\
\;\;\;\;y \cdot \frac{x}{t - z} - x \cdot t_1\\

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

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


\end{array}

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.8
Target2.3
Herbie2.7
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation

  1. Split input into 3 regimes
  2. if x < -1.1573558099256976e-117

    1. Initial program 16.7

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Simplified1.7

      \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Taylor expanded in x around 0 16.7

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
    5. Applied egg-rr4.8

      \[\leadsto \color{blue}{y \cdot \frac{x}{t - z} + \left(-z\right) \cdot \frac{x}{t - z}} \]
    6. Taylor expanded in x around 0 15.5

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

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

    if -1.1573558099256976e-117 < x < 563.0956741630507

    1. Initial program 2.5

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Simplified2.7

      \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Taylor expanded in x around 0 2.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
    5. Applied egg-rr2.6

      \[\leadsto \color{blue}{\frac{1}{t - z} \cdot \frac{x}{\frac{1}{y - z}}} \]
    6. Applied egg-rr2.5

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

    if 563.0956741630507 < x

    1. Initial program 22.5

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Simplified2.4

      \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Taylor expanded in x around 0 22.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
    5. Applied egg-rr2.9

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

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

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

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

Reproduce

herbie shell --seed 2022153 
(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)))