Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B

Percentage Accurate: 76.7% → 98.1%
Time: 14.1s
Alternatives: 7
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \end{array} \]
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a)
	return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
end
function tmp = code(x, y, z, t, a)
	tmp = (x + y) - (((z - t) * y) / (a - t));
end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}

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 7 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: 76.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \end{array} \]
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a)
	return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
end
function tmp = code(x, y, z, t, a)
	tmp = (x + y) - (((z - t) * y) / (a - t));
end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}

Alternative 1: 98.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, \frac{z - a}{t - a}, x\right) \end{array} \]
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z a) (- t a)) x))
double code(double x, double y, double z, double t, double a) {
	return fma(y, ((z - a) / (t - a)), x);
}
function code(x, y, z, t, a)
	return fma(y, Float64(Float64(z - a) / Float64(t - a)), x)
end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - a), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, \frac{z - a}{t - a}, x\right)
\end{array}
Derivation
  1. Initial program 76.7%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
  3. Taylor expanded in z around 0

    \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z - a}}{t - a}, x\right) \]
  4. Applied rewrites98.1%

    \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z - a}}{t - a}, x\right) \]
  5. Add Preprocessing

Alternative 2: 87.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x + y\right) - \frac{y}{a} \cdot z\\ \mathbf{if}\;a \leq -1.45 \cdot 10^{+34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{+101}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z}{t - a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (+ x y) (* (/ y a) z))))
   (if (<= a -1.45e+34) t_1 (if (<= a 2.2e+101) (fma y (/ z (- t a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x + y) - ((y / a) * z);
	double tmp;
	if (a <= -1.45e+34) {
		tmp = t_1;
	} else if (a <= 2.2e+101) {
		tmp = fma(y, (z / (t - a)), x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x + y) - Float64(Float64(y / a) * z))
	tmp = 0.0
	if (a <= -1.45e+34)
		tmp = t_1;
	elseif (a <= 2.2e+101)
		tmp = fma(y, Float64(z / Float64(t - a)), x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.45e+34], t$95$1, If[LessEqual[a, 2.2e+101], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{y}{a} \cdot z\\
\mathbf{if}\;a \leq -1.45 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 2.2 \cdot 10^{+101}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t - a}, x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.4500000000000001e34 or 2.2000000000000001e101 < a

    1. Initial program 76.7%

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
    2. Taylor expanded in t around 0

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

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

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

    if -1.4500000000000001e34 < a < 2.2000000000000001e101

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in z around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{t - a}}, x\right) \]
    4. Applied rewrites76.5%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{t - a}}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 84.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.1 \cdot 10^{+134}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \mathbf{elif}\;a \leq 3.8 \cdot 10^{+106}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z}{t - a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -2.1e+134)
   (fma y 1.0 x)
   (if (<= a 3.8e+106) (fma y (/ z (- t a)) x) (fma y 1.0 x))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -2.1e+134) {
		tmp = fma(y, 1.0, x);
	} else if (a <= 3.8e+106) {
		tmp = fma(y, (z / (t - a)), x);
	} else {
		tmp = fma(y, 1.0, x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -2.1e+134)
		tmp = fma(y, 1.0, x);
	elseif (a <= 3.8e+106)
		tmp = fma(y, Float64(z / Float64(t - a)), x);
	else
		tmp = fma(y, 1.0, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.1e+134], N[(y * 1.0 + x), $MachinePrecision], If[LessEqual[a, 3.8e+106], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y * 1.0 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{+134}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\

\mathbf{elif}\;a \leq 3.8 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t - a}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.1000000000000001e134 or 3.7999999999999998e106 < a

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in a around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]

    if -2.1000000000000001e134 < a < 3.7999999999999998e106

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in z around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{t - a}}, x\right) \]
    4. Applied rewrites76.5%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{t - a}}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 77.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.2 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \mathbf{elif}\;a \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -5.2e+107)
   (fma y 1.0 x)
   (if (<= a 8.2e+102) (fma (/ y t) (- z a) x) (fma y 1.0 x))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -5.2e+107) {
		tmp = fma(y, 1.0, x);
	} else if (a <= 8.2e+102) {
		tmp = fma((y / t), (z - a), x);
	} else {
		tmp = fma(y, 1.0, x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -5.2e+107)
		tmp = fma(y, 1.0, x);
	elseif (a <= 8.2e+102)
		tmp = fma(Float64(y / t), Float64(z - a), x);
	else
		tmp = fma(y, 1.0, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.2e+107], N[(y * 1.0 + x), $MachinePrecision], If[LessEqual[a, 8.2e+102], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], N[(y * 1.0 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.2 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\

\mathbf{elif}\;a \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.2000000000000002e107 or 8.1999999999999999e102 < a

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in a around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]

    if -5.2000000000000002e107 < a < 8.1999999999999999e102

    1. Initial program 76.7%

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
    2. Taylor expanded in t around -inf

      \[\leadsto \color{blue}{x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
    3. Applied rewrites57.6%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
    4. Applied rewrites61.4%

      \[\leadsto \mathsf{fma}\left(\frac{y}{t}, \color{blue}{z - a}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 75.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.5 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \mathbf{elif}\;a \leq 8 \cdot 10^{+102}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z}{t}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -2.5e+107)
   (fma y 1.0 x)
   (if (<= a 8e+102) (fma y (/ z t) x) (fma y 1.0 x))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -2.5e+107) {
		tmp = fma(y, 1.0, x);
	} else if (a <= 8e+102) {
		tmp = fma(y, (z / t), x);
	} else {
		tmp = fma(y, 1.0, x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -2.5e+107)
		tmp = fma(y, 1.0, x);
	elseif (a <= 8e+102)
		tmp = fma(y, Float64(z / t), x);
	else
		tmp = fma(y, 1.0, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.5e+107], N[(y * 1.0 + x), $MachinePrecision], If[LessEqual[a, 8e+102], N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision], N[(y * 1.0 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\

\mathbf{elif}\;a \leq 8 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.5000000000000001e107 or 7.99999999999999982e102 < a

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in a around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]

    if -2.5000000000000001e107 < a < 7.99999999999999982e102

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in z around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{t - a}}, x\right) \]
    4. Applied rewrites76.5%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{t - a}}, x\right) \]
    5. Taylor expanded in t around inf

      \[\leadsto \mathsf{fma}\left(y, \frac{z}{\color{blue}{t}}, x\right) \]
    6. Applied rewrites62.1%

      \[\leadsto \mathsf{fma}\left(y, \frac{z}{\color{blue}{t}}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 62.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \leq -\infty:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= (- (+ x y) (/ (* (- z t) y) (- a t))) (- INFINITY))
   (* (/ y t) z)
   (fma y 1.0 x)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((x + y) - (((z - t) * y) / (a - t))) <= -((double) INFINITY)) {
		tmp = (y / t) * z;
	} else {
		tmp = fma(y, 1.0, x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) <= Float64(-Inf))
		tmp = Float64(Float64(y / t) * z);
	else
		tmp = fma(y, 1.0, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], N[(y * 1.0 + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \leq -\infty:\\
\;\;\;\;\frac{y}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0

    1. Initial program 76.7%

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
    2. Taylor expanded in t around -inf

      \[\leadsto \color{blue}{x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
    3. Applied rewrites57.6%

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

      \[\leadsto \frac{y \cdot z}{\color{blue}{t}} \]
    5. Applied rewrites18.6%

      \[\leadsto \frac{y \cdot z}{\color{blue}{t}} \]
    6. Applied rewrites20.3%

      \[\leadsto \frac{y}{t} \cdot z \]

    if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t)))

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
    3. Taylor expanded in a around inf

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 60.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, 1, x\right) \end{array} \]
(FPCore (x y z t a) :precision binary64 (fma y 1.0 x))
double code(double x, double y, double z, double t, double a) {
	return fma(y, 1.0, x);
}
function code(x, y, z, t, a)
	return fma(y, 1.0, x)
end
code[x_, y_, z_, t_, a_] := N[(y * 1.0 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, 1, x\right)
\end{array}
Derivation
  1. Initial program 76.7%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(t - a\right) - \left(t - z\right)}{t - a}, x\right)} \]
  3. Taylor expanded in a around inf

    \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
  4. Applied rewrites60.1%

    \[\leadsto \mathsf{fma}\left(y, \color{blue}{1}, x\right) \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2025153 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
  :precision binary64
  (- (+ x y) (/ (* (- z t) y) (- a t))))