
(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 12 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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.75e+162)
t_0
(if (<= z -7.2e-25)
(+ x z)
(if (<= z 1.22e-22) (+ x (sin y)) (if (<= z 1.45e+146) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.75e+162) {
tmp = t_0;
} else if (z <= -7.2e-25) {
tmp = x + z;
} else if (z <= 1.22e-22) {
tmp = x + sin(y);
} else if (z <= 1.45e+146) {
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 <= (-1.75d+162)) then
tmp = t_0
else if (z <= (-7.2d-25)) then
tmp = x + z
else if (z <= 1.22d-22) then
tmp = x + sin(y)
else if (z <= 1.45d+146) 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 <= -1.75e+162) {
tmp = t_0;
} else if (z <= -7.2e-25) {
tmp = x + z;
} else if (z <= 1.22e-22) {
tmp = x + Math.sin(y);
} else if (z <= 1.45e+146) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.75e+162: tmp = t_0 elif z <= -7.2e-25: tmp = x + z elif z <= 1.22e-22: tmp = x + math.sin(y) elif z <= 1.45e+146: 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 <= -1.75e+162) tmp = t_0; elseif (z <= -7.2e-25) tmp = Float64(x + z); elseif (z <= 1.22e-22) tmp = Float64(x + sin(y)); elseif (z <= 1.45e+146) 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 <= -1.75e+162) tmp = t_0; elseif (z <= -7.2e-25) tmp = x + z; elseif (z <= 1.22e-22) tmp = x + sin(y); elseif (z <= 1.45e+146) 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, -1.75e+162], t$95$0, If[LessEqual[z, -7.2e-25], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.22e-22], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+146], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-25}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{-22}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+146}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.75000000000000009e162 or 1.4499999999999999e146 < z Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around 0 88.2%
if -1.75000000000000009e162 < z < -7.1999999999999998e-25 or 1.2200000000000001e-22 < z < 1.4499999999999999e146Initial program 99.9%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 82.3%
+-commutative82.3%
Simplified82.3%
if -7.1999999999999998e-25 < z < 1.2200000000000001e-22Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 93.7%
+-commutative93.7%
Simplified93.7%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (<= y -5.6e+14) (+ x z) (if (<= y 3.1e+18) (+ y (+ x z)) (if (<= y 1.08e+98) (sin y) (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.6e+14) {
tmp = x + z;
} else if (y <= 3.1e+18) {
tmp = y + (x + z);
} else if (y <= 1.08e+98) {
tmp = sin(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 <= (-5.6d+14)) then
tmp = x + z
else if (y <= 3.1d+18) then
tmp = y + (x + z)
else if (y <= 1.08d+98) then
tmp = sin(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 <= -5.6e+14) {
tmp = x + z;
} else if (y <= 3.1e+18) {
tmp = y + (x + z);
} else if (y <= 1.08e+98) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.6e+14: tmp = x + z elif y <= 3.1e+18: tmp = y + (x + z) elif y <= 1.08e+98: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.6e+14) tmp = Float64(x + z); elseif (y <= 3.1e+18) tmp = Float64(y + Float64(x + z)); elseif (y <= 1.08e+98) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.6e+14) tmp = x + z; elseif (y <= 3.1e+18) tmp = y + (x + z); elseif (y <= 1.08e+98) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.6e+14], N[(x + z), $MachinePrecision], If[LessEqual[y, 3.1e+18], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.08e+98], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+14}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{+98}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -5.6e14 or 1.07999999999999997e98 < y Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 45.0%
+-commutative45.0%
Simplified45.0%
if -5.6e14 < y < 3.1e18Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 96.4%
+-commutative96.4%
associate-+l+96.4%
Simplified96.4%
if 3.1e18 < y < 1.07999999999999997e98Initial program 100.0%
Taylor expanded in x around 0 78.8%
Taylor expanded in z around 0 58.1%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.75e+30) (not (<= z 5.6e-22))) (+ x (* z (cos y))) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.75e+30) || !(z <= 5.6e-22)) {
tmp = x + (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 <= (-1.75d+30)) .or. (.not. (z <= 5.6d-22))) then
tmp = x + (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 <= -1.75e+30) || !(z <= 5.6e-22)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.75e+30) or not (z <= 5.6e-22): tmp = x + (z * math.cos(y)) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.75e+30) || !(z <= 5.6e-22)) tmp = Float64(x + 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 <= -1.75e+30) || ~((z <= 5.6e-22))) tmp = x + (z * cos(y)); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.75e+30], N[Not[LessEqual[z, 5.6e-22]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+30} \lor \neg \left(z \leq 5.6 \cdot 10^{-22}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -1.75000000000000011e30 or 5.5999999999999999e-22 < z Initial program 99.9%
Taylor expanded in x around inf 99.0%
if -1.75000000000000011e30 < z < 5.5999999999999999e-22Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.8e-25) (not (<= z 6.8e-23))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e-25) || !(z <= 6.8e-23)) {
tmp = x + (z * cos(y));
} else {
tmp = 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 <= (-5.8d-25)) .or. (.not. (z <= 6.8d-23))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e-25) || !(z <= 6.8e-23)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.8e-25) or not (z <= 6.8e-23): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.8e-25) || !(z <= 6.8e-23)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.8e-25) || ~((z <= 6.8e-23))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.8e-25], N[Not[LessEqual[z, 6.8e-23]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-25} \lor \neg \left(z \leq 6.8 \cdot 10^{-23}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -5.8000000000000001e-25 or 6.8000000000000001e-23 < z Initial program 99.9%
Taylor expanded in x around inf 98.9%
if -5.8000000000000001e-25 < z < 6.8000000000000001e-23Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 93.7%
+-commutative93.7%
Simplified93.7%
Final simplification96.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.58e-18) (not (<= x 1.12e-94))) (+ x z) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.58e-18) || !(x <= 1.12e-94)) {
tmp = x + z;
} else {
tmp = 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 <= (-1.58d-18)) .or. (.not. (x <= 1.12d-94))) then
tmp = x + z
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.58e-18) || !(x <= 1.12e-94)) {
tmp = x + z;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.58e-18) or not (x <= 1.12e-94): tmp = x + z else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.58e-18) || !(x <= 1.12e-94)) tmp = Float64(x + z); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.58e-18) || ~((x <= 1.12e-94))) tmp = x + z; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.58e-18], N[Not[LessEqual[x, 1.12e-94]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.58 \cdot 10^{-18} \lor \neg \left(x \leq 1.12 \cdot 10^{-94}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if x < -1.5800000000000001e-18 or 1.12e-94 < x Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 84.3%
+-commutative84.3%
Simplified84.3%
if -1.5800000000000001e-18 < x < 1.12e-94Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 62.8%
Taylor expanded in x around 0 61.1%
Final simplification74.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -3e+14) (not (<= y 2.4e+32))) (+ x z) (+ y (+ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+14) || !(y <= 2.4e+32)) {
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 <= (-3d+14)) .or. (.not. (y <= 2.4d+32))) 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 <= -3e+14) || !(y <= 2.4e+32)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3e+14) or not (y <= 2.4e+32): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3e+14) || !(y <= 2.4e+32)) 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 <= -3e+14) || ~((y <= 2.4e+32))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3e+14], N[Not[LessEqual[y, 2.4e+32]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+14} \lor \neg \left(y \leq 2.4 \cdot 10^{+32}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if y < -3e14 or 2.39999999999999991e32 < y Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 42.6%
+-commutative42.6%
Simplified42.6%
if -3e14 < y < 2.39999999999999991e32Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 95.2%
+-commutative95.2%
associate-+l+95.2%
Simplified95.2%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.3e-92) (not (<= x 1.4e-124))) (+ x z) (+ y z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.3e-92) || !(x <= 1.4e-124)) {
tmp = x + z;
} else {
tmp = 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 <= (-4.3d-92)) .or. (.not. (x <= 1.4d-124))) then
tmp = x + z
else
tmp = y + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.3e-92) || !(x <= 1.4e-124)) {
tmp = x + z;
} else {
tmp = y + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.3e-92) or not (x <= 1.4e-124): tmp = x + z else: tmp = y + z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.3e-92) || !(x <= 1.4e-124)) tmp = Float64(x + z); else tmp = Float64(y + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.3e-92) || ~((x <= 1.4e-124))) tmp = x + z; else tmp = y + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.3e-92], N[Not[LessEqual[x, 1.4e-124]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-92} \lor \neg \left(x \leq 1.4 \cdot 10^{-124}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + z\\
\end{array}
\end{array}
if x < -4.30000000000000014e-92 or 1.39999999999999999e-124 < x Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 82.5%
+-commutative82.5%
Simplified82.5%
if -4.30000000000000014e-92 < x < 1.39999999999999999e-124Initial program 99.9%
Taylor expanded in x around 0 99.0%
Taylor expanded in y around 0 52.6%
+-commutative52.6%
Simplified52.6%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (<= x -1.8e-22) x (if (<= x 1.85) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.8e-22) {
tmp = x;
} else if (x <= 1.85) {
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 <= (-1.8d-22)) then
tmp = x
else if (x <= 1.85d0) 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 <= -1.8e-22) {
tmp = x;
} else if (x <= 1.85) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.8e-22: tmp = x elif x <= 1.85: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.8e-22) tmp = x; elseif (x <= 1.85) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.8e-22) tmp = x; elseif (x <= 1.85) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.8e-22], x, If[LessEqual[x, 1.85], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.85:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.7999999999999999e-22 or 1.8500000000000001 < x Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 80.1%
if -1.7999999999999999e-22 < x < 1.8500000000000001Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 56.2%
+-commutative56.2%
associate-+l+56.2%
Simplified56.2%
Taylor expanded in z around inf 43.3%
(FPCore (x y z) :precision binary64 (if (<= x -1.5e-123) x (if (<= x 5.2e-116) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e-123) {
tmp = x;
} else if (x <= 5.2e-116) {
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 <= (-1.5d-123)) then
tmp = x
else if (x <= 5.2d-116) 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 <= -1.5e-123) {
tmp = x;
} else if (x <= 5.2e-116) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.5e-123: tmp = x elif x <= 5.2e-116: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.5e-123) tmp = x; elseif (x <= 5.2e-116) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.5e-123) tmp = x; elseif (x <= 5.2e-116) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.5e-123], x, If[LessEqual[x, 5.2e-116], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-123}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-116}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.49999999999999992e-123 or 5.2000000000000001e-116 < x Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 61.0%
if -1.49999999999999992e-123 < x < 5.2000000000000001e-116Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 56.9%
+-commutative56.9%
associate-+l+56.9%
Simplified56.9%
Taylor expanded in y around inf 16.1%
(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%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 68.0%
+-commutative68.0%
Simplified68.0%
Final simplification68.0%
(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%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 43.1%
herbie shell --seed 2024170
(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))))