
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.3e-19) (not (<= x 1.45e-77))) (+ z (+ x (sin y))) (+ (sin y) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.3e-19) || !(x <= 1.45e-77)) {
tmp = z + (x + sin(y));
} else {
tmp = sin(y) + (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 <= (-2.3d-19)) .or. (.not. (x <= 1.45d-77))) then
tmp = z + (x + sin(y))
else
tmp = sin(y) + (z * cos(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.3e-19) || !(x <= 1.45e-77)) {
tmp = z + (x + Math.sin(y));
} else {
tmp = Math.sin(y) + (z * Math.cos(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.3e-19) or not (x <= 1.45e-77): tmp = z + (x + math.sin(y)) else: tmp = math.sin(y) + (z * math.cos(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.3e-19) || !(x <= 1.45e-77)) tmp = Float64(z + Float64(x + sin(y))); else tmp = Float64(sin(y) + Float64(z * cos(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.3e-19) || ~((x <= 1.45e-77))) tmp = z + (x + sin(y)); else tmp = sin(y) + (z * cos(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.3e-19], N[Not[LessEqual[x, 1.45e-77]], $MachinePrecision]], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-19} \lor \neg \left(x \leq 1.45 \cdot 10^{-77}\right):\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\end{array}
\end{array}
if x < -2.2999999999999998e-19 or 1.4499999999999999e-77 < x Initial program 99.9%
Taylor expanded in y around 0 87.8%
if -2.2999999999999998e-19 < x < 1.4499999999999999e-77Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 91.1%
Final simplification89.1%
(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))) (t_1 (+ t_0 (+ y x))))
(if (<= z -5.4e+137)
t_1
(if (<= z 2.05e+55)
(+ z (+ x (sin y)))
(if (or (<= z 2.5e+151) (not (<= z 4.3e+251))) t_0 t_1)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double t_1 = t_0 + (y + x);
double tmp;
if (z <= -5.4e+137) {
tmp = t_1;
} else if (z <= 2.05e+55) {
tmp = z + (x + sin(y));
} else if ((z <= 2.5e+151) || !(z <= 4.3e+251)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * cos(y)
t_1 = t_0 + (y + x)
if (z <= (-5.4d+137)) then
tmp = t_1
else if (z <= 2.05d+55) then
tmp = z + (x + sin(y))
else if ((z <= 2.5d+151) .or. (.not. (z <= 4.3d+251))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double t_1 = t_0 + (y + x);
double tmp;
if (z <= -5.4e+137) {
tmp = t_1;
} else if (z <= 2.05e+55) {
tmp = z + (x + Math.sin(y));
} else if ((z <= 2.5e+151) || !(z <= 4.3e+251)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) t_1 = t_0 + (y + x) tmp = 0 if z <= -5.4e+137: tmp = t_1 elif z <= 2.05e+55: tmp = z + (x + math.sin(y)) elif (z <= 2.5e+151) or not (z <= 4.3e+251): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) t_1 = Float64(t_0 + Float64(y + x)) tmp = 0.0 if (z <= -5.4e+137) tmp = t_1; elseif (z <= 2.05e+55) tmp = Float64(z + Float64(x + sin(y))); elseif ((z <= 2.5e+151) || !(z <= 4.3e+251)) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); t_1 = t_0 + (y + x); tmp = 0.0; if (z <= -5.4e+137) tmp = t_1; elseif (z <= 2.05e+55) tmp = z + (x + sin(y)); elseif ((z <= 2.5e+151) || ~((z <= 4.3e+251))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e+137], t$95$1, If[LessEqual[z, 2.05e+55], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.5e+151], N[Not[LessEqual[z, 4.3e+251]], $MachinePrecision]], t$95$0, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
t_1 := t_0 + \left(y + x\right)\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+55}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+151} \lor \neg \left(z \leq 4.3 \cdot 10^{+251}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -5.40000000000000034e137 or 2.5000000000000001e151 < z < 4.3e251Initial program 99.9%
Taylor expanded in y around 0 89.5%
if -5.40000000000000034e137 < z < 2.04999999999999991e55Initial program 100.0%
Taylor expanded in y around 0 94.2%
if 2.04999999999999991e55 < z < 2.5000000000000001e151 or 4.3e251 < z Initial program 99.7%
log1p-expm1-u99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 81.0%
Final simplification91.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.2e+232) (not (<= z 1.95e+55))) (* z (cos y)) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.2e+232) || !(z <= 1.95e+55)) {
tmp = z * cos(y);
} else {
tmp = z + (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 <= (-9.2d+232)) .or. (.not. (z <= 1.95d+55))) then
tmp = z * cos(y)
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9.2e+232) || !(z <= 1.95e+55)) {
tmp = z * Math.cos(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.2e+232) or not (z <= 1.95e+55): tmp = z * math.cos(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.2e+232) || !(z <= 1.95e+55)) tmp = Float64(z * cos(y)); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9.2e+232) || ~((z <= 1.95e+55))) tmp = z * cos(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.2e+232], N[Not[LessEqual[z, 1.95e+55]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 1.95 \cdot 10^{+55}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -9.20000000000000024e232 or 1.95000000000000014e55 < z Initial program 99.8%
log1p-expm1-u99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 80.3%
if -9.20000000000000024e232 < z < 1.95000000000000014e55Initial program 99.9%
Taylor expanded in y around 0 92.1%
Final simplification89.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.2e+232) (not (<= z 2e+55))) (* z (cos y)) (+ z x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.2e+232) || !(z <= 2e+55)) {
tmp = z * cos(y);
} else {
tmp = z + 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 ((z <= (-9.2d+232)) .or. (.not. (z <= 2d+55))) then
tmp = z * cos(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9.2e+232) || !(z <= 2e+55)) {
tmp = z * Math.cos(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.2e+232) or not (z <= 2e+55): tmp = z * math.cos(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.2e+232) || !(z <= 2e+55)) tmp = Float64(z * cos(y)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9.2e+232) || ~((z <= 2e+55))) tmp = z * cos(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.2e+232], N[Not[LessEqual[z, 2e+55]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+232} \lor \neg \left(z \leq 2 \cdot 10^{+55}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -9.20000000000000024e232 or 2.00000000000000002e55 < z Initial program 99.8%
log1p-expm1-u99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 80.3%
if -9.20000000000000024e232 < z < 2.00000000000000002e55Initial program 99.9%
Taylor expanded in y around 0 72.3%
Final simplification74.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.061) (not (<= y 7000.0))) (+ x (sin y)) (+ (+ z x) (+ y (* z (* y (* y -0.5)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.061) || !(y <= 7000.0)) {
tmp = x + sin(y);
} else {
tmp = (z + x) + (y + (z * (y * (y * -0.5))));
}
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 <= (-0.061d0)) .or. (.not. (y <= 7000.0d0))) then
tmp = x + sin(y)
else
tmp = (z + x) + (y + (z * (y * (y * (-0.5d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.061) || !(y <= 7000.0)) {
tmp = x + Math.sin(y);
} else {
tmp = (z + x) + (y + (z * (y * (y * -0.5))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.061) or not (y <= 7000.0): tmp = x + math.sin(y) else: tmp = (z + x) + (y + (z * (y * (y * -0.5)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.061) || !(y <= 7000.0)) tmp = Float64(x + sin(y)); else tmp = Float64(Float64(z + x) + Float64(y + Float64(z * Float64(y * Float64(y * -0.5))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.061) || ~((y <= 7000.0))) tmp = x + sin(y); else tmp = (z + x) + (y + (z * (y * (y * -0.5)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.061], N[Not[LessEqual[y, 7000.0]], $MachinePrecision]], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y + N[(z * N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.061 \lor \neg \left(y \leq 7000\right):\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + \left(y + z \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\\
\end{array}
\end{array}
if y < -0.060999999999999999 or 7e3 < y Initial program 99.8%
Taylor expanded in z around 0 65.2%
if -0.060999999999999999 < y < 7e3Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 99.2%
associate-+r+99.2%
+-commutative99.2%
+-commutative99.2%
+-commutative99.2%
associate-*r*99.2%
fma-def99.2%
*-commutative99.2%
unpow299.2%
Simplified99.2%
fma-udef99.2%
associate-*l*99.2%
Applied egg-rr99.2%
Final simplification82.6%
(FPCore (x y z) :precision binary64 (if (<= y -7.5e+14) (+ z x) (if (<= y 10000.0) (+ (+ z x) (+ y (* z (* y (* y -0.5))))) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+14) {
tmp = z + x;
} else if (y <= 10000.0) {
tmp = (z + x) + (y + (z * (y * (y * -0.5))));
} else {
tmp = z + 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 (y <= (-7.5d+14)) then
tmp = z + x
else if (y <= 10000.0d0) then
tmp = (z + x) + (y + (z * (y * (y * (-0.5d0)))))
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+14) {
tmp = z + x;
} else if (y <= 10000.0) {
tmp = (z + x) + (y + (z * (y * (y * -0.5))));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.5e+14: tmp = z + x elif y <= 10000.0: tmp = (z + x) + (y + (z * (y * (y * -0.5)))) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.5e+14) tmp = Float64(z + x); elseif (y <= 10000.0) tmp = Float64(Float64(z + x) + Float64(y + Float64(z * Float64(y * Float64(y * -0.5))))); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.5e+14) tmp = z + x; elseif (y <= 10000.0) tmp = (z + x) + (y + (z * (y * (y * -0.5)))); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.5e+14], N[(z + x), $MachinePrecision], If[LessEqual[y, 10000.0], N[(N[(z + x), $MachinePrecision] + N[(y + N[(z * N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+14}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 10000:\\
\;\;\;\;\left(z + x\right) + \left(y + z \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -7.5e14 or 1e4 < y Initial program 99.9%
Taylor expanded in y around 0 43.0%
if -7.5e14 < y < 1e4Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 97.8%
associate-+r+97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
associate-*r*97.8%
fma-def97.8%
*-commutative97.8%
unpow297.8%
Simplified97.8%
fma-udef97.8%
associate-*l*97.8%
Applied egg-rr97.8%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -440.0) (not (<= y 9.5e+60))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -440.0) || !(y <= 9.5e+60)) {
tmp = z + x;
} else {
tmp = z + (y + 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 ((y <= (-440.0d0)) .or. (.not. (y <= 9.5d+60))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -440.0) || !(y <= 9.5e+60)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -440.0) or not (y <= 9.5e+60): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -440.0) || !(y <= 9.5e+60)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -440.0) || ~((y <= 9.5e+60))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -440.0], N[Not[LessEqual[y, 9.5e+60]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -440 \lor \neg \left(y \leq 9.5 \cdot 10^{+60}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -440 or 9.49999999999999988e60 < y Initial program 99.8%
Taylor expanded in y around 0 42.2%
if -440 < y < 9.49999999999999988e60Initial program 100.0%
Taylor expanded in y around 0 95.2%
+-commutative95.2%
associate-+l+95.2%
+-commutative95.2%
Simplified95.2%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (if (<= x -1.4e-53) x (if (<= x 1.6e-28) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-53) {
tmp = x;
} else if (x <= 1.6e-28) {
tmp = z + 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.4d-53)) then
tmp = x
else if (x <= 1.6d-28) then
tmp = z + 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.4e-53) {
tmp = x;
} else if (x <= 1.6e-28) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4e-53: tmp = x elif x <= 1.6e-28: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4e-53) tmp = x; elseif (x <= 1.6e-28) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4e-53) tmp = x; elseif (x <= 1.6e-28) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4e-53], x, If[LessEqual[x, 1.6e-28], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-53}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-28}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.39999999999999993e-53 or 1.59999999999999991e-28 < x Initial program 99.9%
Taylor expanded in x around inf 71.3%
if -1.39999999999999993e-53 < x < 1.59999999999999991e-28Initial program 99.9%
Taylor expanded in y around 0 80.1%
Taylor expanded in y around 0 56.3%
Taylor expanded in x around 0 46.1%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= x -6.5e-102) x (if (<= x 1.35e-28) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.5e-102) {
tmp = x;
} else if (x <= 1.35e-28) {
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 <= (-6.5d-102)) then
tmp = x
else if (x <= 1.35d-28) 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 <= -6.5e-102) {
tmp = x;
} else if (x <= 1.35e-28) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.5e-102: tmp = x elif x <= 1.35e-28: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.5e-102) tmp = x; elseif (x <= 1.35e-28) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.5e-102) tmp = x; elseif (x <= 1.35e-28) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.5e-102], x, If[LessEqual[x, 1.35e-28], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-102}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-28}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.5000000000000003e-102 or 1.3499999999999999e-28 < x Initial program 99.9%
Taylor expanded in x around inf 67.4%
if -6.5000000000000003e-102 < x < 1.3499999999999999e-28Initial program 99.9%
Taylor expanded in y around 0 81.2%
Taylor expanded in z around inf 41.9%
Final simplification58.3%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 68.4%
Final simplification68.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 47.2%
Final simplification47.2%
herbie shell --seed 2023240
(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))))