
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (if (or (<= x -1.0) (not (<= x 1.95e-20))) (- x t_0) (- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.0) || !(x <= 1.95e-20)) {
tmp = x - t_0;
} else {
tmp = cos(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 * sin(y)
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.95d-20))) then
tmp = x - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if ((x <= -1.0) || !(x <= 1.95e-20)) {
tmp = x - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -1.0) or not (x <= 1.95e-20): tmp = x - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.95e-20)) tmp = Float64(x - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.95e-20))) tmp = x - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.95e-20]], $MachinePrecision]], N[(x - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1.95 \cdot 10^{-20}\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1 or 1.95000000000000004e-20 < x Initial program 99.9%
Taylor expanded in x around inf 98.7%
if -1 < x < 1.95000000000000004e-20Initial program 99.9%
Taylor expanded in x around 0 99.1%
Final simplification98.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- (sin y)))))
(if (<= z -3e+171)
t_0
(if (<= z -5.4e+158)
x
(if (or (<= z -9.5e+98) (not (<= z 4.9e+218))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = z * -sin(y);
double tmp;
if (z <= -3e+171) {
tmp = t_0;
} else if (z <= -5.4e+158) {
tmp = x;
} else if ((z <= -9.5e+98) || !(z <= 4.9e+218)) {
tmp = t_0;
} else {
tmp = x + 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) :: t_0
real(8) :: tmp
t_0 = z * -sin(y)
if (z <= (-3d+171)) then
tmp = t_0
else if (z <= (-5.4d+158)) then
tmp = x
else if ((z <= (-9.5d+98)) .or. (.not. (z <= 4.9d+218))) then
tmp = t_0
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * -Math.sin(y);
double tmp;
if (z <= -3e+171) {
tmp = t_0;
} else if (z <= -5.4e+158) {
tmp = x;
} else if ((z <= -9.5e+98) || !(z <= 4.9e+218)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * -math.sin(y) tmp = 0 if z <= -3e+171: tmp = t_0 elif z <= -5.4e+158: tmp = x elif (z <= -9.5e+98) or not (z <= 4.9e+218): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-sin(y))) tmp = 0.0 if (z <= -3e+171) tmp = t_0; elseif (z <= -5.4e+158) tmp = x; elseif ((z <= -9.5e+98) || !(z <= 4.9e+218)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -sin(y); tmp = 0.0; if (z <= -3e+171) tmp = t_0; elseif (z <= -5.4e+158) tmp = x; elseif ((z <= -9.5e+98) || ~((z <= 4.9e+218))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[z, -3e+171], t$95$0, If[LessEqual[z, -5.4e+158], x, If[Or[LessEqual[z, -9.5e+98], N[Not[LessEqual[z, 4.9e+218]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-\sin y\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{+158}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{+98} \lor \neg \left(z \leq 4.9 \cdot 10^{+218}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.0000000000000001e171 or -5.39999999999999957e158 < z < -9.5000000000000001e98 or 4.8999999999999997e218 < z Initial program 99.8%
Taylor expanded in z around inf 77.1%
associate-*r*77.1%
neg-mul-177.1%
*-commutative77.1%
Simplified77.1%
if -3.0000000000000001e171 < z < -5.39999999999999957e158Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt100.0%
associate-*r*100.0%
fma-def100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 81.8%
if -9.5000000000000001e98 < z < 4.8999999999999997e218Initial program 100.0%
Taylor expanded in z around 0 92.5%
+-commutative92.5%
Simplified92.5%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -47000000000000.0) (not (<= z 3.6e+211))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -47000000000000.0) || !(z <= 3.6e+211)) {
tmp = x - (z * sin(y));
} else {
tmp = x + 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 ((z <= (-47000000000000.0d0)) .or. (.not. (z <= 3.6d+211))) then
tmp = x - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -47000000000000.0) || !(z <= 3.6e+211)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -47000000000000.0) or not (z <= 3.6e+211): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -47000000000000.0) || !(z <= 3.6e+211)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -47000000000000.0) || ~((z <= 3.6e+211))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -47000000000000.0], N[Not[LessEqual[z, 3.6e+211]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -47000000000000 \lor \neg \left(z \leq 3.6 \cdot 10^{+211}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.7e13 or 3.60000000000000003e211 < z Initial program 99.8%
Taylor expanded in x around inf 91.6%
if -4.7e13 < z < 3.60000000000000003e211Initial program 100.0%
Taylor expanded in z around 0 94.0%
+-commutative94.0%
Simplified94.0%
Final simplification93.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -8.2e+40) (not (<= y 1050000000.0))) (+ x (cos y)) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e+40) || !(y <= 1050000000.0)) {
tmp = x + cos(y);
} else {
tmp = (x + 1.0) - (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 <= (-8.2d+40)) .or. (.not. (y <= 1050000000.0d0))) then
tmp = x + cos(y)
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e+40) || !(y <= 1050000000.0)) {
tmp = x + Math.cos(y);
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8.2e+40) or not (y <= 1050000000.0): tmp = x + math.cos(y) else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8.2e+40) || !(y <= 1050000000.0)) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8.2e+40) || ~((y <= 1050000000.0))) tmp = x + cos(y); else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.2e+40], N[Not[LessEqual[y, 1050000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+40} \lor \neg \left(y \leq 1050000000\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -8.2000000000000003e40 or 1.05e9 < y Initial program 99.9%
Taylor expanded in z around 0 67.2%
+-commutative67.2%
Simplified67.2%
if -8.2000000000000003e40 < y < 1.05e9Initial program 100.0%
Taylor expanded in y around 0 96.2%
associate-+r+96.2%
+-commutative96.2%
mul-1-neg96.2%
Simplified96.2%
unsub-neg96.2%
Applied egg-rr96.2%
Final simplification84.3%
(FPCore (x y z) :precision binary64 (if (<= x -1.06e-188) (- (+ x 1.0) (* y z)) (if (<= x 1.95e-20) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.06e-188) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 1.95e-20) {
tmp = cos(y);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-1.06d-188)) then
tmp = (x + 1.0d0) - (y * z)
else if (x <= 1.95d-20) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.06e-188) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 1.95e-20) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.06e-188: tmp = (x + 1.0) - (y * z) elif x <= 1.95e-20: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.06e-188) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif (x <= 1.95e-20) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.06e-188) tmp = (x + 1.0) - (y * z); elseif (x <= 1.95e-20) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.06e-188], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.95e-20], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.06 \cdot 10^{-188}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-20}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.06e-188Initial program 99.9%
Taylor expanded in y around 0 79.0%
associate-+r+79.0%
+-commutative79.0%
mul-1-neg79.0%
Simplified79.0%
unsub-neg79.0%
Applied egg-rr79.0%
if -1.06e-188 < x < 1.95000000000000004e-20Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 61.3%
if 1.95000000000000004e-20 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 82.2%
Final simplification74.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -5e-19) (not (<= x 0.0048))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5e-19) || !(x <= 0.0048)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (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 ((x <= (-5d-19)) .or. (.not. (x <= 0.0048d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5e-19) || !(x <= 0.0048)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5e-19) or not (x <= 0.0048): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5e-19) || !(x <= 0.0048)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5e-19) || ~((x <= 0.0048))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5e-19], N[Not[LessEqual[x, 0.0048]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-19} \lor \neg \left(x \leq 0.0048\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -5.0000000000000004e-19 or 0.00479999999999999958 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.7%
associate-*r*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 83.9%
if -5.0000000000000004e-19 < x < 0.00479999999999999958Initial program 99.9%
Taylor expanded in y around 0 58.3%
associate-+r+58.3%
+-commutative58.3%
mul-1-neg58.3%
Simplified58.3%
Taylor expanded in x around 0 58.3%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.05e+174) (not (<= z 2.2e+223))) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.05e+174) || !(z <= 2.2e+223)) {
tmp = y * -z;
} else {
tmp = x + 1.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) :: tmp
if ((z <= (-3.05d+174)) .or. (.not. (z <= 2.2d+223))) then
tmp = y * -z
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.05e+174) || !(z <= 2.2e+223)) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.05e+174) or not (z <= 2.2e+223): tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.05e+174) || !(z <= 2.2e+223)) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.05e+174) || ~((z <= 2.2e+223))) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.05e+174], N[Not[LessEqual[z, 2.2e+223]], $MachinePrecision]], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{+174} \lor \neg \left(z \leq 2.2 \cdot 10^{+223}\right):\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -3.05e174 or 2.2e223 < z Initial program 99.8%
Taylor expanded in y around 0 58.3%
associate-+r+58.3%
+-commutative58.3%
mul-1-neg58.3%
Simplified58.3%
Taylor expanded in y around inf 37.2%
associate-*r*37.2%
neg-mul-137.2%
Simplified37.2%
if -3.05e174 < z < 2.2e223Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.8%
associate-*r*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 75.9%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (<= x 8.8e+64) (- (+ x 1.0) (* y z)) x))
double code(double x, double y, double z) {
double tmp;
if (x <= 8.8e+64) {
tmp = (x + 1.0) - (y * 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 <= 8.8d+64) then
tmp = (x + 1.0d0) - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 8.8e+64) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 8.8e+64: tmp = (x + 1.0) - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 8.8e+64) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 8.8e+64) tmp = (x + 1.0) - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 8.8e+64], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.8 \cdot 10^{+64}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < 8.80000000000000007e64Initial program 99.9%
Taylor expanded in y around 0 67.8%
associate-+r+67.8%
+-commutative67.8%
mul-1-neg67.8%
Simplified67.8%
unsub-neg67.8%
Applied egg-rr67.8%
if 8.80000000000000007e64 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 84.2%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (<= x -4.9e-14) x (if (<= x 1.55e-42) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.9e-14) {
tmp = x;
} else if (x <= 1.55e-42) {
tmp = 1.0;
} 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-14)) then
tmp = x
else if (x <= 1.55d-42) then
tmp = 1.0d0
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-14) {
tmp = x;
} else if (x <= 1.55e-42) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.9e-14: tmp = x elif x <= 1.55e-42: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.9e-14) tmp = x; elseif (x <= 1.55e-42) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.9e-14) tmp = x; elseif (x <= 1.55e-42) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.9e-14], x, If[LessEqual[x, 1.55e-42], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-42}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.89999999999999995e-14 or 1.5500000000000001e-42 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 81.6%
if -4.89999999999999995e-14 < x < 1.5500000000000001e-42Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 42.6%
Final simplification63.7%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.5%
associate-*r*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 64.2%
Final simplification64.2%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 56.3%
Taylor expanded in y around 0 21.3%
Final simplification21.3%
herbie shell --seed 2024027
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))