
(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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.46e+161)
t_0
(if (<= z -2.4e+25)
(+ x z)
(if (or (<= z -4.8e-21) (not (<= z 6.2e+16))) t_0 (+ x (sin y)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.46e+161) {
tmp = t_0;
} else if (z <= -2.4e+25) {
tmp = x + z;
} else if ((z <= -4.8e-21) || !(z <= 6.2e+16)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-1.46d+161)) then
tmp = t_0
else if (z <= (-2.4d+25)) then
tmp = x + z
else if ((z <= (-4.8d-21)) .or. (.not. (z <= 6.2d+16))) then
tmp = t_0
else
tmp = x + sin(y)
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.46e+161) {
tmp = t_0;
} else if (z <= -2.4e+25) {
tmp = x + z;
} else if ((z <= -4.8e-21) || !(z <= 6.2e+16)) {
tmp = t_0;
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.46e+161: tmp = t_0 elif z <= -2.4e+25: tmp = x + z elif (z <= -4.8e-21) or not (z <= 6.2e+16): tmp = t_0 else: tmp = x + math.sin(y) return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.46e+161) tmp = t_0; elseif (z <= -2.4e+25) tmp = Float64(x + z); elseif ((z <= -4.8e-21) || !(z <= 6.2e+16)) tmp = t_0; else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -1.46e+161) tmp = t_0; elseif (z <= -2.4e+25) tmp = x + z; elseif ((z <= -4.8e-21) || ~((z <= 6.2e+16))) tmp = t_0; else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.46e+161], t$95$0, If[LessEqual[z, -2.4e+25], N[(x + z), $MachinePrecision], If[Or[LessEqual[z, -4.8e-21], N[Not[LessEqual[z, 6.2e+16]], $MachinePrecision]], t$95$0, N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.46 \cdot 10^{+161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{+25}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-21} \lor \neg \left(z \leq 6.2 \cdot 10^{+16}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.46000000000000008e161 or -2.39999999999999996e25 < z < -4.7999999999999999e-21 or 6.2e16 < z Initial program 99.8%
Taylor expanded in x around inf 99.2%
Taylor expanded in x around inf 74.5%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in x around 0 80.4%
*-commutative80.4%
Simplified80.4%
if -1.46000000000000008e161 < z < -2.39999999999999996e25Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in y around 0 83.2%
+-commutative83.2%
Simplified83.2%
if -4.7999999999999999e-21 < z < 6.2e16Initial program 100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 93.6%
Final simplification87.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.45e+161)
t_0
(if (<= z -4.5e-237)
(+ x z)
(if (<= z 1.85e-136) (+ y (+ x z)) (if (<= z 5.9e+196) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.45e+161) {
tmp = t_0;
} else if (z <= -4.5e-237) {
tmp = x + z;
} else if (z <= 1.85e-136) {
tmp = y + (x + z);
} else if (z <= 5.9e+196) {
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.45d+161)) then
tmp = t_0
else if (z <= (-4.5d-237)) then
tmp = x + z
else if (z <= 1.85d-136) then
tmp = y + (x + z)
else if (z <= 5.9d+196) 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.45e+161) {
tmp = t_0;
} else if (z <= -4.5e-237) {
tmp = x + z;
} else if (z <= 1.85e-136) {
tmp = y + (x + z);
} else if (z <= 5.9e+196) {
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.45e+161: tmp = t_0 elif z <= -4.5e-237: tmp = x + z elif z <= 1.85e-136: tmp = y + (x + z) elif z <= 5.9e+196: 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.45e+161) tmp = t_0; elseif (z <= -4.5e-237) tmp = Float64(x + z); elseif (z <= 1.85e-136) tmp = Float64(y + Float64(x + z)); elseif (z <= 5.9e+196) 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.45e+161) tmp = t_0; elseif (z <= -4.5e-237) tmp = x + z; elseif (z <= 1.85e-136) tmp = y + (x + z); elseif (z <= 5.9e+196) 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.45e+161], t$95$0, If[LessEqual[z, -4.5e-237], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.85e-136], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.9e+196], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-237}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-136}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{+196}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.45000000000000008e161 or 5.8999999999999999e196 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around inf 68.2%
associate-/l*68.1%
Simplified68.1%
Taylor expanded in x around 0 87.8%
*-commutative87.8%
Simplified87.8%
if -1.45000000000000008e161 < z < -4.50000000000000009e-237 or 1.85e-136 < z < 5.8999999999999999e196Initial program 99.9%
Taylor expanded in x around inf 87.6%
Taylor expanded in y around 0 76.1%
+-commutative76.1%
Simplified76.1%
if -4.50000000000000009e-237 < z < 1.85e-136Initial program 100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 76.1%
+-commutative76.1%
associate-+l+76.1%
Simplified76.1%
Final simplification78.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.86) (not (<= z 1.6))) (+ x (* z (cos y))) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.86) || !(z <= 1.6)) {
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 <= (-0.86d0)) .or. (.not. (z <= 1.6d0))) 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 <= -0.86) || !(z <= 1.6)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.86) or not (z <= 1.6): 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 <= -0.86) || !(z <= 1.6)) 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 <= -0.86) || ~((z <= 1.6))) tmp = x + (z * cos(y)); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.86], N[Not[LessEqual[z, 1.6]], $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 -0.86 \lor \neg \left(z \leq 1.6\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -0.859999999999999987 or 1.6000000000000001 < z Initial program 99.9%
Taylor expanded in x around inf 99.3%
if -0.859999999999999987 < z < 1.6000000000000001Initial program 100.0%
Taylor expanded in y around 0 99.4%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.5e-24) (not (<= z 0.017))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.5e-24) || !(z <= 0.017)) {
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 <= (-6.5d-24)) .or. (.not. (z <= 0.017d0))) 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 <= -6.5e-24) || !(z <= 0.017)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.5e-24) or not (z <= 0.017): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.5e-24) || !(z <= 0.017)) 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 <= -6.5e-24) || ~((z <= 0.017))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.5e-24], N[Not[LessEqual[z, 0.017]], $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 -6.5 \cdot 10^{-24} \lor \neg \left(z \leq 0.017\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -6.5e-24 or 0.017000000000000001 < z Initial program 99.9%
Taylor expanded in x around inf 99.4%
if -6.5e-24 < z < 0.017000000000000001Initial program 100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 93.4%
Final simplification96.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.05e+233) (sin y) (if (or (<= y -16.0) (not (<= y 8.2e-14))) (+ x z) (+ y (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+233) {
tmp = sin(y);
} else if ((y <= -16.0) || !(y <= 8.2e-14)) {
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 <= (-1.05d+233)) then
tmp = sin(y)
else if ((y <= (-16.0d0)) .or. (.not. (y <= 8.2d-14))) 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 <= -1.05e+233) {
tmp = Math.sin(y);
} else if ((y <= -16.0) || !(y <= 8.2e-14)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.05e+233: tmp = math.sin(y) elif (y <= -16.0) or not (y <= 8.2e-14): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.05e+233) tmp = sin(y); elseif ((y <= -16.0) || !(y <= 8.2e-14)) 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 <= -1.05e+233) tmp = sin(y); elseif ((y <= -16.0) || ~((y <= 8.2e-14))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.05e+233], N[Sin[y], $MachinePrecision], If[Or[LessEqual[y, -16.0], N[Not[LessEqual[y, 8.2e-14]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+233}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq -16 \lor \neg \left(y \leq 8.2 \cdot 10^{-14}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if y < -1.04999999999999998e233Initial program 99.8%
Taylor expanded in x around 0 93.3%
Taylor expanded in z around 0 41.8%
if -1.04999999999999998e233 < y < -16 or 8.2000000000000004e-14 < y Initial program 99.9%
Taylor expanded in x around inf 81.5%
Taylor expanded in y around 0 50.9%
+-commutative50.9%
Simplified50.9%
if -16 < y < 8.2000000000000004e-14Initial program 100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
associate-+l+99.9%
Simplified99.9%
Final simplification75.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -60.0) (not (<= y 8.2e-14))) (+ x z) (+ y (+ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -60.0) || !(y <= 8.2e-14)) {
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 <= (-60.0d0)) .or. (.not. (y <= 8.2d-14))) 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 <= -60.0) || !(y <= 8.2e-14)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -60.0) or not (y <= 8.2e-14): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -60.0) || !(y <= 8.2e-14)) 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 <= -60.0) || ~((y <= 8.2e-14))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -60.0], N[Not[LessEqual[y, 8.2e-14]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -60 \lor \neg \left(y \leq 8.2 \cdot 10^{-14}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if y < -60 or 8.2000000000000004e-14 < y Initial program 99.9%
Taylor expanded in x around inf 79.2%
Taylor expanded in y around 0 46.2%
+-commutative46.2%
Simplified46.2%
if -60 < y < 8.2000000000000004e-14Initial program 100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
associate-+l+99.9%
Simplified99.9%
Final simplification73.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.3e-141) (not (<= x 4.5e-93))) (+ x z) (+ y z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.3e-141) || !(x <= 4.5e-93)) {
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 <= (-3.3d-141)) .or. (.not. (x <= 4.5d-93))) 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 <= -3.3e-141) || !(x <= 4.5e-93)) {
tmp = x + z;
} else {
tmp = y + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.3e-141) or not (x <= 4.5e-93): tmp = x + z else: tmp = y + z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.3e-141) || !(x <= 4.5e-93)) 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 <= -3.3e-141) || ~((x <= 4.5e-93))) tmp = x + z; else tmp = y + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.3e-141], N[Not[LessEqual[x, 4.5e-93]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-141} \lor \neg \left(x \leq 4.5 \cdot 10^{-93}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + z\\
\end{array}
\end{array}
if x < -3.29999999999999999e-141 or 4.5000000000000002e-93 < x Initial program 99.9%
Taylor expanded in x around inf 93.6%
Taylor expanded in y around 0 79.2%
+-commutative79.2%
Simplified79.2%
if -3.29999999999999999e-141 < x < 4.5000000000000002e-93Initial program 99.9%
Taylor expanded in x around 0 99.3%
Taylor expanded in y around 0 57.0%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (<= x -1e-51) x (if (<= x 0.72) (+ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1e-51) {
tmp = x;
} else if (x <= 0.72) {
tmp = 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 <= (-1d-51)) then
tmp = x
else if (x <= 0.72d0) then
tmp = 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 <= -1e-51) {
tmp = x;
} else if (x <= 0.72) {
tmp = y + z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1e-51: tmp = x elif x <= 0.72: tmp = y + z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1e-51) tmp = x; elseif (x <= 0.72) tmp = Float64(y + z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1e-51) tmp = x; elseif (x <= 0.72) tmp = y + z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1e-51], x, If[LessEqual[x, 0.72], N[(y + z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.72:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1e-51 or 0.71999999999999997 < x Initial program 99.9%
Taylor expanded in x around inf 97.1%
Taylor expanded in x around inf 73.2%
if -1e-51 < x < 0.71999999999999997Initial program 99.9%
Taylor expanded in x around 0 92.6%
Taylor expanded in y around 0 50.2%
(FPCore (x y z) :precision binary64 (if (<= x -4.5e-52) x (if (<= x 0.68) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.5e-52) {
tmp = x;
} else if (x <= 0.68) {
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 <= (-4.5d-52)) then
tmp = x
else if (x <= 0.68d0) 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 <= -4.5e-52) {
tmp = x;
} else if (x <= 0.68) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.5e-52: tmp = x elif x <= 0.68: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.5e-52) tmp = x; elseif (x <= 0.68) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.5e-52) tmp = x; elseif (x <= 0.68) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.5e-52], x, If[LessEqual[x, 0.68], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.68:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.5e-52 or 0.680000000000000049 < x Initial program 99.9%
Taylor expanded in x around inf 97.1%
Taylor expanded in x around inf 73.2%
if -4.5e-52 < x < 0.680000000000000049Initial program 99.9%
Taylor expanded in x around inf 69.9%
Taylor expanded in x around inf 44.2%
associate-/l*44.2%
Simplified44.2%
Taylor expanded in x around 0 63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in y around 0 41.9%
Final simplification59.5%
(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 85.2%
Taylor expanded in x around inf 45.4%
herbie shell --seed 2024110
(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))))