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

Percentage Accurate: 98.1% → 98.1%
Time: 6.7s
Alternatives: 8
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 8 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 98.4%

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

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

Alternative 2: 80.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.8000000000000003e57 or 6.1999999999999995e46 < z

    1. Initial program 100.0%

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

      \[\leadsto x + y \cdot \color{blue}{\frac{z - t}{z}} \]
    3. Step-by-step derivation
      1. div-sub90.8%

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

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

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

    if -5.8000000000000003e57 < z < 6.1999999999999995e46

    1. Initial program 97.3%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{t}}} + x \]
    4. Simplified79.9%

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

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

Alternative 3: 81.3% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.9999999999999995e-8 or 2.6000000000000002e-69 < z

    1. Initial program 99.9%

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

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

    if -9.9999999999999995e-8 < z < 2.6000000000000002e-69

    1. Initial program 96.1%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{t}}} + x \]
    4. Simplified88.0%

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

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

Alternative 4: 87.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.7 \cdot 10^{+57}:\\ \;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+96}:\\ \;\;\;\;x - \frac{y}{\frac{z - a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{z - a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -5.7e+57)
   (+ x (* y (- 1.0 (/ t z))))
   (if (<= z 1.95e+96) (- x (/ y (/ (- z a) t))) (+ x (* y (/ z (- z a)))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -5.7e+57) {
		tmp = x + (y * (1.0 - (t / z)));
	} else if (z <= 1.95e+96) {
		tmp = x - (y / ((z - a) / t));
	} else {
		tmp = x + (y * (z / (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 <= (-5.7d+57)) then
        tmp = x + (y * (1.0d0 - (t / z)))
    else if (z <= 1.95d+96) then
        tmp = x - (y / ((z - a) / t))
    else
        tmp = x + (y * (z / (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 <= -5.7e+57) {
		tmp = x + (y * (1.0 - (t / z)));
	} else if (z <= 1.95e+96) {
		tmp = x - (y / ((z - a) / t));
	} else {
		tmp = x + (y * (z / (z - a)));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -5.7e+57:
		tmp = x + (y * (1.0 - (t / z)))
	elif z <= 1.95e+96:
		tmp = x - (y / ((z - a) / t))
	else:
		tmp = x + (y * (z / (z - a)))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -5.7e+57)
		tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z))));
	elseif (z <= 1.95e+96)
		tmp = Float64(x - Float64(y / Float64(Float64(z - a) / t)));
	else
		tmp = Float64(x + Float64(y * Float64(z / Float64(z - a))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -5.7e+57)
		tmp = x + (y * (1.0 - (t / z)));
	elseif (z <= 1.95e+96)
		tmp = x - (y / ((z - a) / t));
	else
		tmp = x + (y * (z / (z - a)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.7e+57], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e+96], N[(x - N[(y / N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{+57}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.6999999999999998e57

    1. Initial program 100.0%

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

      \[\leadsto x + y \cdot \color{blue}{\frac{z - t}{z}} \]
    3. Step-by-step derivation
      1. div-sub91.2%

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

        \[\leadsto x + y \cdot \left(\color{blue}{1} - \frac{t}{z}\right) \]
    4. Simplified91.2%

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

    if -5.6999999999999998e57 < z < 1.95e96

    1. Initial program 97.5%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Step-by-step derivation
      1. clear-num97.4%

        \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{z - a}{z - t}}} \]
      2. associate-/r/97.4%

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

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

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

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

        \[\leadsto x + \frac{\color{blue}{-y \cdot t}}{z - a} \]
      3. distribute-rgt-neg-out85.2%

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

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

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{y}{\frac{z - a}{t}}} \]
    9. Simplified87.0%

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

    if 1.95e96 < z

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.7 \cdot 10^{+57}:\\ \;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+96}:\\ \;\;\;\;x - \frac{y}{\frac{z - a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{z - a}\\ \end{array} \]

Alternative 5: 75.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+108}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+52}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -7.8e+108) (+ x y) (if (<= z 3.2e+52) (+ x (* y (/ t a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -7.8e+108) {
		tmp = x + y;
	} else if (z <= 3.2e+52) {
		tmp = x + (y * (t / a));
	} 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 <= (-7.8d+108)) then
        tmp = x + y
    else if (z <= 3.2d+52) then
        tmp = x + (y * (t / a))
    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 <= -7.8e+108) {
		tmp = x + y;
	} else if (z <= 3.2e+52) {
		tmp = x + (y * (t / a));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -7.8e+108:
		tmp = x + y
	elif z <= 3.2e+52:
		tmp = x + (y * (t / a))
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -7.8e+108)
		tmp = Float64(x + y);
	elseif (z <= 3.2e+52)
		tmp = Float64(x + Float64(y * Float64(t / a)));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -7.8e+108)
		tmp = x + y;
	elseif (z <= 3.2e+52)
		tmp = x + (y * (t / a));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.8e+108], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.2e+52], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+52}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.79999999999999969e108 or 3.2e52 < z

    1. Initial program 100.0%

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

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

    if -7.79999999999999969e108 < z < 3.2e52

    1. Initial program 97.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+108}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+52}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 6: 75.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+108}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+48}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -6e+108) (+ x y) (if (<= z 5e+48) (+ x (/ y (/ a t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6e+108) {
		tmp = x + y;
	} else if (z <= 5e+48) {
		tmp = x + (y / (a / 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 <= (-6d+108)) then
        tmp = x + y
    else if (z <= 5d+48) then
        tmp = x + (y / (a / 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 <= -6e+108) {
		tmp = x + y;
	} else if (z <= 5e+48) {
		tmp = x + (y / (a / t));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -6e+108:
		tmp = x + y
	elif z <= 5e+48:
		tmp = x + (y / (a / t))
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -6e+108)
		tmp = Float64(x + y);
	elseif (z <= 5e+48)
		tmp = Float64(x + Float64(y / Float64(a / t)));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -6e+108)
		tmp = x + y;
	elseif (z <= 5e+48)
		tmp = x + (y / (a / t));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e+108], N[(x + y), $MachinePrecision], If[LessEqual[z, 5e+48], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 5 \cdot 10^{+48}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.99999999999999968e108 or 4.99999999999999973e48 < z

    1. Initial program 100.0%

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

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

    if -5.99999999999999968e108 < z < 4.99999999999999973e48

    1. Initial program 97.5%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{t}}} + x \]
    4. Simplified78.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+108}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+48}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 7: 61.2% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 3.5 \cdot 10^{+158}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a) :precision binary64 (if (<= a 3.5e+158) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= 3.5e+158) {
		tmp = x + y;
	} else {
		tmp = x;
	}
	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 (a <= 3.5d+158) then
        tmp = x + y
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= 3.5e+158) {
		tmp = x + y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= 3.5e+158:
		tmp = x + y
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= 3.5e+158)
		tmp = Float64(x + y);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= 3.5e+158)
		tmp = x + y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 3.5e+158], N[(x + y), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.5 \cdot 10^{+158}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 3.5000000000000001e158

    1. Initial program 98.2%

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

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

    if 3.5000000000000001e158 < a

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 3.5 \cdot 10^{+158}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 8: 50.1% 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 98.4%

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

    \[\leadsto \color{blue}{x} \]
  3. Final simplification50.9%

    \[\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 2023221 
(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)))))