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

Percentage Accurate: 67.1% → 88.8%
Time: 11.6s
Alternatives: 16
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 16 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: 67.1% 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.8% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 28.5%

      \[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. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)} \]
      8. lower-/.f6463.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)} \]
    5. 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}} \]
    6. 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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{t - x}}{z} \cdot \left(y - a\right) \]
      14. lower--.f6490.2

        \[\leadsto t - \frac{t - x}{z} \cdot \color{blue}{\left(y - a\right)} \]
    7. Applied rewrites90.2%

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

    if -3.30000000000000009e103 < z < 1.44999999999999987e136

    1. Initial program 88.4%

      \[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. *-commutativeN/A

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

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

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

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

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

    if 1.44999999999999987e136 < z

    1. Initial program 28.1%

      \[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. distribute-rgt-out--N/A

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

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

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

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

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

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

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

Alternative 2: 73.5% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq -6.3 \cdot 10^{-117}:\\
\;\;\;\;x + \frac{t \cdot \left(y - z\right)}{a - z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.4999999999999999e102

    1. Initial program 33.7%

      \[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. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)} \]
      8. lower-/.f6467.1

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)} \]
    5. 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}} \]
    6. 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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4999999999999999e102 < z < -6.2999999999999997e-117

    1. Initial program 77.4%

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

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

        \[\leadsto x + \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      2. lower--.f6463.4

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

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

    if -6.2999999999999997e-117 < z < 1.41999999999999998e135

    1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

    if 1.41999999999999998e135 < z

    1. Initial program 31.0%

      \[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. distribute-rgt-out--N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x + \left(-t\right), \frac{y - a}{z}, t\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification73.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+102}:\\ \;\;\;\;t + \left(y - a\right) \cdot \frac{x - t}{z}\\ \mathbf{elif}\;z \leq -6.3 \cdot 10^{-117}:\\ \;\;\;\;x + \frac{t \cdot \left(y - z\right)}{a - z}\\ \mathbf{elif}\;z \leq 1.42 \cdot 10^{+135}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\ \end{array} \]
  5. Add Preprocessing

Developer Target 1: 83.4% 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 2024233 
(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))))