Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3

Percentage Accurate: 68.2% → 88.5%
Time: 11.3s
Alternatives: 21
Speedup: 0.9×

Specification

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

\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\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 21 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: 68.2% accurate, 1.0× speedup?

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

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

Alternative 1: 88.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y - a, t\right)\\


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

    1. Initial program 12.5%

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

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      2. distribute-lft-out--N/A

        \[\leadsto t + \color{blue}{-1 \cdot \left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      3. div-subN/A

        \[\leadsto t + -1 \cdot \color{blue}{\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      4. +-commutativeN/A

        \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z} + t} \]
      5. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)\right)} + t \]
      6. div-subN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)}\right)\right) + t \]
      7. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\color{blue}{y \cdot \frac{t - x}{z}} - \frac{a \cdot \left(t - x\right)}{z}\right)\right)\right) + t \]
      8. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y \cdot \frac{t - x}{z} - \color{blue}{a \cdot \frac{t - x}{z}}\right)\right)\right) + t \]
      9. distribute-rgt-out--N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{t - x}{z} \cdot \left(y - a\right)}\right)\right) + t \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t - x}{z}\right)\right) \cdot \left(y - a\right)} + t \]
      11. lower-fma.f64N/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(-t\right) + x}{z}, y - a, t\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites92.4%

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

      if -7.9999999999999998e147 < z < 1e161

      1. Initial program 83.8%

        \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} + x} \]
        3. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}} + x \]
        4. lift-*.f64N/A

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

          \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z}} + x \]
        6. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{t - x}{a - z} \cdot \left(y - z\right)} + x \]
        7. div-invN/A

          \[\leadsto \color{blue}{\left(\left(t - x\right) \cdot \frac{1}{a - z}\right)} \cdot \left(y - z\right) + x \]
        8. associate-*l*N/A

          \[\leadsto \color{blue}{\left(t - x\right) \cdot \left(\frac{1}{a - z} \cdot \left(y - z\right)\right)} + x \]
        9. lower-fma.f64N/A

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

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

      if 1e161 < z

      1. Initial program 25.5%

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

        \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
      4. Step-by-step derivation
        1. associate--l+N/A

          \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
        2. distribute-lft-out--N/A

          \[\leadsto t + \color{blue}{-1 \cdot \left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
        3. div-subN/A

          \[\leadsto t + -1 \cdot \color{blue}{\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
        4. +-commutativeN/A

          \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z} + t} \]
        5. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)\right)} + t \]
        6. div-subN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)}\right)\right) + t \]
        7. associate-/l*N/A

          \[\leadsto \left(\mathsf{neg}\left(\left(\color{blue}{y \cdot \frac{t - x}{z}} - \frac{a \cdot \left(t - x\right)}{z}\right)\right)\right) + t \]
        8. associate-/l*N/A

          \[\leadsto \left(\mathsf{neg}\left(\left(y \cdot \frac{t - x}{z} - \color{blue}{a \cdot \frac{t - x}{z}}\right)\right)\right) + t \]
        9. distribute-rgt-out--N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{t - x}{z} \cdot \left(y - a\right)}\right)\right) + t \]
        10. distribute-lft-neg-inN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t - x}{z}\right)\right) \cdot \left(y - a\right)} + t \]
        11. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{z}, \color{blue}{y} - a, t\right) \]
      7. Step-by-step derivation
        1. Applied rewrites93.5%

          \[\leadsto \mathsf{fma}\left(\frac{x}{z}, \color{blue}{y} - a, t\right) \]
      8. Recombined 3 regimes into one program.
      9. Final simplification93.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\ \mathbf{elif}\;z \leq 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(t - x, \left(y - z\right) \cdot \frac{-1}{z - a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y - a, t\right)\\ \end{array} \]
      10. Add Preprocessing

      Alternative 2: 51.0% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x - t}{z} \cdot y\\ t_2 := \mathsf{fma}\left(\frac{x}{z}, -a, t\right)\\ \mathbf{if}\;z \leq -6 \cdot 10^{+33}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{-89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+19}:\\ \;\;\;\;\mathsf{fma}\left(-x, \frac{y}{a}, x\right)\\ \mathbf{elif}\;z \leq 2.12 \cdot 10^{+126}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
      (FPCore (x y z t a)
       :precision binary64
       (let* ((t_1 (* (/ (- x t) z) y)) (t_2 (fma (/ x z) (- a) t)))
         (if (<= z -6e+33)
           t_2
           (if (<= z -1.85e-89)
             t_1
             (if (<= z 3.8e+19)
               (fma (- x) (/ y a) x)
               (if (<= z 2.12e+126) t_1 t_2))))))
      double code(double x, double y, double z, double t, double a) {
      	double t_1 = ((x - t) / z) * y;
      	double t_2 = fma((x / z), -a, t);
      	double tmp;
      	if (z <= -6e+33) {
      		tmp = t_2;
      	} else if (z <= -1.85e-89) {
      		tmp = t_1;
      	} else if (z <= 3.8e+19) {
      		tmp = fma(-x, (y / a), x);
      	} else if (z <= 2.12e+126) {
      		tmp = t_1;
      	} else {
      		tmp = t_2;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a)
      	t_1 = Float64(Float64(Float64(x - t) / z) * y)
      	t_2 = fma(Float64(x / z), Float64(-a), t)
      	tmp = 0.0
      	if (z <= -6e+33)
      		tmp = t_2;
      	elseif (z <= -1.85e-89)
      		tmp = t_1;
      	elseif (z <= 3.8e+19)
      		tmp = fma(Float64(-x), Float64(y / a), x);
      	elseif (z <= 2.12e+126)
      		tmp = t_1;
      	else
      		tmp = t_2;
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / z), $MachinePrecision] * (-a) + t), $MachinePrecision]}, If[LessEqual[z, -6e+33], t$95$2, If[LessEqual[z, -1.85e-89], t$95$1, If[LessEqual[z, 3.8e+19], N[((-x) * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.12e+126], t$95$1, t$95$2]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \frac{x - t}{z} \cdot y\\
      t_2 := \mathsf{fma}\left(\frac{x}{z}, -a, t\right)\\
      \mathbf{if}\;z \leq -6 \cdot 10^{+33}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;z \leq -1.85 \cdot 10^{-89}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq 3.8 \cdot 10^{+19}:\\
      \;\;\;\;\mathsf{fma}\left(-x, \frac{y}{a}, x\right)\\
      
      \mathbf{elif}\;z \leq 2.12 \cdot 10^{+126}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_2\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -5.99999999999999967e33 or 2.1200000000000001e126 < z

        1. Initial program 38.5%

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

          \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
        4. Step-by-step derivation
          1. associate--l+N/A

            \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
          2. distribute-lft-out--N/A

            \[\leadsto t + \color{blue}{-1 \cdot \left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
          3. div-subN/A

            \[\leadsto t + -1 \cdot \color{blue}{\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
          4. +-commutativeN/A

            \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z} + t} \]
          5. mul-1-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)\right)} + t \]
          6. div-subN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)}\right)\right) + t \]
          7. associate-/l*N/A

            \[\leadsto \left(\mathsf{neg}\left(\left(\color{blue}{y \cdot \frac{t - x}{z}} - \frac{a \cdot \left(t - x\right)}{z}\right)\right)\right) + t \]
          8. associate-/l*N/A

            \[\leadsto \left(\mathsf{neg}\left(\left(y \cdot \frac{t - x}{z} - \color{blue}{a \cdot \frac{t - x}{z}}\right)\right)\right) + t \]
          9. distribute-rgt-out--N/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{t - x}{z} \cdot \left(y - a\right)}\right)\right) + t \]
          10. distribute-lft-neg-inN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t - x}{z}\right)\right) \cdot \left(y - a\right)} + t \]
          11. lower-fma.f64N/A

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

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

          \[\leadsto \mathsf{fma}\left(\frac{x}{z}, \color{blue}{y} - a, t\right) \]
        7. Step-by-step derivation
          1. Applied rewrites71.1%

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

            \[\leadsto \mathsf{fma}\left(\frac{x}{z}, -1 \cdot \color{blue}{a}, t\right) \]
          3. Step-by-step derivation
            1. Applied rewrites55.3%

              \[\leadsto \mathsf{fma}\left(\frac{x}{z}, -a, t\right) \]

            if -5.99999999999999967e33 < z < -1.8499999999999999e-89 or 3.8e19 < z < 2.1200000000000001e126

            1. Initial program 75.3%

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

              \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
            4. Step-by-step derivation
              1. associate--l+N/A

                \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
              2. distribute-lft-out--N/A

                \[\leadsto t + \color{blue}{-1 \cdot \left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)} \]
              3. div-subN/A

                \[\leadsto t + -1 \cdot \color{blue}{\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
              4. +-commutativeN/A

                \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z} + t} \]
              5. mul-1-negN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)\right)} + t \]
              6. div-subN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{y \cdot \left(t - x\right)}{z} - \frac{a \cdot \left(t - x\right)}{z}\right)}\right)\right) + t \]
              7. associate-/l*N/A

                \[\leadsto \left(\mathsf{neg}\left(\left(\color{blue}{y \cdot \frac{t - x}{z}} - \frac{a \cdot \left(t - x\right)}{z}\right)\right)\right) + t \]
              8. associate-/l*N/A

                \[\leadsto \left(\mathsf{neg}\left(\left(y \cdot \frac{t - x}{z} - \color{blue}{a \cdot \frac{t - x}{z}}\right)\right)\right) + t \]
              9. distribute-rgt-out--N/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{t - x}{z} \cdot \left(y - a\right)}\right)\right) + t \]
              10. distribute-lft-neg-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t - x}{z}\right)\right) \cdot \left(y - a\right)} + t \]
              11. lower-fma.f64N/A

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

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

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

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

              if -1.8499999999999999e-89 < z < 3.8e19

              1. Initial program 90.0%

                \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-+.f64N/A

                  \[\leadsto \color{blue}{x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}} \]
                2. +-commutativeN/A

                  \[\leadsto \color{blue}{\frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} + x} \]
                3. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}} + x \]
                4. lift-*.f64N/A

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

                  \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z}} + x \]
                6. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{t - x}{a - z} \cdot \left(y - z\right)} + x \]
                7. div-invN/A

                  \[\leadsto \color{blue}{\left(\left(t - x\right) \cdot \frac{1}{a - z}\right)} \cdot \left(y - z\right) + x \]
                8. associate-*l*N/A

                  \[\leadsto \color{blue}{\left(t - x\right) \cdot \left(\frac{1}{a - z} \cdot \left(y - z\right)\right)} + x \]
                9. lower-fma.f64N/A

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

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

                \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{\frac{y}{a}}, x\right) \]
              6. Step-by-step derivation
                1. lower-/.f6477.0

                  \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{\frac{y}{a}}, x\right) \]
              7. Applied rewrites77.0%

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{-1 \cdot x}, \frac{y}{a}, x\right) \]
              9. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x\right)}, \frac{y}{a}, x\right) \]
                2. lower-neg.f6455.3

                  \[\leadsto \mathsf{fma}\left(\color{blue}{-x}, \frac{y}{a}, x\right) \]
              10. Applied rewrites55.3%

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

            Developer Target 1: 84.1% accurate, 0.6× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
            (FPCore (x y z t a)
             :precision binary64
             (let* ((t_1 (- t (* (/ y z) (- t x)))))
               (if (< z -1.2536131056095036e+188)
                 t_1
                 (if (< z 4.446702369113811e+64)
                   (+ x (/ (- y z) (/ (- a z) (- t x))))
                   t_1))))
            double code(double x, double y, double z, double t, double a) {
            	double t_1 = t - ((y / z) * (t - x));
            	double tmp;
            	if (z < -1.2536131056095036e+188) {
            		tmp = t_1;
            	} else if (z < 4.446702369113811e+64) {
            		tmp = x + ((y - z) / ((a - z) / (t - x)));
            	} else {
            		tmp = t_1;
            	}
            	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) :: t_1
                real(8) :: tmp
                t_1 = t - ((y / z) * (t - x))
                if (z < (-1.2536131056095036d+188)) then
                    tmp = t_1
                else if (z < 4.446702369113811d+64) then
                    tmp = x + ((y - z) / ((a - z) / (t - x)))
                else
                    tmp = t_1
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z, double t, double a) {
            	double t_1 = t - ((y / z) * (t - x));
            	double tmp;
            	if (z < -1.2536131056095036e+188) {
            		tmp = t_1;
            	} else if (z < 4.446702369113811e+64) {
            		tmp = x + ((y - z) / ((a - z) / (t - x)));
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a):
            	t_1 = t - ((y / z) * (t - x))
            	tmp = 0
            	if z < -1.2536131056095036e+188:
            		tmp = t_1
            	elif z < 4.446702369113811e+64:
            		tmp = x + ((y - z) / ((a - z) / (t - x)))
            	else:
            		tmp = t_1
            	return tmp
            
            function code(x, y, z, t, a)
            	t_1 = Float64(t - Float64(Float64(y / z) * Float64(t - x)))
            	tmp = 0.0
            	if (z < -1.2536131056095036e+188)
            		tmp = t_1;
            	elseif (z < 4.446702369113811e+64)
            		tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x))));
            	else
            		tmp = t_1;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t, a)
            	t_1 = t - ((y / z) * (t - x));
            	tmp = 0.0;
            	if (z < -1.2536131056095036e+188)
            		tmp = t_1;
            	elseif (z < 4.446702369113811e+64)
            		tmp = x + ((y - z) / ((a - z) / (t - x)));
            	else
            		tmp = t_1;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y / z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -1.2536131056095036e+188], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\
            \mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
            \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \end{array}
            \end{array}
            

            Reproduce

            ?
            herbie shell --seed 2024230 
            (FPCore (x y z t a)
              :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
              :precision binary64
            
              :alt
              (! :herbie-platform default (if (< z -125361310560950360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- t (* (/ y z) (- t x))) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x))))))
            
              (+ x (/ (* (- y z) (- t x)) (- a z))))