
(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 11 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 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.2e+168)
(not
(or (<= z -4.5e+122) (and (not (<= z -1.7e+84)) (<= z 3.2e+79)))))
(- 1.0 (* z (sin y)))
(+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2e+168) || !((z <= -4.5e+122) || (!(z <= -1.7e+84) && (z <= 3.2e+79)))) {
tmp = 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.2d+168)) .or. (.not. (z <= (-4.5d+122)) .or. (.not. (z <= (-1.7d+84))) .and. (z <= 3.2d+79))) then
tmp = 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.2e+168) || !((z <= -4.5e+122) || (!(z <= -1.7e+84) && (z <= 3.2e+79)))) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.2e+168) or not ((z <= -4.5e+122) or (not (z <= -1.7e+84) and (z <= 3.2e+79))): tmp = 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.2e+168) || !((z <= -4.5e+122) || (!(z <= -1.7e+84) && (z <= 3.2e+79)))) tmp = Float64(1.0 - Float64(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.2e+168) || ~(((z <= -4.5e+122) || (~((z <= -1.7e+84)) && (z <= 3.2e+79))))) tmp = 1.0 - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.2e+168], N[Not[Or[LessEqual[z, -4.5e+122], And[N[Not[LessEqual[z, -1.7e+84]], $MachinePrecision], LessEqual[z, 3.2e+79]]]], $MachinePrecision]], N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+168} \lor \neg \left(z \leq -4.5 \cdot 10^{+122} \lor \neg \left(z \leq -1.7 \cdot 10^{+84}\right) \land z \leq 3.2 \cdot 10^{+79}\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.20000000000000005e168 or -4.49999999999999997e122 < z < -1.6999999999999999e84 or 3.20000000000000003e79 < z Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
add-cube-cbrt98.7%
distribute-rgt-neg-in98.7%
fma-define98.7%
pow298.7%
Applied egg-rr98.7%
Taylor expanded in x around inf 78.8%
fma-define78.8%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in y around 0 78.7%
Taylor expanded in x around 0 78.1%
mul-1-neg78.1%
unsub-neg78.1%
Simplified78.1%
if -1.20000000000000005e168 < z < -4.49999999999999997e122 or -1.6999999999999999e84 < z < 3.20000000000000003e79Initial program 100.0%
Taylor expanded in z around 0 93.6%
+-commutative93.6%
Simplified93.6%
Final simplification87.6%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.22e+168)
(not
(or (<= z -1.7e+123) (and (not (<= z -2.8e+82)) (<= z 6.8e+94)))))
(* z (- (sin y)))
(+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.22e+168) || !((z <= -1.7e+123) || (!(z <= -2.8e+82) && (z <= 6.8e+94)))) {
tmp = 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.22d+168)) .or. (.not. (z <= (-1.7d+123)) .or. (.not. (z <= (-2.8d+82))) .and. (z <= 6.8d+94))) then
tmp = 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.22e+168) || !((z <= -1.7e+123) || (!(z <= -2.8e+82) && (z <= 6.8e+94)))) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.22e+168) or not ((z <= -1.7e+123) or (not (z <= -2.8e+82) and (z <= 6.8e+94))): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.22e+168) || !((z <= -1.7e+123) || (!(z <= -2.8e+82) && (z <= 6.8e+94)))) tmp = Float64(z * Float64(-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.22e+168) || ~(((z <= -1.7e+123) || (~((z <= -2.8e+82)) && (z <= 6.8e+94))))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.22e+168], N[Not[Or[LessEqual[z, -1.7e+123], And[N[Not[LessEqual[z, -2.8e+82]], $MachinePrecision], LessEqual[z, 6.8e+94]]]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+168} \lor \neg \left(z \leq -1.7 \cdot 10^{+123} \lor \neg \left(z \leq -2.8 \cdot 10^{+82}\right) \land z \leq 6.8 \cdot 10^{+94}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.21999999999999991e168 or -1.70000000000000001e123 < z < -2.8e82 or 6.8000000000000004e94 < z Initial program 99.7%
Taylor expanded in z around inf 71.7%
associate-*r*71.7%
neg-mul-171.7%
*-commutative71.7%
Simplified71.7%
if -1.21999999999999991e168 < z < -1.70000000000000001e123 or -2.8e82 < z < 6.8000000000000004e94Initial program 100.0%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
Simplified91.9%
Final simplification84.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.55) (not (<= z 0.2))) (+ 1.0 (- x (* z (sin y)))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.55) || !(z <= 0.2)) {
tmp = 1.0 + (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 <= (-0.55d0)) .or. (.not. (z <= 0.2d0))) then
tmp = 1.0d0 + (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 <= -0.55) || !(z <= 0.2)) {
tmp = 1.0 + (x - (z * Math.sin(y)));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.55) or not (z <= 0.2): tmp = 1.0 + (x - (z * math.sin(y))) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.55) || !(z <= 0.2)) tmp = Float64(1.0 + Float64(x - Float64(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 <= -0.55) || ~((z <= 0.2))) tmp = 1.0 + (x - (z * sin(y))); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.55], N[Not[LessEqual[z, 0.2]], $MachinePrecision]], N[(1.0 + N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.55 \lor \neg \left(z \leq 0.2\right):\\
\;\;\;\;1 + \left(x - z \cdot \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -0.55000000000000004 or 0.20000000000000001 < z Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
add-cube-cbrt98.9%
distribute-rgt-neg-in98.9%
fma-define98.9%
pow298.9%
Applied egg-rr98.9%
Taylor expanded in x around inf 84.2%
fma-define84.2%
associate-/l*84.1%
Simplified84.1%
Taylor expanded in y around 0 84.0%
Taylor expanded in x around 0 99.7%
associate-*r*99.7%
mul-1-neg99.7%
Simplified99.7%
if -0.55000000000000004 < z < 0.20000000000000001Initial program 100.0%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -12500000000000.0) (not (<= y 3.6e-15))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -12500000000000.0) || !(y <= 3.6e-15)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 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 <= (-12500000000000.0d0)) .or. (.not. (y <= 3.6d-15))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -12500000000000.0) || !(y <= 3.6e-15)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -12500000000000.0) or not (y <= 3.6e-15): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -12500000000000.0) || !(y <= 3.6e-15)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -12500000000000.0) || ~((y <= 3.6e-15))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -12500000000000.0], N[Not[LessEqual[y, 3.6e-15]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -12500000000000 \lor \neg \left(y \leq 3.6 \cdot 10^{-15}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -1.25e13 or 3.6000000000000001e-15 < y Initial program 99.8%
Taylor expanded in z around 0 59.9%
+-commutative59.9%
Simplified59.9%
if -1.25e13 < y < 3.6000000000000001e-15Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification78.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.1e+16) (not (<= y 1.6e+31))) (* x (/ (+ x (/ -1.0 x)) (+ x -1.0))) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.1e+16) || !(y <= 1.6e+31)) {
tmp = x * ((x + (-1.0 / x)) / (x + -1.0));
} else {
tmp = x + (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 ((y <= (-4.1d+16)) .or. (.not. (y <= 1.6d+31))) then
tmp = x * ((x + ((-1.0d0) / x)) / (x + (-1.0d0)))
else
tmp = x + (1.0d0 - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.1e+16) || !(y <= 1.6e+31)) {
tmp = x * ((x + (-1.0 / x)) / (x + -1.0));
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.1e+16) or not (y <= 1.6e+31): tmp = x * ((x + (-1.0 / x)) / (x + -1.0)) else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.1e+16) || !(y <= 1.6e+31)) tmp = Float64(x * Float64(Float64(x + Float64(-1.0 / x)) / Float64(x + -1.0))); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.1e+16) || ~((y <= 1.6e+31))) tmp = x * ((x + (-1.0 / x)) / (x + -1.0)); else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.1e+16], N[Not[LessEqual[y, 1.6e+31]], $MachinePrecision]], N[(x * N[(N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+16} \lor \neg \left(y \leq 1.6 \cdot 10^{+31}\right):\\
\;\;\;\;x \cdot \frac{x + \frac{-1}{x}}{x + -1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -4.1e16 or 1.6e31 < y Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
add-cube-cbrt99.2%
distribute-rgt-neg-in99.2%
fma-define99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in x around inf 88.3%
fma-define88.3%
associate-/l*88.2%
Simplified88.2%
distribute-rgt-in88.2%
*-un-lft-identity88.2%
flip-+51.3%
pow251.3%
Applied egg-rr51.3%
Simplified39.6%
Taylor expanded in y around 0 22.7%
associate-/l*43.7%
sub-neg43.7%
metadata-eval43.7%
Simplified43.7%
if -4.1e16 < y < 1.6e31Initial program 99.9%
Taylor expanded in y around 0 94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
mul-1-neg94.3%
unsub-neg94.3%
Simplified94.3%
Final simplification70.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e+16) (not (<= y 1.35e+32))) (* x (/ (+ x (/ -1.0 x)) (+ x -1.0))) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+16) || !(y <= 1.35e+32)) {
tmp = x * ((x + (-1.0 / x)) / (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 <= (-6d+16)) .or. (.not. (y <= 1.35d+32))) then
tmp = x * ((x + ((-1.0d0) / x)) / (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 <= -6e+16) || !(y <= 1.35e+32)) {
tmp = x * ((x + (-1.0 / x)) / (x + -1.0));
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6e+16) or not (y <= 1.35e+32): tmp = x * ((x + (-1.0 / x)) / (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 <= -6e+16) || !(y <= 1.35e+32)) tmp = Float64(x * Float64(Float64(x + Float64(-1.0 / x)) / 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 <= -6e+16) || ~((y <= 1.35e+32))) tmp = x * ((x + (-1.0 / x)) / (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, -6e+16], N[Not[LessEqual[y, 1.35e+32]], $MachinePrecision]], N[(x * N[(N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $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 -6 \cdot 10^{+16} \lor \neg \left(y \leq 1.35 \cdot 10^{+32}\right):\\
\;\;\;\;x \cdot \frac{x + \frac{-1}{x}}{x + -1}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -6e16 or 1.35000000000000006e32 < y Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
add-cube-cbrt99.2%
distribute-rgt-neg-in99.2%
fma-define99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in x around inf 88.2%
fma-define88.2%
associate-/l*88.1%
Simplified88.1%
distribute-rgt-in88.2%
*-un-lft-identity88.2%
flip-+50.9%
pow250.9%
Applied egg-rr50.9%
Simplified39.1%
Taylor expanded in y around 0 22.8%
associate-/l*44.0%
sub-neg44.0%
metadata-eval44.0%
Simplified44.0%
if -6e16 < y < 1.35000000000000006e32Initial program 99.9%
Taylor expanded in y around 0 93.8%
Final simplification70.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.6e+16) (not (<= y 1.6e+31))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.6e+16) || !(y <= 1.6e+31)) {
tmp = x + 1.0;
} else {
tmp = x + (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 ((y <= (-3.6d+16)) .or. (.not. (y <= 1.6d+31))) then
tmp = x + 1.0d0
else
tmp = x + (1.0d0 - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.6e+16) || !(y <= 1.6e+31)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.6e+16) or not (y <= 1.6e+31): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.6e+16) || !(y <= 1.6e+31)) tmp = Float64(x + 1.0); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.6e+16) || ~((y <= 1.6e+31))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.6e+16], N[Not[LessEqual[y, 1.6e+31]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{+16} \lor \neg \left(y \leq 1.6 \cdot 10^{+31}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -3.6e16 or 1.6e31 < y Initial program 99.8%
Taylor expanded in y around 0 43.7%
+-commutative43.7%
Simplified43.7%
if -3.6e16 < y < 1.6e31Initial program 99.9%
Taylor expanded in y around 0 94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
mul-1-neg94.3%
unsub-neg94.3%
Simplified94.3%
Final simplification70.0%
(FPCore (x y z) :precision binary64 (if (<= x -4.9e-8) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.9e-8) {
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 <= (-4.9d-8)) 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 <= -4.9e-8) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.9e-8: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.9e-8) 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 <= -4.9e-8) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.9e-8], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.9000000000000002e-8 or 1 < x Initial program 99.9%
Taylor expanded in x around inf 78.4%
if -4.9000000000000002e-8 < x < 1Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
add-cube-cbrt99.1%
distribute-rgt-neg-in99.1%
fma-define99.1%
pow299.1%
Applied egg-rr99.1%
Taylor expanded in x around inf 79.6%
fma-define79.6%
associate-/l*79.6%
Simplified79.6%
Taylor expanded in y around 0 37.4%
Taylor expanded in x around 0 37.5%
Final simplification60.4%
(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 99.9%
Taylor expanded in y around 0 60.4%
+-commutative60.4%
Simplified60.4%
Final simplification60.4%
(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 99.9%
sub-neg99.9%
+-commutative99.9%
add-cube-cbrt99.4%
distribute-rgt-neg-in99.4%
fma-define99.4%
pow299.4%
Applied egg-rr99.4%
Taylor expanded in x around inf 90.9%
fma-define90.9%
associate-/l*90.9%
Simplified90.9%
Taylor expanded in y around 0 60.4%
Taylor expanded in x around 0 18.2%
Final simplification18.2%
herbie shell --seed 2024071
(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))))