Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A

Percentage Accurate: 98.1% → 98.1%
Time: 8.2s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + y \cdot \frac{z - t}{z - a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y * ((z - t) / (z - a)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + y \cdot \frac{z - t}{z - a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + y \cdot \frac{z - t}{z - a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y * ((z - t) / (z - a)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + y \cdot \frac{z - t}{z - a}
\end{array}

Alternative 1: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + y \cdot \frac{z - t}{z - a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y * ((z - t) / (z - a)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + y \cdot \frac{z - t}{z - a} \]
  2. Final simplification99.2%

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

Alternative 2: 76.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -850000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+83}:\\ \;\;\;\;x + \frac{y}{\frac{-z}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -850000.0)
   (+ x y)
   (if (<= z 1.58e-115)
     (+ x (* y (/ t a)))
     (if (<= z 4.6e+83) (+ x (/ y (/ (- z) t))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -850000.0) {
		tmp = x + y;
	} else if (z <= 1.58e-115) {
		tmp = x + (y * (t / a));
	} else if (z <= 4.6e+83) {
		tmp = x + (y / (-z / t));
	} else {
		tmp = x + y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z <= (-850000.0d0)) then
        tmp = x + y
    else if (z <= 1.58d-115) then
        tmp = x + (y * (t / a))
    else if (z <= 4.6d+83) then
        tmp = x + (y / (-z / t))
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -850000.0) {
		tmp = x + y;
	} else if (z <= 1.58e-115) {
		tmp = x + (y * (t / a));
	} else if (z <= 4.6e+83) {
		tmp = x + (y / (-z / t));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -850000.0:
		tmp = x + y
	elif z <= 1.58e-115:
		tmp = x + (y * (t / a))
	elif z <= 4.6e+83:
		tmp = x + (y / (-z / t))
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -850000.0)
		tmp = Float64(x + y);
	elseif (z <= 1.58e-115)
		tmp = Float64(x + Float64(y * Float64(t / a)));
	elseif (z <= 4.6e+83)
		tmp = Float64(x + Float64(y / Float64(Float64(-z) / t)));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -850000.0)
		tmp = x + y;
	elseif (z <= 1.58e-115)
		tmp = x + (y * (t / a));
	elseif (z <= 4.6e+83)
		tmp = x + (y / (-z / t));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -850000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+83], N[(x + N[(y / N[((-z) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -850000:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\

\mathbf{elif}\;z \leq 4.6 \cdot 10^{+83}:\\
\;\;\;\;x + \frac{y}{\frac{-z}{t}}\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.5e5 or 4.5999999999999999e83 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around inf 77.7%

      \[\leadsto \color{blue}{x + y} \]
    3. Step-by-step derivation
      1. +-commutative77.7%

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified77.7%

      \[\leadsto \color{blue}{y + x} \]

    if -8.5e5 < z < 1.58e-115

    1. Initial program 97.7%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around 0 89.0%

      \[\leadsto x + y \cdot \color{blue}{\frac{t}{a}} \]

    if 1.58e-115 < z < 4.5999999999999999e83

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in a around 0 74.8%

      \[\leadsto \color{blue}{x + \frac{y \cdot \left(z - t\right)}{z}} \]
    3. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{z} + x} \]
      2. associate-/l*76.7%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - t}}} + x \]
    4. Simplified76.7%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - t}} + x} \]
    5. Taylor expanded in z around 0 76.8%

      \[\leadsto \frac{y}{\color{blue}{-1 \cdot \frac{z}{t}}} + x \]
    6. Step-by-step derivation
      1. associate-*r/76.8%

        \[\leadsto \frac{y}{\color{blue}{\frac{-1 \cdot z}{t}}} + x \]
      2. neg-mul-176.8%

        \[\leadsto \frac{y}{\frac{\color{blue}{-z}}{t}} + x \]
    7. Simplified76.8%

      \[\leadsto \frac{y}{\color{blue}{\frac{-z}{t}}} + x \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -850000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+83}:\\ \;\;\;\;x + \frac{y}{\frac{-z}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 3: 76.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -800:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+88}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -800.0)
   (+ x y)
   (if (<= z 1.58e-115)
     (+ x (* y (/ t a)))
     (if (<= z 3.9e+88) (- x (* y (/ t z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -800.0) {
		tmp = x + y;
	} else if (z <= 1.58e-115) {
		tmp = x + (y * (t / a));
	} else if (z <= 3.9e+88) {
		tmp = x - (y * (t / z));
	} else {
		tmp = x + y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z <= (-800.0d0)) then
        tmp = x + y
    else if (z <= 1.58d-115) then
        tmp = x + (y * (t / a))
    else if (z <= 3.9d+88) then
        tmp = x - (y * (t / z))
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -800.0) {
		tmp = x + y;
	} else if (z <= 1.58e-115) {
		tmp = x + (y * (t / a));
	} else if (z <= 3.9e+88) {
		tmp = x - (y * (t / z));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -800.0:
		tmp = x + y
	elif z <= 1.58e-115:
		tmp = x + (y * (t / a))
	elif z <= 3.9e+88:
		tmp = x - (y * (t / z))
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -800.0)
		tmp = Float64(x + y);
	elseif (z <= 1.58e-115)
		tmp = Float64(x + Float64(y * Float64(t / a)));
	elseif (z <= 3.9e+88)
		tmp = Float64(x - Float64(y * Float64(t / z)));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -800.0)
		tmp = x + y;
	elseif (z <= 1.58e-115)
		tmp = x + (y * (t / a));
	elseif (z <= 3.9e+88)
		tmp = x - (y * (t / z));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -800.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.9e+88], N[(x - N[(y * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -800:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{+88}:\\
\;\;\;\;x - y \cdot \frac{t}{z}\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -800 or 3.9000000000000001e88 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around inf 77.7%

      \[\leadsto \color{blue}{x + y} \]
    3. Step-by-step derivation
      1. +-commutative77.7%

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified77.7%

      \[\leadsto \color{blue}{y + x} \]

    if -800 < z < 1.58e-115

    1. Initial program 97.7%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around 0 89.0%

      \[\leadsto x + y \cdot \color{blue}{\frac{t}{a}} \]

    if 1.58e-115 < z < 3.9000000000000001e88

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in t around inf 85.9%

      \[\leadsto x + \color{blue}{-1 \cdot \frac{t \cdot y}{z - a}} \]
    3. Step-by-step derivation
      1. associate-*r/85.9%

        \[\leadsto x + \color{blue}{\frac{-1 \cdot \left(t \cdot y\right)}{z - a}} \]
      2. associate-*r*85.9%

        \[\leadsto x + \frac{\color{blue}{\left(-1 \cdot t\right) \cdot y}}{z - a} \]
      3. mul-1-neg85.9%

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

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{z}} \]
    6. Step-by-step derivation
      1. mul-1-neg74.9%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{z}\right)} \]
      2. unsub-neg74.9%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{z}} \]
      3. associate-/l*76.8%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{z}{y}}} \]
      4. associate-/r/76.8%

        \[\leadsto x - \color{blue}{\frac{t}{z} \cdot y} \]
    7. Simplified76.8%

      \[\leadsto \color{blue}{x - \frac{t}{z} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -800:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+88}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 4: 81.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\ \;\;\;\;x + y \cdot \frac{z}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -2.3e-7) (not (<= z 1.58e-115)))
   (+ x (* y (/ z (- z a))))
   (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -2.3e-7) || !(z <= 1.58e-115)) {
		tmp = x + (y * (z / (z - a)));
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-2.3d-7)) .or. (.not. (z <= 1.58d-115))) then
        tmp = x + (y * (z / (z - a)))
    else
        tmp = x + (y * (t / a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -2.3e-7) || !(z <= 1.58e-115)) {
		tmp = x + (y * (z / (z - a)));
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -2.3e-7) or not (z <= 1.58e-115):
		tmp = x + (y * (z / (z - a)))
	else:
		tmp = x + (y * (t / a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -2.3e-7) || !(z <= 1.58e-115))
		tmp = Float64(x + Float64(y * Float64(z / Float64(z - a))));
	else
		tmp = Float64(x + Float64(y * Float64(t / a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -2.3e-7) || ~((z <= 1.58e-115)))
		tmp = x + (y * (z / (z - a)));
	else
		tmp = x + (y * (t / a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.3e-7], N[Not[LessEqual[z, 1.58e-115]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.29999999999999995e-7 or 1.58e-115 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in t around 0 63.9%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{z - a}} \]
    3. Step-by-step derivation
      1. associate-*r/80.8%

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{z - a}} \]
    4. Simplified80.8%

      \[\leadsto x + \color{blue}{y \cdot \frac{z}{z - a}} \]

    if -2.29999999999999995e-7 < z < 1.58e-115

    1. Initial program 97.7%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around 0 89.0%

      \[\leadsto x + y \cdot \color{blue}{\frac{t}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\ \;\;\;\;x + y \cdot \frac{z}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \end{array} \]

Alternative 5: 81.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\ \;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -6e-7) (not (<= z 1.58e-115)))
   (+ x (/ y (/ z (- z t))))
   (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -6e-7) || !(z <= 1.58e-115)) {
		tmp = x + (y / (z / (z - t)));
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-6d-7)) .or. (.not. (z <= 1.58d-115))) then
        tmp = x + (y / (z / (z - t)))
    else
        tmp = x + (y * (t / a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -6e-7) || !(z <= 1.58e-115)) {
		tmp = x + (y / (z / (z - t)));
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -6e-7) or not (z <= 1.58e-115):
		tmp = x + (y / (z / (z - t)))
	else:
		tmp = x + (y * (t / a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -6e-7) || !(z <= 1.58e-115))
		tmp = Float64(x + Float64(y / Float64(z / Float64(z - t))));
	else
		tmp = Float64(x + Float64(y * Float64(t / a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -6e-7) || ~((z <= 1.58e-115)))
		tmp = x + (y / (z / (z - t)));
	else
		tmp = x + (y * (t / a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6e-7], N[Not[LessEqual[z, 1.58e-115]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.9999999999999997e-7 or 1.58e-115 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in a around 0 64.7%

      \[\leadsto \color{blue}{x + \frac{y \cdot \left(z - t\right)}{z}} \]
    3. Step-by-step derivation
      1. +-commutative64.7%

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{z} + x} \]
      2. associate-/l*84.5%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - t}}} + x \]
    4. Simplified84.5%

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

    if -5.9999999999999997e-7 < z < 1.58e-115

    1. Initial program 97.7%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around 0 89.0%

      \[\leadsto x + y \cdot \color{blue}{\frac{t}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.0%

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

Alternative 6: 87.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.48 \cdot 10^{+57} \lor \neg \left(z \leq 4 \cdot 10^{+51}\right):\\ \;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot t}{z - a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -1.48e+57) (not (<= z 4e+51)))
   (+ x (/ y (/ z (- z t))))
   (- x (/ (* y t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -1.48e+57) || !(z <= 4e+51)) {
		tmp = x + (y / (z / (z - t)));
	} else {
		tmp = x - ((y * t) / (z - a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-1.48d+57)) .or. (.not. (z <= 4d+51))) then
        tmp = x + (y / (z / (z - t)))
    else
        tmp = x - ((y * t) / (z - a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -1.48e+57) || !(z <= 4e+51)) {
		tmp = x + (y / (z / (z - t)));
	} else {
		tmp = x - ((y * t) / (z - a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -1.48e+57) or not (z <= 4e+51):
		tmp = x + (y / (z / (z - t)))
	else:
		tmp = x - ((y * t) / (z - a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -1.48e+57) || !(z <= 4e+51))
		tmp = Float64(x + Float64(y / Float64(z / Float64(z - t))));
	else
		tmp = Float64(x - Float64(Float64(y * t) / Float64(z - a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -1.48e+57) || ~((z <= 4e+51)))
		tmp = x + (y / (z / (z - t)));
	else
		tmp = x - ((y * t) / (z - a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.48e+57], N[Not[LessEqual[z, 4e+51]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.48 \cdot 10^{+57} \lor \neg \left(z \leq 4 \cdot 10^{+51}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot t}{z - a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.47999999999999999e57 or 4e51 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in a around 0 62.7%

      \[\leadsto \color{blue}{x + \frac{y \cdot \left(z - t\right)}{z}} \]
    3. Step-by-step derivation
      1. +-commutative62.7%

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{z} + x} \]
      2. associate-/l*91.2%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - t}}} + x \]
    4. Simplified91.2%

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

    if -1.47999999999999999e57 < z < 4e51

    1. Initial program 98.6%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in t around inf 88.3%

      \[\leadsto x + \color{blue}{-1 \cdot \frac{t \cdot y}{z - a}} \]
    3. Step-by-step derivation
      1. associate-*r/88.3%

        \[\leadsto x + \color{blue}{\frac{-1 \cdot \left(t \cdot y\right)}{z - a}} \]
      2. associate-*r*88.3%

        \[\leadsto x + \frac{\color{blue}{\left(-1 \cdot t\right) \cdot y}}{z - a} \]
      3. mul-1-neg88.3%

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

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{z - a}} \]
    6. Step-by-step derivation
      1. mul-1-neg88.3%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{z - a}\right)} \]
      2. associate-*r/88.6%

        \[\leadsto x + \left(-\color{blue}{t \cdot \frac{y}{z - a}}\right) \]
      3. sub-neg88.6%

        \[\leadsto \color{blue}{x - t \cdot \frac{y}{z - a}} \]
      4. associate-*r/88.3%

        \[\leadsto x - \color{blue}{\frac{t \cdot y}{z - a}} \]
    7. Simplified88.3%

      \[\leadsto \color{blue}{x - \frac{t \cdot y}{z - a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.48 \cdot 10^{+57} \lor \neg \left(z \leq 4 \cdot 10^{+51}\right):\\ \;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot t}{z - a}\\ \end{array} \]

Alternative 7: 77.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.0082 \lor \neg \left(z \leq 2.05 \cdot 10^{+58}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -0.0082) (not (<= z 2.05e+58))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -0.0082) || !(z <= 2.05e+58)) {
		tmp = x + y;
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-0.0082d0)) .or. (.not. (z <= 2.05d+58))) then
        tmp = x + y
    else
        tmp = x + (y * (t / a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -0.0082) || !(z <= 2.05e+58)) {
		tmp = x + y;
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -0.0082) or not (z <= 2.05e+58):
		tmp = x + y
	else:
		tmp = x + (y * (t / a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -0.0082) || !(z <= 2.05e+58))
		tmp = Float64(x + y);
	else
		tmp = Float64(x + Float64(y * Float64(t / a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -0.0082) || ~((z <= 2.05e+58)))
		tmp = x + y;
	else
		tmp = x + (y * (t / a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.0082], N[Not[LessEqual[z, 2.05e+58]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0082 \lor \neg \left(z \leq 2.05 \cdot 10^{+58}\right):\\
\;\;\;\;x + y\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.00820000000000000069 or 2.05e58 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around inf 76.6%

      \[\leadsto \color{blue}{x + y} \]
    3. Step-by-step derivation
      1. +-commutative76.6%

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified76.6%

      \[\leadsto \color{blue}{y + x} \]

    if -0.00820000000000000069 < z < 2.05e58

    1. Initial program 98.4%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around 0 81.8%

      \[\leadsto x + y \cdot \color{blue}{\frac{t}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0082 \lor \neg \left(z \leq 2.05 \cdot 10^{+58}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \end{array} \]

Alternative 8: 63.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{-15}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+50}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -1.5e-15) (+ x y) (if (<= z 1.25e+50) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -1.5e-15) {
		tmp = x + y;
	} else if (z <= 1.25e+50) {
		tmp = x;
	} else {
		tmp = x + y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z <= (-1.5d-15)) then
        tmp = x + y
    else if (z <= 1.25d+50) then
        tmp = x
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -1.5e-15) {
		tmp = x + y;
	} else if (z <= 1.25e+50) {
		tmp = x;
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -1.5e-15:
		tmp = x + y
	elif z <= 1.25e+50:
		tmp = x
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -1.5e-15)
		tmp = Float64(x + y);
	elseif (z <= 1.25e+50)
		tmp = x;
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -1.5e-15)
		tmp = x + y;
	elseif (z <= 1.25e+50)
		tmp = x;
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.5e-15], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.25e+50], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-15}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+50}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5e-15 or 1.25e50 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in z around inf 75.6%

      \[\leadsto \color{blue}{x + y} \]
    3. Step-by-step derivation
      1. +-commutative75.6%

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified75.6%

      \[\leadsto \color{blue}{y + x} \]

    if -1.5e-15 < z < 1.25e50

    1. Initial program 98.3%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Taylor expanded in x around inf 53.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{-15}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+50}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 9: 50.9% accurate, 11.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
	return x;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x
end function
public static double code(double x, double y, double z, double t, double a) {
	return x;
}
def code(x, y, z, t, a):
	return x
function code(x, y, z, t, a)
	return x
end
function tmp = code(x, y, z, t, a)
	tmp = x;
end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + y \cdot \frac{z - t}{z - a} \]
  2. Taylor expanded in x around inf 52.0%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification52.0%

    \[\leadsto x \]

Developer target: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y}{\frac{z - a}{z - t}} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
	return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a):
	return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a)
	return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y / ((z - a) / (z - t)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}

Reproduce

?
herbie shell --seed 2023297 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
  :precision binary64

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

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