Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C

Percentage Accurate: 99.9% → 99.9%
Time: 8.2s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \sin y\right) + z \cdot \cos y
\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 13 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: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}

Alternative 1: 99.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z, \cos y, x + \sin y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
	return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z)
	return fma(z, cos(y), Float64(x + sin(y)))
end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Step-by-step derivation
    1. +-commutative99.9%

      \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
    2. fma-def99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
  4. Final simplification99.9%

    \[\leadsto \mathsf{fma}\left(z, \cos y, x + \sin y\right) \]

Alternative 2: 89.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-19} \lor \neg \left(x \leq 1.45 \cdot 10^{-77}\right):\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\sin y + z \cdot \cos y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -2.3e-19) (not (<= x 1.45e-77)))
   (+ z (+ x (sin y)))
   (+ (sin y) (* z (cos y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -2.3e-19) || !(x <= 1.45e-77)) {
		tmp = z + (x + sin(y));
	} else {
		tmp = sin(y) + (z * cos(y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-2.3d-19)) .or. (.not. (x <= 1.45d-77))) then
        tmp = z + (x + sin(y))
    else
        tmp = sin(y) + (z * cos(y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -2.3e-19) || !(x <= 1.45e-77)) {
		tmp = z + (x + Math.sin(y));
	} else {
		tmp = Math.sin(y) + (z * Math.cos(y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -2.3e-19) or not (x <= 1.45e-77):
		tmp = z + (x + math.sin(y))
	else:
		tmp = math.sin(y) + (z * math.cos(y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -2.3e-19) || !(x <= 1.45e-77))
		tmp = Float64(z + Float64(x + sin(y)));
	else
		tmp = Float64(sin(y) + Float64(z * cos(y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -2.3e-19) || ~((x <= 1.45e-77)))
		tmp = z + (x + sin(y));
	else
		tmp = sin(y) + (z * cos(y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.3e-19], N[Not[LessEqual[x, 1.45e-77]], $MachinePrecision]], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-19} \lor \neg \left(x \leq 1.45 \cdot 10^{-77}\right):\\
\;\;\;\;z + \left(x + \sin y\right)\\

\mathbf{else}:\\
\;\;\;\;\sin y + z \cdot \cos y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.2999999999999998e-19 or 1.4499999999999999e-77 < x

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 87.8%

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

    if -2.2999999999999998e-19 < x < 1.4499999999999999e-77

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. fma-def99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
    4. Taylor expanded in x around 0 91.1%

      \[\leadsto \color{blue}{\cos y \cdot z + \sin y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-19} \lor \neg \left(x \leq 1.45 \cdot 10^{-77}\right):\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\sin y + z \cdot \cos y\\ \end{array} \]

Alternative 3: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Final simplification99.9%

    \[\leadsto \left(x + \sin y\right) + z \cdot \cos y \]

Alternative 4: 89.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ t_1 := t_0 + \left(y + x\right)\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{+55}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+151} \lor \neg \left(z \leq 4.3 \cdot 10^{+251}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))) (t_1 (+ t_0 (+ y x))))
   (if (<= z -5.4e+137)
     t_1
     (if (<= z 2.05e+55)
       (+ z (+ x (sin y)))
       (if (or (<= z 2.5e+151) (not (<= z 4.3e+251))) t_0 t_1)))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double t_1 = t_0 + (y + x);
	double tmp;
	if (z <= -5.4e+137) {
		tmp = t_1;
	} else if (z <= 2.05e+55) {
		tmp = z + (x + sin(y));
	} else if ((z <= 2.5e+151) || !(z <= 4.3e+251)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z * cos(y)
    t_1 = t_0 + (y + x)
    if (z <= (-5.4d+137)) then
        tmp = t_1
    else if (z <= 2.05d+55) then
        tmp = z + (x + sin(y))
    else if ((z <= 2.5d+151) .or. (.not. (z <= 4.3d+251))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * Math.cos(y);
	double t_1 = t_0 + (y + x);
	double tmp;
	if (z <= -5.4e+137) {
		tmp = t_1;
	} else if (z <= 2.05e+55) {
		tmp = z + (x + Math.sin(y));
	} else if ((z <= 2.5e+151) || !(z <= 4.3e+251)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.cos(y)
	t_1 = t_0 + (y + x)
	tmp = 0
	if z <= -5.4e+137:
		tmp = t_1
	elif z <= 2.05e+55:
		tmp = z + (x + math.sin(y))
	elif (z <= 2.5e+151) or not (z <= 4.3e+251):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(z * cos(y))
	t_1 = Float64(t_0 + Float64(y + x))
	tmp = 0.0
	if (z <= -5.4e+137)
		tmp = t_1;
	elseif (z <= 2.05e+55)
		tmp = Float64(z + Float64(x + sin(y)));
	elseif ((z <= 2.5e+151) || !(z <= 4.3e+251))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * cos(y);
	t_1 = t_0 + (y + x);
	tmp = 0.0;
	if (z <= -5.4e+137)
		tmp = t_1;
	elseif (z <= 2.05e+55)
		tmp = z + (x + sin(y));
	elseif ((z <= 2.5e+151) || ~((z <= 4.3e+251)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e+137], t$95$1, If[LessEqual[z, 2.05e+55], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.5e+151], N[Not[LessEqual[z, 4.3e+251]], $MachinePrecision]], t$95$0, t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
t_1 := t_0 + \left(y + x\right)\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+137}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.05 \cdot 10^{+55}:\\
\;\;\;\;z + \left(x + \sin y\right)\\

\mathbf{elif}\;z \leq 2.5 \cdot 10^{+151} \lor \neg \left(z \leq 4.3 \cdot 10^{+251}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.40000000000000034e137 or 2.5000000000000001e151 < z < 4.3e251

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 89.5%

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

    if -5.40000000000000034e137 < z < 2.04999999999999991e55

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 94.2%

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

    if 2.04999999999999991e55 < z < 2.5000000000000001e151 or 4.3e251 < z

    1. Initial program 99.7%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. log1p-expm1-u99.7%

        \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    3. Applied egg-rr99.7%

      \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    4. Taylor expanded in z around inf 81.0%

      \[\leadsto \color{blue}{\cos y \cdot z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+137}:\\ \;\;\;\;z \cdot \cos y + \left(y + x\right)\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{+55}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+151} \lor \neg \left(z \leq 4.3 \cdot 10^{+251}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y + \left(y + x\right)\\ \end{array} \]

Alternative 5: 88.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 1.95 \cdot 10^{+55}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -9.2e+232) (not (<= z 1.95e+55)))
   (* z (cos y))
   (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -9.2e+232) || !(z <= 1.95e+55)) {
		tmp = z * cos(y);
	} else {
		tmp = z + (x + sin(y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-9.2d+232)) .or. (.not. (z <= 1.95d+55))) then
        tmp = z * cos(y)
    else
        tmp = z + (x + sin(y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -9.2e+232) || !(z <= 1.95e+55)) {
		tmp = z * Math.cos(y);
	} else {
		tmp = z + (x + Math.sin(y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -9.2e+232) or not (z <= 1.95e+55):
		tmp = z * math.cos(y)
	else:
		tmp = z + (x + math.sin(y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -9.2e+232) || !(z <= 1.95e+55))
		tmp = Float64(z * cos(y));
	else
		tmp = Float64(z + Float64(x + sin(y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -9.2e+232) || ~((z <= 1.95e+55)))
		tmp = z * cos(y);
	else
		tmp = z + (x + sin(y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.2e+232], N[Not[LessEqual[z, 1.95e+55]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 1.95 \cdot 10^{+55}\right):\\
\;\;\;\;z \cdot \cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.20000000000000024e232 or 1.95000000000000014e55 < z

    1. Initial program 99.8%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. log1p-expm1-u99.8%

        \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    3. Applied egg-rr99.8%

      \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    4. Taylor expanded in z around inf 80.3%

      \[\leadsto \color{blue}{\cos y \cdot z} \]

    if -9.20000000000000024e232 < z < 1.95000000000000014e55

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 92.1%

      \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 1.95 \cdot 10^{+55}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \end{array} \]

Alternative 6: 71.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 2 \cdot 10^{+55}\right):\\
\;\;\;\;z \cdot \cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.20000000000000024e232 or 2.00000000000000002e55 < z

    1. Initial program 99.8%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. log1p-expm1-u99.8%

        \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    3. Applied egg-rr99.8%

      \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    4. Taylor expanded in z around inf 80.3%

      \[\leadsto \color{blue}{\cos y \cdot z} \]

    if -9.20000000000000024e232 < z < 2.00000000000000002e55

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 72.3%

      \[\leadsto \color{blue}{z + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 2 \cdot 10^{+55}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \]

Alternative 7: 80.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.061 \lor \neg \left(y \leq 7000\right):\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;\left(z + x\right) + \left(y + z \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -0.061) (not (<= y 7000.0)))
   (+ x (sin y))
   (+ (+ z x) (+ y (* z (* y (* y -0.5)))))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -0.061) || !(y <= 7000.0)) {
		tmp = x + sin(y);
	} else {
		tmp = (z + x) + (y + (z * (y * (y * -0.5))));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-0.061d0)) .or. (.not. (y <= 7000.0d0))) then
        tmp = x + sin(y)
    else
        tmp = (z + x) + (y + (z * (y * (y * (-0.5d0)))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -0.061) || !(y <= 7000.0)) {
		tmp = x + Math.sin(y);
	} else {
		tmp = (z + x) + (y + (z * (y * (y * -0.5))));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -0.061) or not (y <= 7000.0):
		tmp = x + math.sin(y)
	else:
		tmp = (z + x) + (y + (z * (y * (y * -0.5))))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -0.061) || !(y <= 7000.0))
		tmp = Float64(x + sin(y));
	else
		tmp = Float64(Float64(z + x) + Float64(y + Float64(z * Float64(y * Float64(y * -0.5)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -0.061) || ~((y <= 7000.0)))
		tmp = x + sin(y);
	else
		tmp = (z + x) + (y + (z * (y * (y * -0.5))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.061], N[Not[LessEqual[y, 7000.0]], $MachinePrecision]], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y + N[(z * N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.061 \lor \neg \left(y \leq 7000\right):\\
\;\;\;\;x + \sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.060999999999999999 or 7e3 < y

    1. Initial program 99.8%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in z around 0 65.2%

      \[\leadsto \color{blue}{\sin y + x} \]

    if -0.060999999999999999 < y < 7e3

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. log1p-expm1-u100.0%

        \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    3. Applied egg-rr100.0%

      \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    4. Taylor expanded in y around 0 99.2%

      \[\leadsto \color{blue}{-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(y + \left(z + x\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r+99.2%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right) + \left(z + x\right)} \]
      2. +-commutative99.2%

        \[\leadsto \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right) + \color{blue}{\left(x + z\right)} \]
      3. +-commutative99.2%

        \[\leadsto \color{blue}{\left(x + z\right) + \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right)} \]
      4. +-commutative99.2%

        \[\leadsto \color{blue}{\left(z + x\right)} + \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right) \]
      5. associate-*r*99.2%

        \[\leadsto \left(z + x\right) + \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot z} + y\right) \]
      6. fma-def99.2%

        \[\leadsto \left(z + x\right) + \color{blue}{\mathsf{fma}\left(-0.5 \cdot {y}^{2}, z, y\right)} \]
      7. *-commutative99.2%

        \[\leadsto \left(z + x\right) + \mathsf{fma}\left(\color{blue}{{y}^{2} \cdot -0.5}, z, y\right) \]
      8. unpow299.2%

        \[\leadsto \left(z + x\right) + \mathsf{fma}\left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5, z, y\right) \]
    6. Simplified99.2%

      \[\leadsto \color{blue}{\left(z + x\right) + \mathsf{fma}\left(\left(y \cdot y\right) \cdot -0.5, z, y\right)} \]
    7. Step-by-step derivation
      1. fma-udef99.2%

        \[\leadsto \left(z + x\right) + \color{blue}{\left(\left(\left(y \cdot y\right) \cdot -0.5\right) \cdot z + y\right)} \]
      2. associate-*l*99.2%

        \[\leadsto \left(z + x\right) + \left(\color{blue}{\left(y \cdot \left(y \cdot -0.5\right)\right)} \cdot z + y\right) \]
    8. Applied egg-rr99.2%

      \[\leadsto \left(z + x\right) + \color{blue}{\left(\left(y \cdot \left(y \cdot -0.5\right)\right) \cdot z + y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.061 \lor \neg \left(y \leq 7000\right):\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;\left(z + x\right) + \left(y + z \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\\ \end{array} \]

Alternative 8: 69.9% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+14}:\\
\;\;\;\;z + x\\

\mathbf{elif}\;y \leq 10000:\\
\;\;\;\;\left(z + x\right) + \left(y + z \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.5e14 or 1e4 < y

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 43.0%

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

    if -7.5e14 < y < 1e4

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. log1p-expm1-u100.0%

        \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    3. Applied egg-rr100.0%

      \[\leadsto \left(x + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin y\right)\right)}\right) + z \cdot \cos y \]
    4. Taylor expanded in y around 0 97.8%

      \[\leadsto \color{blue}{-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(y + \left(z + x\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r+97.8%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right) + \left(z + x\right)} \]
      2. +-commutative97.8%

        \[\leadsto \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right) + \color{blue}{\left(x + z\right)} \]
      3. +-commutative97.8%

        \[\leadsto \color{blue}{\left(x + z\right) + \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right)} \]
      4. +-commutative97.8%

        \[\leadsto \color{blue}{\left(z + x\right)} + \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + y\right) \]
      5. associate-*r*97.8%

        \[\leadsto \left(z + x\right) + \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot z} + y\right) \]
      6. fma-def97.8%

        \[\leadsto \left(z + x\right) + \color{blue}{\mathsf{fma}\left(-0.5 \cdot {y}^{2}, z, y\right)} \]
      7. *-commutative97.8%

        \[\leadsto \left(z + x\right) + \mathsf{fma}\left(\color{blue}{{y}^{2} \cdot -0.5}, z, y\right) \]
      8. unpow297.8%

        \[\leadsto \left(z + x\right) + \mathsf{fma}\left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5, z, y\right) \]
    6. Simplified97.8%

      \[\leadsto \color{blue}{\left(z + x\right) + \mathsf{fma}\left(\left(y \cdot y\right) \cdot -0.5, z, y\right)} \]
    7. Step-by-step derivation
      1. fma-udef97.8%

        \[\leadsto \left(z + x\right) + \color{blue}{\left(\left(\left(y \cdot y\right) \cdot -0.5\right) \cdot z + y\right)} \]
      2. associate-*l*97.8%

        \[\leadsto \left(z + x\right) + \left(\color{blue}{\left(y \cdot \left(y \cdot -0.5\right)\right)} \cdot z + y\right) \]
    8. Applied egg-rr97.8%

      \[\leadsto \left(z + x\right) + \color{blue}{\left(\left(y \cdot \left(y \cdot -0.5\right)\right) \cdot z + y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+14}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq 10000:\\ \;\;\;\;\left(z + x\right) + \left(y + z \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \]

Alternative 9: 69.7% accurate, 22.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -440 \lor \neg \left(y \leq 9.5 \cdot 10^{+60}\right):\\
\;\;\;\;z + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -440 or 9.49999999999999988e60 < y

    1. Initial program 99.8%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 42.2%

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

    if -440 < y < 9.49999999999999988e60

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 95.2%

      \[\leadsto \color{blue}{y + \left(z + x\right)} \]
    3. Step-by-step derivation
      1. +-commutative95.2%

        \[\leadsto \color{blue}{\left(z + x\right) + y} \]
      2. associate-+l+95.2%

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

        \[\leadsto z + \color{blue}{\left(y + x\right)} \]
    4. Simplified95.2%

      \[\leadsto \color{blue}{z + \left(y + x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -440 \lor \neg \left(y \leq 9.5 \cdot 10^{+60}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;z + \left(y + x\right)\\ \end{array} \]

Alternative 10: 58.1% accurate, 29.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-53}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-28}:\\
\;\;\;\;z + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.39999999999999993e-53 or 1.59999999999999991e-28 < x

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around inf 71.3%

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

    if -1.39999999999999993e-53 < x < 1.59999999999999991e-28

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 80.1%

      \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
    3. Taylor expanded in y around 0 56.3%

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

      \[\leadsto \color{blue}{y + z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{-53}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-28}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 11: 54.1% accurate, 40.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-28}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -6.5e-102) x (if (<= x 1.35e-28) z x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -6.5e-102) {
		tmp = x;
	} else if (x <= 1.35e-28) {
		tmp = z;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-6.5d-102)) then
        tmp = x
    else if (x <= 1.35d-28) then
        tmp = z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -6.5e-102) {
		tmp = x;
	} else if (x <= 1.35e-28) {
		tmp = z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -6.5e-102:
		tmp = x
	elif x <= 1.35e-28:
		tmp = z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -6.5e-102)
		tmp = x;
	elseif (x <= 1.35e-28)
		tmp = z;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -6.5e-102)
		tmp = x;
	elseif (x <= 1.35e-28)
		tmp = z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -6.5e-102], x, If[LessEqual[x, 1.35e-28], z, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-102}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{-28}:\\
\;\;\;\;z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.5000000000000003e-102 or 1.3499999999999999e-28 < x

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around inf 67.4%

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

    if -6.5000000000000003e-102 < x < 1.3499999999999999e-28

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 81.2%

      \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
    3. Taylor expanded in z around inf 41.9%

      \[\leadsto \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-28}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 12: 65.6% accurate, 69.0× speedup?

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

\\
z + x
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Taylor expanded in y around 0 68.4%

    \[\leadsto \color{blue}{z + x} \]
  3. Final simplification68.4%

    \[\leadsto z + x \]

Alternative 13: 41.8% accurate, 207.0× speedup?

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

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

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Taylor expanded in x around inf 47.2%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification47.2%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023240 
(FPCore (x y z)
  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
  :precision binary64
  (+ (+ x (sin y)) (* z (cos y))))