
(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.55e+72)
t_0
(if (<= z 5e-20)
(+ x (sin y))
(if (or (<= z 4.2e+94) (and (not (<= z 4.5e+178)) (<= z 2.95e+199)))
(+ x z)
t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.55e+72) {
tmp = t_0;
} else if (z <= 5e-20) {
tmp = x + sin(y);
} else if ((z <= 4.2e+94) || (!(z <= 4.5e+178) && (z <= 2.95e+199))) {
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.55d+72)) then
tmp = t_0
else if (z <= 5d-20) then
tmp = x + sin(y)
else if ((z <= 4.2d+94) .or. (.not. (z <= 4.5d+178)) .and. (z <= 2.95d+199)) 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.55e+72) {
tmp = t_0;
} else if (z <= 5e-20) {
tmp = x + Math.sin(y);
} else if ((z <= 4.2e+94) || (!(z <= 4.5e+178) && (z <= 2.95e+199))) {
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.55e+72: tmp = t_0 elif z <= 5e-20: tmp = x + math.sin(y) elif (z <= 4.2e+94) or (not (z <= 4.5e+178) and (z <= 2.95e+199)): 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.55e+72) tmp = t_0; elseif (z <= 5e-20) tmp = Float64(x + sin(y)); elseif ((z <= 4.2e+94) || (!(z <= 4.5e+178) && (z <= 2.95e+199))) 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.55e+72) tmp = t_0; elseif (z <= 5e-20) tmp = x + sin(y); elseif ((z <= 4.2e+94) || (~((z <= 4.5e+178)) && (z <= 2.95e+199))) 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.55e+72], t$95$0, If[LessEqual[z, 5e-20], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.2e+94], And[N[Not[LessEqual[z, 4.5e+178]], $MachinePrecision], LessEqual[z, 2.95e+199]]], N[(x + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-20}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+94} \lor \neg \left(z \leq 4.5 \cdot 10^{+178}\right) \land z \leq 2.95 \cdot 10^{+199}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.54999999999999994e72 or 4.19999999999999979e94 < z < 4.4999999999999997e178 or 2.94999999999999998e199 < z Initial program 99.9%
Taylor expanded in z around inf 90.7%
if -1.54999999999999994e72 < z < 4.9999999999999999e-20Initial program 100.0%
Taylor expanded in z around 0 91.1%
+-commutative91.1%
Simplified91.1%
if 4.9999999999999999e-20 < z < 4.19999999999999979e94 or 4.4999999999999997e178 < z < 2.94999999999999998e199Initial program 99.9%
Taylor expanded in y around 0 80.1%
+-commutative80.1%
Simplified80.1%
Final simplification89.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= x -6.3e-40)
(+ x z)
(if (<= x 1.06e-104)
t_0
(if (<= x 6.8e-28) (sin y) (if (<= x 1.06e+27) t_0 (+ x z)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (x <= -6.3e-40) {
tmp = x + z;
} else if (x <= 1.06e-104) {
tmp = t_0;
} else if (x <= 6.8e-28) {
tmp = sin(y);
} else if (x <= 1.06e+27) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (x <= (-6.3d-40)) then
tmp = x + z
else if (x <= 1.06d-104) then
tmp = t_0
else if (x <= 6.8d-28) then
tmp = sin(y)
else if (x <= 1.06d+27) then
tmp = t_0
else
tmp = x + z
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 (x <= -6.3e-40) {
tmp = x + z;
} else if (x <= 1.06e-104) {
tmp = t_0;
} else if (x <= 6.8e-28) {
tmp = Math.sin(y);
} else if (x <= 1.06e+27) {
tmp = t_0;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if x <= -6.3e-40: tmp = x + z elif x <= 1.06e-104: tmp = t_0 elif x <= 6.8e-28: tmp = math.sin(y) elif x <= 1.06e+27: tmp = t_0 else: tmp = x + z return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (x <= -6.3e-40) tmp = Float64(x + z); elseif (x <= 1.06e-104) tmp = t_0; elseif (x <= 6.8e-28) tmp = sin(y); elseif (x <= 1.06e+27) tmp = t_0; else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (x <= -6.3e-40) tmp = x + z; elseif (x <= 1.06e-104) tmp = t_0; elseif (x <= 6.8e-28) tmp = sin(y); elseif (x <= 1.06e+27) tmp = t_0; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.3e-40], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.06e-104], t$95$0, If[LessEqual[x, 6.8e-28], N[Sin[y], $MachinePrecision], If[LessEqual[x, 1.06e+27], t$95$0, N[(x + z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -6.3 \cdot 10^{-40}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-28}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -6.3000000000000001e-40 or 1.05999999999999994e27 < x Initial program 100.0%
Taylor expanded in y around 0 91.3%
+-commutative91.3%
Simplified91.3%
if -6.3000000000000001e-40 < x < 1.06e-104 or 6.8000000000000001e-28 < x < 1.05999999999999994e27Initial program 99.9%
Taylor expanded in z around inf 66.5%
if 1.06e-104 < x < 6.8000000000000001e-28Initial program 100.0%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 67.9%
Taylor expanded in x around 0 55.1%
Final simplification78.5%
(FPCore (x y z) :precision binary64 (if (<= x -5.5e-57) (+ x z) (if (<= x 9.6e-72) (+ z (+ x y)) (if (<= x 0.00115) (sin y) (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.5e-57) {
tmp = x + z;
} else if (x <= 9.6e-72) {
tmp = z + (x + y);
} else if (x <= 0.00115) {
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 (x <= (-5.5d-57)) then
tmp = x + z
else if (x <= 9.6d-72) then
tmp = z + (x + y)
else if (x <= 0.00115d0) 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 (x <= -5.5e-57) {
tmp = x + z;
} else if (x <= 9.6e-72) {
tmp = z + (x + y);
} else if (x <= 0.00115) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.5e-57: tmp = x + z elif x <= 9.6e-72: tmp = z + (x + y) elif x <= 0.00115: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.5e-57) tmp = Float64(x + z); elseif (x <= 9.6e-72) tmp = Float64(z + Float64(x + y)); elseif (x <= 0.00115) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.5e-57) tmp = x + z; elseif (x <= 9.6e-72) tmp = z + (x + y); elseif (x <= 0.00115) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.5e-57], N[(x + z), $MachinePrecision], If[LessEqual[x, 9.6e-72], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00115], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-57}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{-72}:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{elif}\;x \leq 0.00115:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -5.50000000000000011e-57 or 0.00115 < x Initial program 100.0%
Taylor expanded in y around 0 89.0%
+-commutative89.0%
Simplified89.0%
if -5.50000000000000011e-57 < x < 9.6e-72Initial program 100.0%
Taylor expanded in y around 0 51.3%
associate-+r+51.3%
+-commutative51.3%
Simplified51.3%
if 9.6e-72 < x < 0.00115Initial program 99.8%
Taylor expanded in x around inf 100.0%
Taylor expanded in z around 0 62.2%
Taylor expanded in x around 0 56.0%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4e+22) (not (<= z 2.3e-16))) (+ x (* z (cos y))) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e+22) || !(z <= 2.3e-16)) {
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 <= (-2.4d+22)) .or. (.not. (z <= 2.3d-16))) 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 <= -2.4e+22) || !(z <= 2.3e-16)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e+22) or not (z <= 2.3e-16): 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 <= -2.4e+22) || !(z <= 2.3e-16)) 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 <= -2.4e+22) || ~((z <= 2.3e-16))) tmp = x + (z * cos(y)); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e+22], N[Not[LessEqual[z, 2.3e-16]], $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 -2.4 \cdot 10^{+22} \lor \neg \left(z \leq 2.3 \cdot 10^{-16}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -2.4e22 or 2.2999999999999999e-16 < z Initial program 99.9%
Taylor expanded in x around inf 99.3%
if -2.4e22 < z < 2.2999999999999999e-16Initial program 100.0%
Taylor expanded in y around 0 99.8%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.5) (not (<= z 2.3e-16))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.5) || !(z <= 2.3e-16)) {
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 <= (-8.5d0)) .or. (.not. (z <= 2.3d-16))) 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 <= -8.5) || !(z <= 2.3e-16)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.5) or not (z <= 2.3e-16): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.5) || !(z <= 2.3e-16)) 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 <= -8.5) || ~((z <= 2.3e-16))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.5], N[Not[LessEqual[z, 2.3e-16]], $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 -8.5 \lor \neg \left(z \leq 2.3 \cdot 10^{-16}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -8.5 or 2.2999999999999999e-16 < z Initial program 99.9%
Taylor expanded in x around inf 99.3%
if -8.5 < z < 2.2999999999999999e-16Initial program 100.0%
Taylor expanded in z around 0 95.6%
+-commutative95.6%
Simplified95.6%
Final simplification97.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.5e-10) (not (<= x 3.6e-17))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.5e-10) || !(x <= 3.6e-17)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.5d-10)) .or. (.not. (x <= 3.6d-17))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.5e-10) || !(x <= 3.6e-17)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.5e-10) or not (x <= 3.6e-17): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.5e-10) || !(x <= 3.6e-17)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.5e-10) || ~((x <= 3.6e-17))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.5e-10], N[Not[LessEqual[x, 3.6e-17]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-10} \lor \neg \left(x \leq 3.6 \cdot 10^{-17}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.50000000000000016e-10 or 3.59999999999999995e-17 < x Initial program 99.9%
Taylor expanded in y around 0 89.3%
+-commutative89.3%
Simplified89.3%
if -2.50000000000000016e-10 < x < 3.59999999999999995e-17Initial program 99.9%
Taylor expanded in y around 0 50.2%
Final simplification70.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.5e-56) (not (<= x 1.8e-13))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.5e-56) || !(x <= 1.8e-13)) {
tmp = x + z;
} else {
tmp = z + (x + 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.5d-56)) .or. (.not. (x <= 1.8d-13))) then
tmp = x + z
else
tmp = z + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.5e-56) || !(x <= 1.8e-13)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.5e-56) or not (x <= 1.8e-13): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.5e-56) || !(x <= 1.8e-13)) tmp = Float64(x + z); else tmp = Float64(z + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.5e-56) || ~((x <= 1.8e-13))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.5e-56], N[Not[LessEqual[x, 1.8e-13]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-56} \lor \neg \left(x \leq 1.8 \cdot 10^{-13}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if x < -1.49999999999999995e-56 or 1.7999999999999999e-13 < x Initial program 99.9%
Taylor expanded in y around 0 87.8%
+-commutative87.8%
Simplified87.8%
if -1.49999999999999995e-56 < x < 1.7999999999999999e-13Initial program 99.9%
Taylor expanded in y around 0 47.6%
associate-+r+47.6%
+-commutative47.6%
Simplified47.6%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (<= z -1.08e+74) z (if (<= z 6.8e+93) x z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.08e+74) {
tmp = z;
} else if (z <= 6.8e+93) {
tmp = x;
} else {
tmp = 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.08d+74)) then
tmp = z
else if (z <= 6.8d+93) then
tmp = x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.08e+74) {
tmp = z;
} else if (z <= 6.8e+93) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.08e+74: tmp = z elif z <= 6.8e+93: tmp = x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.08e+74) tmp = z; elseif (z <= 6.8e+93) tmp = x; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.08e+74) tmp = z; elseif (z <= 6.8e+93) tmp = x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.08e+74], z, If[LessEqual[z, 6.8e+93], x, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{+74}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.08e74 or 6.8000000000000001e93 < z Initial program 99.9%
Taylor expanded in z around inf 87.1%
Taylor expanded in y around 0 55.3%
if -1.08e74 < z < 6.8000000000000001e93Initial program 100.0%
Taylor expanded in y around 0 45.7%
Taylor expanded in x around inf 57.0%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 66.9%
+-commutative66.9%
Simplified66.9%
Final simplification66.9%
(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 y around 0 51.7%
Taylor expanded in x around inf 40.8%
herbie shell --seed 2024086
(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))))