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

Percentage Accurate: 67.4% → 70.7%
Time: 1.9s
Alternatives: 7
Speedup: 0.7×

Specification

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

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

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

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

Alternative 1: 70.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+219}:\\
\;\;\;\;y - x\\

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

\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -9.00000000000000047e219

    1. Initial program 9.9%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites48.8%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
    7. Taylor expanded in x around 0

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

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

    if -9.00000000000000047e219 < t < 5.5999999999999998e168

    1. Initial program 76.0%

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

    if 5.5999999999999998e168 < t

    1. Initial program 30.3%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites52.6%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 54.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := x + \frac{y - x}{a - t}\\
\mathbf{if}\;a \leq -3.45 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.4500000000000001e133 or 2e188 < a

    1. Initial program 66.1%

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

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

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

    if -3.4500000000000001e133 < a < 2e188

    1. Initial program 64.6%

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

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

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

Alternative 3: 32.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_1 := x + \frac{y - x}{a - t}\\
\mathbf{if}\;a \leq -8.4 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 2.55 \cdot 10^{+24}:\\
\;\;\;\;y - x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -8.4000000000000001e114 or 2.5499999999999998e24 < a

    1. Initial program 68.0%

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

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

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

    if -8.4000000000000001e114 < a < 2.5499999999999998e24

    1. Initial program 62.9%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites27.6%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
    7. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{y - x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 29.7% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;t \leq 2.35 \cdot 10^{-9}:\\
\;\;\;\;x + \left(y - x\right) \cdot \left(z - t\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.79999999999999981e117

    1. Initial program 28.1%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites35.0%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
    7. Taylor expanded in x around 0

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

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

    if -7.79999999999999981e117 < t < 2.34999999999999995e-9

    1. Initial program 87.7%

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

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

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

    if 2.34999999999999995e-9 < t

    1. Initial program 42.4%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites41.2%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 23.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_1 := x + \left(a - t\right)\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.4 \cdot 10^{+146}:\\
\;\;\;\;x + \left(y - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.3000000000000001e99 or 1.4e146 < x

    1. Initial program 51.1%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites5.2%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
    7. Taylor expanded in x around inf

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

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

    if -4.3000000000000001e99 < x < 1.4e146

    1. Initial program 69.9%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites26.3%

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

Alternative 6: 23.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_1 := x + \left(a - t\right)\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 5.2 \cdot 10^{+147}:\\
\;\;\;\;y - x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.3000000000000001e99 or 5.1999999999999997e147 < x

    1. Initial program 51.9%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites5.3%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
    7. Taylor expanded in x around inf

      \[\leadsto x + \color{blue}{-1 \cdot \frac{x \cdot \left(z - t\right)}{a - t}} \]
    8. Applied rewrites24.6%

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

    if -4.3000000000000001e99 < x < 5.1999999999999997e147

    1. Initial program 69.6%

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

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

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

      \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
    6. Applied rewrites26.2%

      \[\leadsto x + \left(y - \color{blue}{x}\right) \]
    7. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{y - x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 19.0% accurate, 7.3× speedup?

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

\\
y - x
\end{array}
Derivation
  1. Initial program 65.0%

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

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

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

    \[\leadsto x + y \cdot \color{blue}{\left(z - t\right)} \]
  6. Applied rewrites20.8%

    \[\leadsto x + \left(y - \color{blue}{x}\right) \]
  7. Taylor expanded in x around 0

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

    \[\leadsto \color{blue}{y - x} \]
  9. Add Preprocessing

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

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

\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024313 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))

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