Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D

Percentage Accurate: 92.5% → 97.7%
Time: 8.1s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \frac{y \cdot \left(z - x\right)}{t} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
	return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y * (z - x)) / t);
}
def code(x, y, z, t):
	return x + ((y * (z - x)) / t)
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y * Float64(z - x)) / t))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y * (z - x)) / t);
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ x + \frac{y \cdot \left(z - x\right)}{t} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
	return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y * (z - x)) / t);
}
def code(x, y, z, t):
	return x + ((y * (z - x)) / t)
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y * Float64(z - x)) / t))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y * (z - x)) / t);
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 97.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y}{t} \cdot \left(z - x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
	return x + ((y / t) * (z - x));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y / t) * (z - x));
}
def code(x, y, z, t):
	return x + ((y / t) * (z - x))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y / t) * Float64(z - x)))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y / t) * (z - x));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[x + \frac{y \cdot \left(z - x\right)}{t} \]
  2. Step-by-step derivation
    1. associate-*l/97.8%

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

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

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

Alternative 2: 50.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-\frac{x}{t}\right)\\ \mathbf{if}\;t \leq -9.2 \cdot 10^{+167}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -85000000:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -8.1 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{-98}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-193}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 6 \cdot 10^{-20}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- (/ x t)))))
   (if (<= t -9.2e+167)
     x
     (if (<= t -85000000.0)
       (* y (/ z t))
       (if (<= t -8.1e-75)
         t_1
         (if (<= t -1.25e-98)
           (/ (* y z) t)
           (if (<= t 1.75e-193) t_1 (if (<= t 6e-20) (* (/ y t) z) x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -(x / t);
	double tmp;
	if (t <= -9.2e+167) {
		tmp = x;
	} else if (t <= -85000000.0) {
		tmp = y * (z / t);
	} else if (t <= -8.1e-75) {
		tmp = t_1;
	} else if (t <= -1.25e-98) {
		tmp = (y * z) / t;
	} else if (t <= 1.75e-193) {
		tmp = t_1;
	} else if (t <= 6e-20) {
		tmp = (y / t) * z;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * -(x / t)
    if (t <= (-9.2d+167)) then
        tmp = x
    else if (t <= (-85000000.0d0)) then
        tmp = y * (z / t)
    else if (t <= (-8.1d-75)) then
        tmp = t_1
    else if (t <= (-1.25d-98)) then
        tmp = (y * z) / t
    else if (t <= 1.75d-193) then
        tmp = t_1
    else if (t <= 6d-20) then
        tmp = (y / t) * z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * -(x / t);
	double tmp;
	if (t <= -9.2e+167) {
		tmp = x;
	} else if (t <= -85000000.0) {
		tmp = y * (z / t);
	} else if (t <= -8.1e-75) {
		tmp = t_1;
	} else if (t <= -1.25e-98) {
		tmp = (y * z) / t;
	} else if (t <= 1.75e-193) {
		tmp = t_1;
	} else if (t <= 6e-20) {
		tmp = (y / t) * z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * -(x / t)
	tmp = 0
	if t <= -9.2e+167:
		tmp = x
	elif t <= -85000000.0:
		tmp = y * (z / t)
	elif t <= -8.1e-75:
		tmp = t_1
	elif t <= -1.25e-98:
		tmp = (y * z) / t
	elif t <= 1.75e-193:
		tmp = t_1
	elif t <= 6e-20:
		tmp = (y / t) * z
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-Float64(x / t)))
	tmp = 0.0
	if (t <= -9.2e+167)
		tmp = x;
	elseif (t <= -85000000.0)
		tmp = Float64(y * Float64(z / t));
	elseif (t <= -8.1e-75)
		tmp = t_1;
	elseif (t <= -1.25e-98)
		tmp = Float64(Float64(y * z) / t);
	elseif (t <= 1.75e-193)
		tmp = t_1;
	elseif (t <= 6e-20)
		tmp = Float64(Float64(y / t) * z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * -(x / t);
	tmp = 0.0;
	if (t <= -9.2e+167)
		tmp = x;
	elseif (t <= -85000000.0)
		tmp = y * (z / t);
	elseif (t <= -8.1e-75)
		tmp = t_1;
	elseif (t <= -1.25e-98)
		tmp = (y * z) / t;
	elseif (t <= 1.75e-193)
		tmp = t_1;
	elseif (t <= 6e-20)
		tmp = (y / t) * z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-N[(x / t), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[t, -9.2e+167], x, If[LessEqual[t, -85000000.0], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -8.1e-75], t$95$1, If[LessEqual[t, -1.25e-98], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 1.75e-193], t$95$1, If[LessEqual[t, 6e-20], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(-\frac{x}{t}\right)\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+167}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -85000000:\\
\;\;\;\;y \cdot \frac{z}{t}\\

\mathbf{elif}\;t \leq -8.1 \cdot 10^{-75}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -1.25 \cdot 10^{-98}:\\
\;\;\;\;\frac{y \cdot z}{t}\\

\mathbf{elif}\;t \leq 1.75 \cdot 10^{-193}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 6 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if t < -9.19999999999999952e167 or 6.00000000000000057e-20 < t

    1. Initial program 91.7%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/99.5%

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

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

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

    if -9.19999999999999952e167 < t < -8.5e7

    1. Initial program 90.7%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/96.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified96.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 67.5%

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

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

    if -8.5e7 < t < -8.10000000000000034e-75 or -1.25000000000000005e-98 < t < 1.75000000000000002e-193

    1. Initial program 98.5%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/97.3%

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

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 75.6%

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

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot \frac{x}{t}\right)} \]
    6. Step-by-step derivation
      1. associate-*r/65.1%

        \[\leadsto y \cdot \color{blue}{\frac{-1 \cdot x}{t}} \]
      2. neg-mul-165.1%

        \[\leadsto y \cdot \frac{\color{blue}{-x}}{t} \]
    7. Simplified65.1%

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

    if -8.10000000000000034e-75 < t < -1.25000000000000005e-98

    1. Initial program 99.3%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/73.9%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified73.9%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 72.2%

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

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
      2. div-inv72.2%

        \[\leadsto y \cdot \color{blue}{\left(\left(z - x\right) \cdot \frac{1}{t}\right)} \]
    6. Applied egg-rr72.2%

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

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

    if 1.75000000000000002e-193 < t < 6.00000000000000057e-20

    1. Initial program 99.8%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/99.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 84.5%

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

        \[\leadsto \color{blue}{\left(\frac{z}{t} - \frac{x}{t}\right) \cdot y} \]
      2. sub-div84.5%

        \[\leadsto \color{blue}{\frac{z - x}{t}} \cdot y \]
      3. associate-/r/94.5%

        \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    6. Applied egg-rr94.5%

      \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    7. Taylor expanded in z around inf 71.2%

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    8. Step-by-step derivation
      1. *-commutative71.2%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
      2. associate-*r/73.6%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    9. Simplified73.6%

      \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification64.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9.2 \cdot 10^{+167}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -85000000:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -8.1 \cdot 10^{-75}:\\ \;\;\;\;y \cdot \left(-\frac{x}{t}\right)\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{-98}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-193}:\\ \;\;\;\;y \cdot \left(-\frac{x}{t}\right)\\ \mathbf{elif}\;t \leq 6 \cdot 10^{-20}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 3: 50.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x \cdot \left(-y\right)}{t}\\ \mathbf{if}\;t \leq -1.06 \cdot 10^{+169}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -45000000:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -3.5 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -9 \cdot 10^{-100}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 3.25 \cdot 10^{-193}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{-20}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* x (- y)) t)))
   (if (<= t -1.06e+169)
     x
     (if (<= t -45000000.0)
       (* y (/ z t))
       (if (<= t -3.5e-75)
         t_1
         (if (<= t -9e-100)
           (/ (* y z) t)
           (if (<= t 3.25e-193) t_1 (if (<= t 6.5e-20) (* (/ y t) z) x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * -y) / t;
	double tmp;
	if (t <= -1.06e+169) {
		tmp = x;
	} else if (t <= -45000000.0) {
		tmp = y * (z / t);
	} else if (t <= -3.5e-75) {
		tmp = t_1;
	} else if (t <= -9e-100) {
		tmp = (y * z) / t;
	} else if (t <= 3.25e-193) {
		tmp = t_1;
	} else if (t <= 6.5e-20) {
		tmp = (y / t) * z;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x * -y) / t
    if (t <= (-1.06d+169)) then
        tmp = x
    else if (t <= (-45000000.0d0)) then
        tmp = y * (z / t)
    else if (t <= (-3.5d-75)) then
        tmp = t_1
    else if (t <= (-9d-100)) then
        tmp = (y * z) / t
    else if (t <= 3.25d-193) then
        tmp = t_1
    else if (t <= 6.5d-20) then
        tmp = (y / t) * z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x * -y) / t;
	double tmp;
	if (t <= -1.06e+169) {
		tmp = x;
	} else if (t <= -45000000.0) {
		tmp = y * (z / t);
	} else if (t <= -3.5e-75) {
		tmp = t_1;
	} else if (t <= -9e-100) {
		tmp = (y * z) / t;
	} else if (t <= 3.25e-193) {
		tmp = t_1;
	} else if (t <= 6.5e-20) {
		tmp = (y / t) * z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x * -y) / t
	tmp = 0
	if t <= -1.06e+169:
		tmp = x
	elif t <= -45000000.0:
		tmp = y * (z / t)
	elif t <= -3.5e-75:
		tmp = t_1
	elif t <= -9e-100:
		tmp = (y * z) / t
	elif t <= 3.25e-193:
		tmp = t_1
	elif t <= 6.5e-20:
		tmp = (y / t) * z
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x * Float64(-y)) / t)
	tmp = 0.0
	if (t <= -1.06e+169)
		tmp = x;
	elseif (t <= -45000000.0)
		tmp = Float64(y * Float64(z / t));
	elseif (t <= -3.5e-75)
		tmp = t_1;
	elseif (t <= -9e-100)
		tmp = Float64(Float64(y * z) / t);
	elseif (t <= 3.25e-193)
		tmp = t_1;
	elseif (t <= 6.5e-20)
		tmp = Float64(Float64(y / t) * z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x * -y) / t;
	tmp = 0.0;
	if (t <= -1.06e+169)
		tmp = x;
	elseif (t <= -45000000.0)
		tmp = y * (z / t);
	elseif (t <= -3.5e-75)
		tmp = t_1;
	elseif (t <= -9e-100)
		tmp = (y * z) / t;
	elseif (t <= 3.25e-193)
		tmp = t_1;
	elseif (t <= 6.5e-20)
		tmp = (y / t) * z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -1.06e+169], x, If[LessEqual[t, -45000000.0], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.5e-75], t$95$1, If[LessEqual[t, -9e-100], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 3.25e-193], t$95$1, If[LessEqual[t, 6.5e-20], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(-y\right)}{t}\\
\mathbf{if}\;t \leq -1.06 \cdot 10^{+169}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -45000000:\\
\;\;\;\;y \cdot \frac{z}{t}\\

\mathbf{elif}\;t \leq -3.5 \cdot 10^{-75}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -9 \cdot 10^{-100}:\\
\;\;\;\;\frac{y \cdot z}{t}\\

\mathbf{elif}\;t \leq 3.25 \cdot 10^{-193}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 6.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if t < -1.05999999999999995e169 or 6.50000000000000032e-20 < t

    1. Initial program 91.7%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/99.5%

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

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

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

    if -1.05999999999999995e169 < t < -4.5e7

    1. Initial program 90.7%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/96.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified96.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 67.5%

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

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

    if -4.5e7 < t < -3.49999999999999985e-75 or -9.0000000000000002e-100 < t < 3.2500000000000002e-193

    1. Initial program 98.5%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/97.3%

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

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in x around inf 80.1%

      \[\leadsto \color{blue}{\left(1 + -1 \cdot \frac{y}{t}\right) \cdot x} \]
    5. Step-by-step derivation
      1. *-commutative80.1%

        \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
      2. distribute-lft-in80.1%

        \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-1 \cdot \frac{y}{t}\right)} \]
      3. *-rgt-identity80.1%

        \[\leadsto \color{blue}{x} + x \cdot \left(-1 \cdot \frac{y}{t}\right) \]
      4. mul-1-neg80.1%

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{y}{t}\right)} \]
      5. distribute-rgt-neg-in80.1%

        \[\leadsto x + \color{blue}{\left(-x \cdot \frac{y}{t}\right)} \]
      6. unsub-neg80.1%

        \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    6. Simplified80.1%

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    7. Taylor expanded in x around 0 80.2%

      \[\leadsto x - \color{blue}{\frac{y \cdot x}{t}} \]
    8. Taylor expanded in y around inf 71.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x}{t}} \]
    9. Step-by-step derivation
      1. associate-*r/71.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y \cdot x\right)}{t}} \]
      2. neg-mul-171.1%

        \[\leadsto \frac{\color{blue}{-y \cdot x}}{t} \]
      3. distribute-rgt-neg-in71.1%

        \[\leadsto \frac{\color{blue}{y \cdot \left(-x\right)}}{t} \]
    10. Simplified71.1%

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

    if -3.49999999999999985e-75 < t < -9.0000000000000002e-100

    1. Initial program 99.3%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/73.9%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified73.9%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 72.2%

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

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
      2. div-inv72.2%

        \[\leadsto y \cdot \color{blue}{\left(\left(z - x\right) \cdot \frac{1}{t}\right)} \]
    6. Applied egg-rr72.2%

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

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

    if 3.2500000000000002e-193 < t < 6.50000000000000032e-20

    1. Initial program 99.8%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/99.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 84.5%

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

        \[\leadsto \color{blue}{\left(\frac{z}{t} - \frac{x}{t}\right) \cdot y} \]
      2. sub-div84.5%

        \[\leadsto \color{blue}{\frac{z - x}{t}} \cdot y \]
      3. associate-/r/94.5%

        \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    6. Applied egg-rr94.5%

      \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    7. Taylor expanded in z around inf 71.2%

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    8. Step-by-step derivation
      1. *-commutative71.2%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
      2. associate-*r/73.6%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    9. Simplified73.6%

      \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification66.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.06 \cdot 10^{+169}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -45000000:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -3.5 \cdot 10^{-75}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \mathbf{elif}\;t \leq -9 \cdot 10^{-100}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 3.25 \cdot 10^{-193}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{-20}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 4: 73.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.2 \cdot 10^{-111} \lor \neg \left(t \leq 2.4 \cdot 10^{-194}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -2.2e-111) (not (<= t 2.4e-194)))
   (+ x (* (/ y t) z))
   (/ (* x (- y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.2e-111) || !(t <= 2.4e-194)) {
		tmp = x + ((y / t) * z);
	} else {
		tmp = (x * -y) / t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((t <= (-2.2d-111)) .or. (.not. (t <= 2.4d-194))) then
        tmp = x + ((y / t) * z)
    else
        tmp = (x * -y) / t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.2e-111) || !(t <= 2.4e-194)) {
		tmp = x + ((y / t) * z);
	} else {
		tmp = (x * -y) / t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -2.2e-111) or not (t <= 2.4e-194):
		tmp = x + ((y / t) * z)
	else:
		tmp = (x * -y) / t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -2.2e-111) || !(t <= 2.4e-194))
		tmp = Float64(x + Float64(Float64(y / t) * z));
	else
		tmp = Float64(Float64(x * Float64(-y)) / t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -2.2e-111) || ~((t <= 2.4e-194)))
		tmp = x + ((y / t) * z);
	else
		tmp = (x * -y) / t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.2e-111], N[Not[LessEqual[t, 2.4e-194]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-111} \lor \neg \left(t \leq 2.4 \cdot 10^{-194}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.2e-111 or 2.4e-194 < t

    1. Initial program 93.9%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/98.2%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified98.2%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in z around inf 80.0%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    5. Step-by-step derivation
      1. associate-*l/81.3%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative81.3%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified81.3%

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

    if -2.2e-111 < t < 2.4e-194

    1. Initial program 98.2%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/96.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified96.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in x around inf 78.7%

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

        \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
      2. distribute-lft-in78.7%

        \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-1 \cdot \frac{y}{t}\right)} \]
      3. *-rgt-identity78.7%

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

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{y}{t}\right)} \]
      5. distribute-rgt-neg-in78.7%

        \[\leadsto x + \color{blue}{\left(-x \cdot \frac{y}{t}\right)} \]
      6. unsub-neg78.7%

        \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    6. Simplified78.7%

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    7. Taylor expanded in x around 0 78.9%

      \[\leadsto x - \color{blue}{\frac{y \cdot x}{t}} \]
    8. Taylor expanded in y around inf 74.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x}{t}} \]
    9. Step-by-step derivation
      1. associate-*r/74.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y \cdot x\right)}{t}} \]
      2. neg-mul-174.0%

        \[\leadsto \frac{\color{blue}{-y \cdot x}}{t} \]
      3. distribute-rgt-neg-in74.0%

        \[\leadsto \frac{\color{blue}{y \cdot \left(-x\right)}}{t} \]
    10. Simplified74.0%

      \[\leadsto \color{blue}{\frac{y \cdot \left(-x\right)}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.2 \cdot 10^{-111} \lor \neg \left(t \leq 2.4 \cdot 10^{-194}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \end{array} \]

Alternative 5: 85.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{-7} \lor \neg \left(z \leq 2.9 \cdot 10^{+17}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -1.65e-7) (not (<= z 2.9e+17)))
   (+ x (* (/ y t) z))
   (- x (* x (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.65e-7) || !(z <= 2.9e+17)) {
		tmp = x + ((y / t) * z);
	} else {
		tmp = x - (x * (y / t));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z <= (-1.65d-7)) .or. (.not. (z <= 2.9d+17))) then
        tmp = x + ((y / t) * z)
    else
        tmp = x - (x * (y / t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.65e-7) || !(z <= 2.9e+17)) {
		tmp = x + ((y / t) * z);
	} else {
		tmp = x - (x * (y / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -1.65e-7) or not (z <= 2.9e+17):
		tmp = x + ((y / t) * z)
	else:
		tmp = x - (x * (y / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -1.65e-7) || !(z <= 2.9e+17))
		tmp = Float64(x + Float64(Float64(y / t) * z));
	else
		tmp = Float64(x - Float64(x * Float64(y / t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -1.65e-7) || ~((z <= 2.9e+17)))
		tmp = x + ((y / t) * z);
	else
		tmp = x - (x * (y / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e-7], N[Not[LessEqual[z, 2.9e+17]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-7} \lor \neg \left(z \leq 2.9 \cdot 10^{+17}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6500000000000001e-7 or 2.9e17 < z

    1. Initial program 92.9%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/98.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified98.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in z around inf 86.0%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    5. Step-by-step derivation
      1. associate-*l/88.6%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative88.6%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified88.6%

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

    if -1.6500000000000001e-7 < z < 2.9e17

    1. Initial program 96.9%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/97.1%

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

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in x around inf 87.1%

      \[\leadsto \color{blue}{\left(1 + -1 \cdot \frac{y}{t}\right) \cdot x} \]
    5. Step-by-step derivation
      1. *-commutative87.1%

        \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
      2. distribute-lft-in87.1%

        \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-1 \cdot \frac{y}{t}\right)} \]
      3. *-rgt-identity87.1%

        \[\leadsto \color{blue}{x} + x \cdot \left(-1 \cdot \frac{y}{t}\right) \]
      4. mul-1-neg87.1%

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{y}{t}\right)} \]
      5. distribute-rgt-neg-in87.1%

        \[\leadsto x + \color{blue}{\left(-x \cdot \frac{y}{t}\right)} \]
      6. unsub-neg87.1%

        \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    6. Simplified87.1%

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{-7} \lor \neg \left(z \leq 2.9 \cdot 10^{+17}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \end{array} \]

Alternative 6: 72.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.2 \cdot 10^{-112}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 7.6 \cdot 10^{-194}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.2e-112)
   (+ x (/ y (/ t z)))
   (if (<= t 7.6e-194) (/ (* x (- y)) t) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.2e-112) {
		tmp = x + (y / (t / z));
	} else if (t <= 7.6e-194) {
		tmp = (x * -y) / t;
	} else {
		tmp = x + ((y / t) * z);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.2d-112)) then
        tmp = x + (y / (t / z))
    else if (t <= 7.6d-194) then
        tmp = (x * -y) / t
    else
        tmp = x + ((y / t) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.2e-112) {
		tmp = x + (y / (t / z));
	} else if (t <= 7.6e-194) {
		tmp = (x * -y) / t;
	} else {
		tmp = x + ((y / t) * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -1.2e-112:
		tmp = x + (y / (t / z))
	elif t <= 7.6e-194:
		tmp = (x * -y) / t
	else:
		tmp = x + ((y / t) * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.2e-112)
		tmp = Float64(x + Float64(y / Float64(t / z)));
	elseif (t <= 7.6e-194)
		tmp = Float64(Float64(x * Float64(-y)) / t);
	else
		tmp = Float64(x + Float64(Float64(y / t) * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.2e-112)
		tmp = x + (y / (t / z));
	elseif (t <= 7.6e-194)
		tmp = (x * -y) / t;
	else
		tmp = x + ((y / t) * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e-112], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e-194], N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-112}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\

\mathbf{elif}\;t \leq 7.6 \cdot 10^{-194}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.2e-112

    1. Initial program 91.4%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-/l*98.1%

        \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - x}}} \]
    3. Simplified98.1%

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

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

    if -1.2e-112 < t < 7.6000000000000006e-194

    1. Initial program 98.2%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/96.7%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified96.7%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in x around inf 78.7%

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

        \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
      2. distribute-lft-in78.7%

        \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-1 \cdot \frac{y}{t}\right)} \]
      3. *-rgt-identity78.7%

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

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{y}{t}\right)} \]
      5. distribute-rgt-neg-in78.7%

        \[\leadsto x + \color{blue}{\left(-x \cdot \frac{y}{t}\right)} \]
      6. unsub-neg78.7%

        \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    6. Simplified78.7%

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    7. Taylor expanded in x around 0 78.9%

      \[\leadsto x - \color{blue}{\frac{y \cdot x}{t}} \]
    8. Taylor expanded in y around inf 74.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x}{t}} \]
    9. Step-by-step derivation
      1. associate-*r/74.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y \cdot x\right)}{t}} \]
      2. neg-mul-174.0%

        \[\leadsto \frac{\color{blue}{-y \cdot x}}{t} \]
      3. distribute-rgt-neg-in74.0%

        \[\leadsto \frac{\color{blue}{y \cdot \left(-x\right)}}{t} \]
    10. Simplified74.0%

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

    if 7.6000000000000006e-194 < t

    1. Initial program 95.7%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/99.4%

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

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in z around inf 79.5%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    5. Step-by-step derivation
      1. associate-*l/82.3%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative82.3%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified82.3%

      \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.2 \cdot 10^{-112}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 7.6 \cdot 10^{-194}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \end{array} \]

Alternative 7: 54.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-135} \lor \neg \left(y \leq 0.041\right):\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -5.2e-135) (not (<= y 0.041))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -5.2e-135) || !(y <= 0.041)) {
		tmp = y * (z / t);
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-5.2d-135)) .or. (.not. (y <= 0.041d0))) then
        tmp = y * (z / t)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -5.2e-135) || !(y <= 0.041)) {
		tmp = y * (z / t);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -5.2e-135) or not (y <= 0.041):
		tmp = y * (z / t)
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -5.2e-135) || !(y <= 0.041))
		tmp = Float64(y * Float64(z / t));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -5.2e-135) || ~((y <= 0.041)))
		tmp = y * (z / t);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.2e-135], N[Not[LessEqual[y, 0.041]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-135} \lor \neg \left(y \leq 0.041\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.20000000000000008e-135 or 0.0410000000000000017 < y

    1. Initial program 92.7%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/97.2%

        \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
    3. Simplified97.2%

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 78.7%

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

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

    if -5.20000000000000008e-135 < y < 0.0410000000000000017

    1. Initial program 98.8%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/98.8%

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-135} \lor \neg \left(y \leq 0.041\right):\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 8: 54.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;y \leq 0.24:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -6.2e-138) (* (/ y t) z) (if (<= y 0.24) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -6.2e-138) {
		tmp = (y / t) * z;
	} else if (y <= 0.24) {
		tmp = x;
	} else {
		tmp = y * (z / t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-6.2d-138)) then
        tmp = (y / t) * z
    else if (y <= 0.24d0) then
        tmp = x
    else
        tmp = y * (z / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -6.2e-138) {
		tmp = (y / t) * z;
	} else if (y <= 0.24) {
		tmp = x;
	} else {
		tmp = y * (z / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -6.2e-138:
		tmp = (y / t) * z
	elif y <= 0.24:
		tmp = x
	else:
		tmp = y * (z / t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -6.2e-138)
		tmp = Float64(Float64(y / t) * z);
	elseif (y <= 0.24)
		tmp = x;
	else
		tmp = Float64(y * Float64(z / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -6.2e-138)
		tmp = (y / t) * z;
	elseif (y <= 0.24)
		tmp = x;
	else
		tmp = y * (z / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.2e-138], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 0.24], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{t} \cdot z\\

\mathbf{elif}\;y \leq 0.24:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.1999999999999996e-138

    1. Initial program 91.8%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/98.4%

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

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 72.1%

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

        \[\leadsto \color{blue}{\left(\frac{z}{t} - \frac{x}{t}\right) \cdot y} \]
      2. sub-div75.2%

        \[\leadsto \color{blue}{\frac{z - x}{t}} \cdot y \]
      3. associate-/r/78.4%

        \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    6. Applied egg-rr78.4%

      \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    7. Taylor expanded in z around inf 45.8%

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    8. Step-by-step derivation
      1. *-commutative45.8%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
      2. associate-*r/50.2%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    9. Simplified50.2%

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

    if -6.1999999999999996e-138 < y < 0.23999999999999999

    1. Initial program 98.8%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/98.8%

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

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

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

    if 0.23999999999999999 < y

    1. Initial program 94.0%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Step-by-step derivation
      1. associate-*l/95.6%

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

      \[\leadsto \color{blue}{x + \frac{y}{t} \cdot \left(z - x\right)} \]
    4. Taylor expanded in y around inf 88.4%

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

      \[\leadsto y \cdot \color{blue}{\frac{z}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;y \leq 0.24:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \end{array} \]

Alternative 9: 38.4% accurate, 9.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x
end function
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 95.0%

    \[x + \frac{y \cdot \left(z - x\right)}{t} \]
  2. Step-by-step derivation
    1. associate-*l/97.8%

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification35.9%

    \[\leadsto x \]

Developer target: 90.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
	return x - ((x * (y / t)) + (-z * (y / t)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
	return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t):
	return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t)
	return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t))))
end
function tmp = code(x, y, z, t)
	tmp = x - ((x * (y / t)) + (-z * (y / t)));
end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Reproduce

?
herbie shell --seed 2023174 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

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