
(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:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (cos y))) (t_1 (+ x t_0))) (if (<= x -3.65e-59) t_1 (if (<= x 1.75e-15) (+ (sin y) t_0) t_1))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double t_1 = x + t_0;
double tmp;
if (x <= -3.65e-59) {
tmp = t_1;
} else if (x <= 1.75e-15) {
tmp = sin(y) + 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 = x + t_0
if (x <= (-3.65d-59)) then
tmp = t_1
else if (x <= 1.75d-15) then
tmp = sin(y) + 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 = x + t_0;
double tmp;
if (x <= -3.65e-59) {
tmp = t_1;
} else if (x <= 1.75e-15) {
tmp = Math.sin(y) + t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) t_1 = x + t_0 tmp = 0 if x <= -3.65e-59: tmp = t_1 elif x <= 1.75e-15: tmp = math.sin(y) + t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) t_1 = Float64(x + t_0) tmp = 0.0 if (x <= -3.65e-59) tmp = t_1; elseif (x <= 1.75e-15) tmp = Float64(sin(y) + t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); t_1 = x + t_0; tmp = 0.0; if (x <= -3.65e-59) tmp = t_1; elseif (x <= 1.75e-15) tmp = sin(y) + 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[(x + t$95$0), $MachinePrecision]}, If[LessEqual[x, -3.65e-59], t$95$1, If[LessEqual[x, 1.75e-15], N[(N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
t_1 := x + t\_0\\
\mathbf{if}\;x \leq -3.65 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-15}:\\
\;\;\;\;\sin y + t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.6500000000000002e-59 or 1.75e-15 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified98.1%
if -3.6500000000000002e-59 < x < 1.75e-15Initial program 99.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6497.5%
Simplified97.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -36000000000000.0)
t_0
(if (<= z 9.8e-23) (+ x (sin y)) (if (<= z 3.95e+102) (+ x z) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -36000000000000.0) {
tmp = t_0;
} else if (z <= 9.8e-23) {
tmp = x + sin(y);
} else if (z <= 3.95e+102) {
tmp = x + z;
} else {
tmp = t_0;
}
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) :: tmp
t_0 = z * cos(y)
if (z <= (-36000000000000.0d0)) then
tmp = t_0
else if (z <= 9.8d-23) then
tmp = x + sin(y)
else if (z <= 3.95d+102) then
tmp = x + z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -36000000000000.0) {
tmp = t_0;
} else if (z <= 9.8e-23) {
tmp = x + Math.sin(y);
} else if (z <= 3.95e+102) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -36000000000000.0: tmp = t_0 elif z <= 9.8e-23: tmp = x + math.sin(y) elif z <= 3.95e+102: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -36000000000000.0) tmp = t_0; elseif (z <= 9.8e-23) tmp = Float64(x + sin(y)); elseif (z <= 3.95e+102) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -36000000000000.0) tmp = t_0; elseif (z <= 9.8e-23) tmp = x + sin(y); elseif (z <= 3.95e+102) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -36000000000000.0], t$95$0, If[LessEqual[z, 9.8e-23], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.95e+102], N[(x + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -36000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-23}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 3.95 \cdot 10^{+102}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.6e13 or 3.9500000000000001e102 < z Initial program 99.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6482.5%
Simplified82.5%
if -3.6e13 < z < 9.7999999999999996e-23Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6492.4%
Simplified92.4%
if 9.7999999999999996e-23 < z < 3.9500000000000001e102Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6480.5%
Simplified80.5%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (* z (cos y))))) (if (<= z -4.8e-49) t_0 (if (<= z 8e-19) (+ x (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + (z * cos(y));
double tmp;
if (z <= -4.8e-49) {
tmp = t_0;
} else if (z <= 8e-19) {
tmp = x + sin(y);
} else {
tmp = t_0;
}
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) :: tmp
t_0 = x + (z * cos(y))
if (z <= (-4.8d-49)) then
tmp = t_0
else if (z <= 8d-19) then
tmp = x + sin(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (z * Math.cos(y));
double tmp;
if (z <= -4.8e-49) {
tmp = t_0;
} else if (z <= 8e-19) {
tmp = x + Math.sin(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (z * math.cos(y)) tmp = 0 if z <= -4.8e-49: tmp = t_0 elif z <= 8e-19: tmp = x + math.sin(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(z * cos(y))) tmp = 0.0 if (z <= -4.8e-49) tmp = t_0; elseif (z <= 8e-19) tmp = Float64(x + sin(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (z * cos(y)); tmp = 0.0; if (z <= -4.8e-49) tmp = t_0; elseif (z <= 8e-19) tmp = x + sin(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e-49], t$95$0, If[LessEqual[z, 8e-19], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + z \cdot \cos y\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-19}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.79999999999999985e-49 or 7.9999999999999998e-19 < z Initial program 99.9%
Taylor expanded in x around inf
Simplified99.3%
if -4.79999999999999985e-49 < z < 7.9999999999999998e-19Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6495.1%
Simplified95.1%
Final simplification97.6%
(FPCore (x y z) :precision binary64 (if (<= x -7600000.0) (+ x z) (if (<= x 5e-16) (* z (cos y)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7600000.0) {
tmp = x + z;
} else if (x <= 5e-16) {
tmp = z * cos(y);
} else {
tmp = x + z;
}
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 <= (-7600000.0d0)) then
tmp = x + z
else if (x <= 5d-16) then
tmp = z * cos(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7600000.0) {
tmp = x + z;
} else if (x <= 5e-16) {
tmp = z * Math.cos(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7600000.0: tmp = x + z elif x <= 5e-16: tmp = z * math.cos(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7600000.0) tmp = Float64(x + z); elseif (x <= 5e-16) tmp = Float64(z * cos(y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7600000.0) tmp = x + z; elseif (x <= 5e-16) tmp = z * cos(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7600000.0], N[(x + z), $MachinePrecision], If[LessEqual[x, 5e-16], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7600000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-16}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -7.6e6 or 5.0000000000000004e-16 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6487.2%
Simplified87.2%
if -7.6e6 < x < 5.0000000000000004e-16Initial program 99.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6464.8%
Simplified64.8%
Final simplification75.6%
(FPCore (x y z)
:precision binary64
(if (<= y -2.4e+73)
(+ x z)
(if (<= y -3.1)
(sin y)
(if (<= y 2.8e-7) (+ y (+ x (* z (+ 1.0 (* -0.5 (* y y)))))) (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.4e+73) {
tmp = x + z;
} else if (y <= -3.1) {
tmp = sin(y);
} else if (y <= 2.8e-7) {
tmp = y + (x + (z * (1.0 + (-0.5 * (y * y)))));
} else {
tmp = x + z;
}
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 <= (-2.4d+73)) then
tmp = x + z
else if (y <= (-3.1d0)) then
tmp = sin(y)
else if (y <= 2.8d-7) then
tmp = y + (x + (z * (1.0d0 + ((-0.5d0) * (y * y)))))
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.4e+73) {
tmp = x + z;
} else if (y <= -3.1) {
tmp = Math.sin(y);
} else if (y <= 2.8e-7) {
tmp = y + (x + (z * (1.0 + (-0.5 * (y * y)))));
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.4e+73: tmp = x + z elif y <= -3.1: tmp = math.sin(y) elif y <= 2.8e-7: tmp = y + (x + (z * (1.0 + (-0.5 * (y * y))))) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.4e+73) tmp = Float64(x + z); elseif (y <= -3.1) tmp = sin(y); elseif (y <= 2.8e-7) tmp = Float64(y + Float64(x + Float64(z * Float64(1.0 + Float64(-0.5 * Float64(y * y)))))); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.4e+73) tmp = x + z; elseif (y <= -3.1) tmp = sin(y); elseif (y <= 2.8e-7) tmp = y + (x + (z * (1.0 + (-0.5 * (y * y))))); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.4e+73], N[(x + z), $MachinePrecision], If[LessEqual[y, -3.1], N[Sin[y], $MachinePrecision], If[LessEqual[y, 2.8e-7], N[(y + N[(x + N[(z * N[(1.0 + N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+73}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq -3.1:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-7}:\\
\;\;\;\;y + \left(x + z \cdot \left(1 + -0.5 \cdot \left(y \cdot y\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -2.40000000000000002e73 or 2.80000000000000019e-7 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6445.8%
Simplified45.8%
if -2.40000000000000002e73 < y < -3.10000000000000009Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6462.3%
Simplified62.3%
Taylor expanded in x around 0
sin-lowering-sin.f6452.2%
Simplified52.2%
if -3.10000000000000009 < y < 2.80000000000000019e-7Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
+-commutativeN/A
associate-+r+N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
Simplified100.0%
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64100.0%
Applied egg-rr100.0%
Final simplification73.3%
(FPCore (x y z)
:precision binary64
(if (<= y -105000000.0)
(+ x z)
(if (<= y 2.8e-7)
(+ (+ x z) (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666))))))
(+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -105000000.0) {
tmp = x + z;
} else if (y <= 2.8e-7) {
tmp = (x + z) + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))));
} else {
tmp = x + z;
}
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 <= (-105000000.0d0)) then
tmp = x + z
else if (y <= 2.8d-7) then
tmp = (x + z) + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0))))))
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -105000000.0) {
tmp = x + z;
} else if (y <= 2.8e-7) {
tmp = (x + z) + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))));
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -105000000.0: tmp = x + z elif y <= 2.8e-7: tmp = (x + z) + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -105000000.0) tmp = Float64(x + z); elseif (y <= 2.8e-7) tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666)))))); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -105000000.0) tmp = x + z; elseif (y <= 2.8e-7) tmp = (x + z) + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -105000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 2.8e-7], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -105000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-7}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -1.05e8 or 2.80000000000000019e-7 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6441.5%
Simplified41.5%
if -1.05e8 < y < 2.80000000000000019e-7Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6498.7%
Simplified98.7%
Final simplification70.5%
(FPCore (x y z) :precision binary64 (if (<= y -110000000.0) (+ x z) (if (<= y 2.8e-7) (+ y (+ x (* z (+ 1.0 (* -0.5 (* y y)))))) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -110000000.0) {
tmp = x + z;
} else if (y <= 2.8e-7) {
tmp = y + (x + (z * (1.0 + (-0.5 * (y * y)))));
} else {
tmp = x + z;
}
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 <= (-110000000.0d0)) then
tmp = x + z
else if (y <= 2.8d-7) then
tmp = y + (x + (z * (1.0d0 + ((-0.5d0) * (y * y)))))
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -110000000.0) {
tmp = x + z;
} else if (y <= 2.8e-7) {
tmp = y + (x + (z * (1.0 + (-0.5 * (y * y)))));
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -110000000.0: tmp = x + z elif y <= 2.8e-7: tmp = y + (x + (z * (1.0 + (-0.5 * (y * y))))) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -110000000.0) tmp = Float64(x + z); elseif (y <= 2.8e-7) tmp = Float64(y + Float64(x + Float64(z * Float64(1.0 + Float64(-0.5 * Float64(y * y)))))); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -110000000.0) tmp = x + z; elseif (y <= 2.8e-7) tmp = y + (x + (z * (1.0 + (-0.5 * (y * y))))); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -110000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 2.8e-7], N[(y + N[(x + N[(z * N[(1.0 + N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -110000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-7}:\\
\;\;\;\;y + \left(x + z \cdot \left(1 + -0.5 \cdot \left(y \cdot y\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -1.1e8 or 2.80000000000000019e-7 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6441.5%
Simplified41.5%
if -1.1e8 < y < 2.80000000000000019e-7Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
+-commutativeN/A
associate-+r+N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
Simplified98.5%
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.6%
Applied egg-rr98.6%
Final simplification70.5%
(FPCore (x y z) :precision binary64 (if (<= y -4.8e+51) (+ x z) (if (<= y 2.65e-11) (+ x (+ y z)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.8e+51) {
tmp = x + z;
} else if (y <= 2.65e-11) {
tmp = x + (y + z);
} else {
tmp = x + z;
}
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 <= (-4.8d+51)) then
tmp = x + z
else if (y <= 2.65d-11) then
tmp = x + (y + z)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.8e+51) {
tmp = x + z;
} else if (y <= 2.65e-11) {
tmp = x + (y + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.8e+51: tmp = x + z elif y <= 2.65e-11: tmp = x + (y + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.8e+51) tmp = Float64(x + z); elseif (y <= 2.65e-11) tmp = Float64(x + Float64(y + z)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.8e+51) tmp = x + z; elseif (y <= 2.65e-11) tmp = x + (y + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.8e+51], N[(x + z), $MachinePrecision], If[LessEqual[y, 2.65e-11], N[(x + N[(y + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+51}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-11}:\\
\;\;\;\;x + \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -4.7999999999999997e51 or 2.6499999999999999e-11 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6445.8%
Simplified45.8%
if -4.7999999999999997e51 < y < 2.6499999999999999e-11Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-lowering-+.f6491.0%
Simplified91.0%
Final simplification70.3%
(FPCore (x y z) :precision binary64 (if (<= x -54000.0) x (if (<= x 350000000000.0) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -54000.0) {
tmp = x;
} else if (x <= 350000000000.0) {
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 <= (-54000.0d0)) then
tmp = x
else if (x <= 350000000000.0d0) 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 <= -54000.0) {
tmp = x;
} else if (x <= 350000000000.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -54000.0: tmp = x elif x <= 350000000000.0: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -54000.0) tmp = x; elseif (x <= 350000000000.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -54000.0) tmp = x; elseif (x <= 350000000000.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -54000.0], x, If[LessEqual[x, 350000000000.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -54000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 350000000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -54000 or 3.5e11 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified74.3%
if -54000 < x < 3.5e11Initial program 99.9%
flip-+N/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6442.1%
Simplified42.1%
Taylor expanded in z around inf
Simplified38.7%
(FPCore (x y z) :precision binary64 (if (<= x -3.4e-101) x (if (<= x 3.3e-52) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.4e-101) {
tmp = x;
} else if (x <= 3.3e-52) {
tmp = 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 <= (-3.4d-101)) then
tmp = x
else if (x <= 3.3d-52) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.4e-101) {
tmp = x;
} else if (x <= 3.3e-52) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.4e-101: tmp = x elif x <= 3.3e-52: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.4e-101) tmp = x; elseif (x <= 3.3e-52) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.4e-101) tmp = x; elseif (x <= 3.3e-52) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.4e-101], x, If[LessEqual[x, 3.3e-52], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-101}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-52}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.39999999999999989e-101 or 3.29999999999999995e-52 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified60.5%
if -3.39999999999999989e-101 < x < 3.29999999999999995e-52Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6438.3%
Simplified38.3%
Taylor expanded in y around 0
Simplified16.2%
Taylor expanded in y around inf
Simplified15.2%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6464.6%
Simplified64.6%
Final simplification64.6%
(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}
Initial program 99.9%
Taylor expanded in x around inf
Simplified38.4%
herbie shell --seed 2024161
(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))))