
(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 11 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 (+ (+ 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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -3.7e+64)
t_0
(if (<= z 41000.0) (+ (+ x (sin y)) z) (+ (sin y) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -3.7e+64) {
tmp = t_0;
} else if (z <= 41000.0) {
tmp = (x + sin(y)) + z;
} else {
tmp = sin(y) + 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 <= (-3.7d+64)) then
tmp = t_0
else if (z <= 41000.0d0) then
tmp = (x + sin(y)) + z
else
tmp = sin(y) + 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 <= -3.7e+64) {
tmp = t_0;
} else if (z <= 41000.0) {
tmp = (x + Math.sin(y)) + z;
} else {
tmp = Math.sin(y) + t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -3.7e+64: tmp = t_0 elif z <= 41000.0: tmp = (x + math.sin(y)) + z else: tmp = math.sin(y) + t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -3.7e+64) tmp = t_0; elseif (z <= 41000.0) tmp = Float64(Float64(x + sin(y)) + z); else tmp = Float64(sin(y) + t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -3.7e+64) tmp = t_0; elseif (z <= 41000.0) tmp = (x + sin(y)) + z; else tmp = sin(y) + 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, -3.7e+64], t$95$0, If[LessEqual[z, 41000.0], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 41000:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\mathbf{else}:\\
\;\;\;\;\sin y + t\_0\\
\end{array}
\end{array}
if z < -3.69999999999999983e64Initial program 99.8%
Taylor expanded in z around inf 89.5%
if -3.69999999999999983e64 < z < 41000Initial program 100.0%
Taylor expanded in y around 0 96.6%
if 41000 < z Initial program 99.8%
Taylor expanded in x around 0 82.7%
Final simplification91.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -3.8e+65)
t_0
(if (<= z -1.35e-132)
(+ x z)
(if (<= z -2.4e-181) (sin y) (if (<= z 2.8e+24) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -3.8e+65) {
tmp = t_0;
} else if (z <= -1.35e-132) {
tmp = x + z;
} else if (z <= -2.4e-181) {
tmp = sin(y);
} else if (z <= 2.8e+24) {
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 <= (-3.8d+65)) then
tmp = t_0
else if (z <= (-1.35d-132)) then
tmp = x + z
else if (z <= (-2.4d-181)) then
tmp = sin(y)
else if (z <= 2.8d+24) 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 <= -3.8e+65) {
tmp = t_0;
} else if (z <= -1.35e-132) {
tmp = x + z;
} else if (z <= -2.4e-181) {
tmp = Math.sin(y);
} else if (z <= 2.8e+24) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -3.8e+65: tmp = t_0 elif z <= -1.35e-132: tmp = x + z elif z <= -2.4e-181: tmp = math.sin(y) elif z <= 2.8e+24: 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 <= -3.8e+65) tmp = t_0; elseif (z <= -1.35e-132) tmp = Float64(x + z); elseif (z <= -2.4e-181) tmp = sin(y); elseif (z <= 2.8e+24) 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 <= -3.8e+65) tmp = t_0; elseif (z <= -1.35e-132) tmp = x + z; elseif (z <= -2.4e-181) tmp = sin(y); elseif (z <= 2.8e+24) 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, -3.8e+65], t$95$0, If[LessEqual[z, -1.35e-132], N[(x + z), $MachinePrecision], If[LessEqual[z, -2.4e-181], N[Sin[y], $MachinePrecision], If[LessEqual[z, 2.8e+24], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-132}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-181}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+24}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.80000000000000011e65 or 2.8000000000000002e24 < z Initial program 99.8%
Taylor expanded in z around inf 86.1%
if -3.80000000000000011e65 < z < -1.34999999999999995e-132 or -2.4000000000000001e-181 < z < 2.8000000000000002e24Initial program 100.0%
Taylor expanded in y around 0 71.7%
+-commutative71.7%
Simplified71.7%
if -1.34999999999999995e-132 < z < -2.4000000000000001e-181Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt100.0%
associate-*l*100.0%
fma-define100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 81.1%
Final simplification78.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -4.7e+23)
t_0
(if (<= z 3.85e-62)
(+ x (sin y))
(if (<= z 1.08e-29) (+ y (+ x z)) (if (<= z 4.2e+22) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4.7e+23) {
tmp = t_0;
} else if (z <= 3.85e-62) {
tmp = x + sin(y);
} else if (z <= 1.08e-29) {
tmp = y + (x + z);
} else if (z <= 4.2e+22) {
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 <= (-4.7d+23)) then
tmp = t_0
else if (z <= 3.85d-62) then
tmp = x + sin(y)
else if (z <= 1.08d-29) then
tmp = y + (x + z)
else if (z <= 4.2d+22) 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 <= -4.7e+23) {
tmp = t_0;
} else if (z <= 3.85e-62) {
tmp = x + Math.sin(y);
} else if (z <= 1.08e-29) {
tmp = y + (x + z);
} else if (z <= 4.2e+22) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4.7e+23: tmp = t_0 elif z <= 3.85e-62: tmp = x + math.sin(y) elif z <= 1.08e-29: tmp = y + (x + z) elif z <= 4.2e+22: 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 <= -4.7e+23) tmp = t_0; elseif (z <= 3.85e-62) tmp = Float64(x + sin(y)); elseif (z <= 1.08e-29) tmp = Float64(y + Float64(x + z)); elseif (z <= 4.2e+22) 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 <= -4.7e+23) tmp = t_0; elseif (z <= 3.85e-62) tmp = x + sin(y); elseif (z <= 1.08e-29) tmp = y + (x + z); elseif (z <= 4.2e+22) 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, -4.7e+23], t$95$0, If[LessEqual[z, 3.85e-62], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.08e-29], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+22], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4.7 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.85 \cdot 10^{-62}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-29}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+22}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.6999999999999997e23 or 4.1999999999999996e22 < z Initial program 99.8%
Taylor expanded in z around inf 84.5%
if -4.6999999999999997e23 < z < 3.84999999999999998e-62Initial program 100.0%
Taylor expanded in z around 0 89.5%
+-commutative89.5%
Simplified89.5%
if 3.84999999999999998e-62 < z < 1.07999999999999995e-29Initial program 100.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
associate-+l+99.7%
Simplified99.7%
if 1.07999999999999995e-29 < z < 4.1999999999999996e22Initial program 100.0%
Taylor expanded in y around 0 72.5%
+-commutative72.5%
Simplified72.5%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -8e+65) (not (<= z 3.9e+24))) (* z (cos y)) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8e+65) || !(z <= 3.9e+24)) {
tmp = z * cos(y);
} else {
tmp = (x + sin(y)) + 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 ((z <= (-8d+65)) .or. (.not. (z <= 3.9d+24))) then
tmp = z * cos(y)
else
tmp = (x + sin(y)) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8e+65) || !(z <= 3.9e+24)) {
tmp = z * Math.cos(y);
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8e+65) or not (z <= 3.9e+24): tmp = z * math.cos(y) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8e+65) || !(z <= 3.9e+24)) tmp = Float64(z * cos(y)); else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8e+65) || ~((z <= 3.9e+24))) tmp = z * cos(y); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8e+65], N[Not[LessEqual[z, 3.9e+24]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+65} \lor \neg \left(z \leq 3.9 \cdot 10^{+24}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -7.9999999999999999e65 or 3.8999999999999998e24 < z Initial program 99.8%
Taylor expanded in z around inf 86.1%
if -7.9999999999999999e65 < z < 3.8999999999999998e24Initial program 100.0%
Taylor expanded in y around 0 95.5%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -4000000000000.0) (not (<= y 24.0))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4000000000000.0) || !(y <= 24.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-4000000000000.0d0)) .or. (.not. (y <= 24.0d0))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4000000000000.0) || !(y <= 24.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4000000000000.0) or not (y <= 24.0): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4000000000000.0) || !(y <= 24.0)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4000000000000.0) || ~((y <= 24.0))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4000000000000.0], N[Not[LessEqual[y, 24.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4000000000000 \lor \neg \left(y \leq 24\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -4e12 or 24 < y Initial program 99.9%
Taylor expanded in y around 0 42.9%
+-commutative42.9%
Simplified42.9%
if -4e12 < y < 24Initial program 100.0%
Taylor expanded in y around 0 97.0%
Final simplification68.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -140000000000.0) (not (<= y 225.0))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -140000000000.0) || !(y <= 225.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * 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 <= (-140000000000.0d0)) .or. (.not. (y <= 225.0d0))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -140000000000.0) || !(y <= 225.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -140000000000.0) or not (y <= 225.0): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -140000000000.0) || !(y <= 225.0)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -140000000000.0) || ~((y <= 225.0))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -140000000000.0], N[Not[LessEqual[y, 225.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -140000000000 \lor \neg \left(y \leq 225\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -1.4e11 or 225 < y Initial program 99.9%
Taylor expanded in y around 0 42.6%
+-commutative42.6%
Simplified42.6%
if -1.4e11 < y < 225Initial program 100.0%
Taylor expanded in y around 0 97.4%
associate-+r+97.4%
+-commutative97.4%
*-commutative97.4%
Simplified97.4%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -220000000000.0) (not (<= y 5800.0))) (+ x z) (+ y (+ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -220000000000.0) || !(y <= 5800.0)) {
tmp = x + z;
} else {
tmp = y + (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 <= (-220000000000.0d0)) .or. (.not. (y <= 5800.0d0))) then
tmp = x + z
else
tmp = y + (x + z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -220000000000.0) || !(y <= 5800.0)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -220000000000.0) or not (y <= 5800.0): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -220000000000.0) || !(y <= 5800.0)) tmp = Float64(x + z); else tmp = Float64(y + Float64(x + z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -220000000000.0) || ~((y <= 5800.0))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -220000000000.0], N[Not[LessEqual[y, 5800.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -220000000000 \lor \neg \left(y \leq 5800\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if y < -2.2e11 or 5800 < y Initial program 99.9%
Taylor expanded in y around 0 42.4%
+-commutative42.4%
Simplified42.4%
if -2.2e11 < y < 5800Initial program 100.0%
Taylor expanded in y around 0 96.6%
+-commutative96.6%
associate-+l+96.6%
Simplified96.6%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (if (<= x -4.9e-12) x (if (<= x 1.32e-56) (+ x y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.9e-12) {
tmp = x;
} else if (x <= 1.32e-56) {
tmp = x + 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 <= (-4.9d-12)) then
tmp = x
else if (x <= 1.32d-56) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.9e-12) {
tmp = x;
} else if (x <= 1.32e-56) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.9e-12: tmp = x elif x <= 1.32e-56: tmp = x + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.9e-12) tmp = x; elseif (x <= 1.32e-56) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.9e-12) tmp = x; elseif (x <= 1.32e-56) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.9e-12], x, If[LessEqual[x, 1.32e-56], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-56}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.89999999999999972e-12 or 1.3199999999999999e-56 < x Initial program 100.0%
Taylor expanded in x around inf 71.3%
if -4.89999999999999972e-12 < x < 1.3199999999999999e-56Initial program 99.9%
Taylor expanded in y around 0 64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in z around 0 17.6%
+-commutative17.6%
Simplified17.6%
Final simplification44.0%
(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 63.4%
+-commutative63.4%
Simplified63.4%
Final simplification63.4%
(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 39.7%
Final simplification39.7%
herbie shell --seed 2024130
(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))))