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

Percentage Accurate: 67.7% → 67.7%
Time: 2.0s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\mathsf{TRUE}\left(\right)\]
\[\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 9 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.7% 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: 67.7% 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}
Derivation
  1. Initial program 64.7%

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

Alternative 2: 53.5% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.6999999999999999e92 or 1.4999999999999999e77 < a

    1. Initial program 67.7%

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

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

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

    if -1.6999999999999999e92 < a < 1.4999999999999999e77

    1. Initial program 63.2%

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

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

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

Alternative 3: 24.7% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.4e140

    1. Initial program 64.5%

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

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

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

    if -3.4e140 < t

    1. Initial program 64.8%

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

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

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

Alternative 4: 19.7% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.4000000000000001e25

    1. Initial program 70.6%

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

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

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

    if 1.4000000000000001e25 < x

    1. Initial program 50.5%

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

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

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

Alternative 5: 18.6% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.9999999999999998e41

    1. Initial program 70.4%

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

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

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

    if 2.9999999999999998e41 < x

    1. Initial program 49.6%

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

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

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

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

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

Alternative 6: 18.4% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+153}:\\
\;\;\;\;\left(y - z\right) \cdot \left(y - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.79999999999999966e153

    1. Initial program 64.0%

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

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

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

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

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

      \[\leadsto \left(y - z\right) \cdot t \]
    8. Applied rewrites26.7%

      \[\leadsto \left(y - z\right) \cdot \left(y - z\right) \]

    if -3.79999999999999966e153 < y

    1. Initial program 64.8%

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

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

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

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

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

Alternative 7: 17.0% accurate, 4.1× speedup?

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

\\
x + \left(y - z\right)
\end{array}
Derivation
  1. Initial program 64.7%

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

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

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

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

    \[\leadsto x + \left(y - \color{blue}{z}\right) \]
  7. Add Preprocessing

Alternative 8: 9.9% accurate, 4.1× speedup?

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

\\
x + \left(a - z\right)
\end{array}
Derivation
  1. Initial program 64.7%

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

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

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

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

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

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

    \[\leadsto x + \left(a - \color{blue}{z}\right) \]
  9. Add Preprocessing

Alternative 9: 3.3% accurate, 7.3× speedup?

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

\\
y - z
\end{array}
Derivation
  1. Initial program 64.7%

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

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

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

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

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

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

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

Developer Target 1: 84.0% 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 2024321 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64
  :pre (TRUE)

  :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))))