
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 100.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.8e-16) (not (<= x 2.1e-18))) (* x (+ 1.0 (* z (/ (- (/ 1.0 z) (sin y)) x)))) (- (cos y) (* z (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.8e-16) || !(x <= 2.1e-18)) {
tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x)));
} else {
tmp = cos(y) - (z * 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 ((x <= (-4.8d-16)) .or. (.not. (x <= 2.1d-18))) then
tmp = x * (1.0d0 + (z * (((1.0d0 / z) - sin(y)) / x)))
else
tmp = cos(y) - (z * sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.8e-16) || !(x <= 2.1e-18)) {
tmp = x * (1.0 + (z * (((1.0 / z) - Math.sin(y)) / x)));
} else {
tmp = Math.cos(y) - (z * Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.8e-16) or not (x <= 2.1e-18): tmp = x * (1.0 + (z * (((1.0 / z) - math.sin(y)) / x))) else: tmp = math.cos(y) - (z * math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.8e-16) || !(x <= 2.1e-18)) tmp = Float64(x * Float64(1.0 + Float64(z * Float64(Float64(Float64(1.0 / z) - sin(y)) / x)))); else tmp = Float64(cos(y) - Float64(z * sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.8e-16) || ~((x <= 2.1e-18))) tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x))); else tmp = cos(y) - (z * sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.8e-16], N[Not[LessEqual[x, 2.1e-18]], $MachinePrecision]], N[(x * N[(1.0 + N[(z * N[(N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-16} \lor \neg \left(x \leq 2.1 \cdot 10^{-18}\right):\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\frac{1}{z} - \sin y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\end{array}
\end{array}
if x < -4.8000000000000001e-16 or 2.1e-18 < x Initial program 100.0%
Taylor expanded in z around -inf 79.2%
mul-1-neg79.2%
distribute-rgt-neg-in79.2%
distribute-lft-out--79.2%
mul-1-neg79.2%
remove-double-neg79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in x around inf 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 99.3%
if -4.8000000000000001e-16 < x < 2.1e-18Initial program 99.9%
Taylor expanded in x around 0 99.9%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.42e+32) (not (<= z 10.5))) (* z (- (/ (+ x 1.0) z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.42e+32) || !(z <= 10.5)) {
tmp = z * (((x + 1.0) / z) - sin(y));
} else {
tmp = x + cos(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.42d+32)) .or. (.not. (z <= 10.5d0))) then
tmp = z * (((x + 1.0d0) / z) - sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.42e+32) || !(z <= 10.5)) {
tmp = z * (((x + 1.0) / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.42e+32) or not (z <= 10.5): tmp = z * (((x + 1.0) / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.42e+32) || !(z <= 10.5)) tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.42e+32) || ~((z <= 10.5))) tmp = z * (((x + 1.0) / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.42e+32], N[Not[LessEqual[z, 10.5]], $MachinePrecision]], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.42 \cdot 10^{+32} \lor \neg \left(z \leq 10.5\right):\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.41999999999999992e32 or 10.5 < z Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
Simplified99.4%
if -1.41999999999999992e32 < z < 10.5Initial program 100.0%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.2e+95) (not (<= z 1.6e+74))) (* z (- (/ x z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e+95) || !(z <= 1.6e+74)) {
tmp = z * ((x / z) - sin(y));
} else {
tmp = x + cos(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-6.2d+95)) .or. (.not. (z <= 1.6d+74))) then
tmp = z * ((x / z) - sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e+95) || !(z <= 1.6e+74)) {
tmp = z * ((x / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.2e+95) or not (z <= 1.6e+74): tmp = z * ((x / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.2e+95) || !(z <= 1.6e+74)) tmp = Float64(z * Float64(Float64(x / z) - sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.2e+95) || ~((z <= 1.6e+74))) tmp = z * ((x / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.2e+95], N[Not[LessEqual[z, 1.6e+74]], $MachinePrecision]], N[(z * N[(N[(x / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+95} \lor \neg \left(z \leq 1.6 \cdot 10^{+74}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.2000000000000006e95 or 1.59999999999999997e74 < z Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 86.7%
if -6.2000000000000006e95 < z < 1.59999999999999997e74Initial program 100.0%
Taylor expanded in z around 0 94.9%
+-commutative94.9%
Simplified94.9%
Final simplification92.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0125) (not (<= y 1.4e-18))) (+ x (cos y)) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0125) || !(y <= 1.4e-18)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-0.0125d0)) .or. (.not. (y <= 1.4d-18))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0125) || !(y <= 1.4e-18)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0125) or not (y <= 1.4e-18): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0125) || !(y <= 1.4e-18)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0125) || ~((y <= 1.4e-18))) tmp = x + cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0125], N[Not[LessEqual[y, 1.4e-18]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0125 \lor \neg \left(y \leq 1.4 \cdot 10^{-18}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -0.012500000000000001 or 1.40000000000000006e-18 < y Initial program 99.9%
Taylor expanded in z around 0 74.2%
+-commutative74.2%
Simplified74.2%
if -0.012500000000000001 < y < 1.40000000000000006e-18Initial program 100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.5e-34) (not (<= x 2.1e-18))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.5e-34) || !(x <= 2.1e-18)) {
tmp = x + 1.0;
} else {
tmp = 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 <= (-9.5d-34)) .or. (.not. (x <= 2.1d-18))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9.5e-34) || !(x <= 2.1e-18)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9.5e-34) or not (x <= 2.1e-18): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9.5e-34) || !(x <= 2.1e-18)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9.5e-34) || ~((x <= 2.1e-18))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.5e-34], N[Not[LessEqual[x, 2.1e-18]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-34} \lor \neg \left(x \leq 2.1 \cdot 10^{-18}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -9.49999999999999985e-34 or 2.1e-18 < x Initial program 100.0%
Taylor expanded in y around 0 85.2%
+-commutative85.2%
Simplified85.2%
if -9.49999999999999985e-34 < x < 2.1e-18Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 76.5%
Final simplification81.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -3e+36) (not (<= y 0.195))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+36) || !(y <= 0.195)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - 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+36)) .or. (.not. (y <= 0.195d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+36) || !(y <= 0.195)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3e+36) or not (y <= 0.195): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3e+36) || !(y <= 0.195)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3e+36) || ~((y <= 0.195))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3e+36], N[Not[LessEqual[y, 0.195]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+36} \lor \neg \left(y \leq 0.195\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -3e36 or 0.19500000000000001 < y Initial program 99.9%
Taylor expanded in y around 0 47.6%
+-commutative47.6%
Simplified47.6%
if -3e36 < y < 0.19500000000000001Initial program 100.0%
Taylor expanded in y around 0 97.3%
Final simplification74.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.8e+36) (not (<= y 3.25e+42))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.8e+36) || !(y <= 3.25e+42)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-9.8d+36)) .or. (.not. (y <= 3.25d+42))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9.8e+36) || !(y <= 3.25e+42)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.8e+36) or not (y <= 3.25e+42): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.8e+36) || !(y <= 3.25e+42)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.8e+36) || ~((y <= 3.25e+42))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.8e+36], N[Not[LessEqual[y, 3.25e+42]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+36} \lor \neg \left(y \leq 3.25 \cdot 10^{+42}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -9.79999999999999962e36 or 3.25000000000000026e42 < y Initial program 99.9%
Taylor expanded in y around 0 46.5%
+-commutative46.5%
Simplified46.5%
if -9.79999999999999962e36 < y < 3.25000000000000026e42Initial program 100.0%
Taylor expanded in y around 0 95.9%
mul-1-neg95.9%
unsub-neg95.9%
Simplified95.9%
Final simplification74.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.2e-16) (not (<= x 1.02e-24))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.2e-16) || !(x <= 1.02e-24)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.2d-16)) .or. (.not. (x <= 1.02d-24))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.2e-16) || !(x <= 1.02e-24)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.2e-16) or not (x <= 1.02e-24): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.2e-16) || !(x <= 1.02e-24)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.2e-16) || ~((x <= 1.02e-24))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.2e-16], N[Not[LessEqual[x, 1.02e-24]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-16} \lor \neg \left(x \leq 1.02 \cdot 10^{-24}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -2.2e-16 or 1.0200000000000001e-24 < x Initial program 100.0%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -2.2e-16 < x < 1.0200000000000001e-24Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 55.8%
mul-1-neg55.8%
unsub-neg55.8%
Simplified55.8%
Final simplification72.6%
(FPCore (x y z) :precision binary64 (if (<= x -0.98) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.98) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-0.98d0)) then
tmp = x
else if (x <= 1.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.98) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.98: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.98) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.98) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.98], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.98:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.97999999999999998 or 1 < x Initial program 100.0%
Taylor expanded in x around inf 86.4%
if -0.97999999999999998 < x < 1Initial program 99.9%
Taylor expanded in x around 0 98.7%
Taylor expanded in y around 0 47.7%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 69.0%
+-commutative69.0%
Simplified69.0%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 54.1%
Taylor expanded in y around 0 24.2%
herbie shell --seed 2024100
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))