
(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 16 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 (+ (cos y) (fma z (- (sin y)) x)))
double code(double x, double y, double z) {
return cos(y) + fma(z, -sin(y), x);
}
function code(x, y, z) return Float64(cos(y) + fma(z, Float64(-sin(y)), x)) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] + N[(z * (-N[Sin[y], $MachinePrecision]) + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos y + \mathsf{fma}\left(z, -\sin y, x\right)
\end{array}
Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (<= x -108000000.0) (* x (+ 1.0 (* z (/ (- (/ 1.0 z) (sin y)) x)))) (if (<= x 3e-35) (- (cos y) (* z (sin y))) (+ (fma z (- (sin y)) x) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -108000000.0) {
tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x)));
} else if (x <= 3e-35) {
tmp = cos(y) - (z * sin(y));
} else {
tmp = fma(z, -sin(y), x) + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -108000000.0) tmp = Float64(x * Float64(1.0 + Float64(z * Float64(Float64(Float64(1.0 / z) - sin(y)) / x)))); elseif (x <= 3e-35) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = Float64(fma(z, Float64(-sin(y)), x) + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -108000000.0], N[(x * N[(1.0 + N[(z * N[(N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e-35], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * (-N[Sin[y], $MachinePrecision]) + x), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -108000000:\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\frac{1}{z} - \sin y}{x}\right)\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-35}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, -\sin y, x\right) + 1\\
\end{array}
\end{array}
if x < -1.08e8Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in z around -inf 81.3%
mul-1-neg81.3%
distribute-rgt-neg-in81.3%
+-commutative81.3%
*-lft-identity81.3%
metadata-eval81.3%
cancel-sign-sub-inv81.3%
distribute-lft-out--81.3%
mul-1-neg81.3%
remove-double-neg81.3%
Simplified81.3%
Taylor expanded in y around 0 81.3%
+-commutative81.3%
Simplified81.3%
Taylor expanded in x around inf 99.9%
associate-/l*99.9%
Simplified99.9%
if -1.08e8 < x < 2.99999999999999989e-35Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 98.5%
neg-mul-198.5%
sub-neg98.5%
Simplified98.5%
if 2.99999999999999989e-35 < x Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 99.5%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (<= x -108000000.0)
(* x (+ 1.0 (* z (/ (- (/ 1.0 z) (sin y)) x))))
(if (<= x 3e-35) (- (cos y) t_0) (- (+ x 1.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if (x <= -108000000.0) {
tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x)));
} else if (x <= 3e-35) {
tmp = cos(y) - t_0;
} else {
tmp = (x + 1.0) - 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 * sin(y)
if (x <= (-108000000.0d0)) then
tmp = x * (1.0d0 + (z * (((1.0d0 / z) - sin(y)) / x)))
else if (x <= 3d-35) then
tmp = cos(y) - t_0
else
tmp = (x + 1.0d0) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if (x <= -108000000.0) {
tmp = x * (1.0 + (z * (((1.0 / z) - Math.sin(y)) / x)));
} else if (x <= 3e-35) {
tmp = Math.cos(y) - t_0;
} else {
tmp = (x + 1.0) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if x <= -108000000.0: tmp = x * (1.0 + (z * (((1.0 / z) - math.sin(y)) / x))) elif x <= 3e-35: tmp = math.cos(y) - t_0 else: tmp = (x + 1.0) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if (x <= -108000000.0) tmp = Float64(x * Float64(1.0 + Float64(z * Float64(Float64(Float64(1.0 / z) - sin(y)) / x)))); elseif (x <= 3e-35) tmp = Float64(cos(y) - t_0); else tmp = Float64(Float64(x + 1.0) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if (x <= -108000000.0) tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x))); elseif (x <= 3e-35) tmp = cos(y) - t_0; else tmp = (x + 1.0) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -108000000.0], N[(x * N[(1.0 + N[(z * N[(N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e-35], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -108000000:\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\frac{1}{z} - \sin y}{x}\right)\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-35}:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\end{array}
\end{array}
if x < -1.08e8Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in z around -inf 81.3%
mul-1-neg81.3%
distribute-rgt-neg-in81.3%
+-commutative81.3%
*-lft-identity81.3%
metadata-eval81.3%
cancel-sign-sub-inv81.3%
distribute-lft-out--81.3%
mul-1-neg81.3%
remove-double-neg81.3%
Simplified81.3%
Taylor expanded in y around 0 81.3%
+-commutative81.3%
Simplified81.3%
Taylor expanded in x around inf 99.9%
associate-/l*99.9%
Simplified99.9%
if -1.08e8 < x < 2.99999999999999989e-35Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 98.5%
neg-mul-198.5%
sub-neg98.5%
Simplified98.5%
if 2.99999999999999989e-35 < x Initial program 99.9%
Taylor expanded in y around 0 99.5%
(FPCore (x y z) :precision binary64 (- (+ (cos y) x) (* z (sin y))))
double code(double x, double y, double z) {
return (cos(y) + x) - (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 = (cos(y) + x) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (Math.cos(y) + x) - (z * Math.sin(y));
}
def code(x, y, z): return (math.cos(y) + x) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(cos(y) + x) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (cos(y) + x) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos y + x\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5) (not (<= z 0.023))) (- (+ x 1.0) (* z (sin y))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5) || !(z <= 0.023)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = cos(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 ((z <= (-1.5d0)) .or. (.not. (z <= 0.023d0))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5) || !(z <= 0.023)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5) or not (z <= 0.023): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5) || !(z <= 0.023)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.5) || ~((z <= 0.023))) tmp = (x + 1.0) - (z * sin(y)); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5], N[Not[LessEqual[z, 0.023]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \lor \neg \left(z \leq 0.023\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -1.5 or 0.023 < z Initial program 99.7%
Taylor expanded in y around 0 98.3%
if -1.5 < z < 0.023Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 99.5%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (if (<= z -0.75) (* z (- (/ (+ x 1.0) z) (sin y))) (if (<= z 0.011) (+ (cos y) x) (- (+ x 1.0) (* z (sin y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.75) {
tmp = z * (((x + 1.0) / z) - sin(y));
} else if (z <= 0.011) {
tmp = cos(y) + x;
} else {
tmp = (x + 1.0) - (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 (z <= (-0.75d0)) then
tmp = z * (((x + 1.0d0) / z) - sin(y))
else if (z <= 0.011d0) then
tmp = cos(y) + x
else
tmp = (x + 1.0d0) - (z * sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.75) {
tmp = z * (((x + 1.0) / z) - Math.sin(y));
} else if (z <= 0.011) {
tmp = Math.cos(y) + x;
} else {
tmp = (x + 1.0) - (z * Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.75: tmp = z * (((x + 1.0) / z) - math.sin(y)) elif z <= 0.011: tmp = math.cos(y) + x else: tmp = (x + 1.0) - (z * math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.75) tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - sin(y))); elseif (z <= 0.011) tmp = Float64(cos(y) + x); else tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.75) tmp = z * (((x + 1.0) / z) - sin(y)); elseif (z <= 0.011) tmp = cos(y) + x; else tmp = (x + 1.0) - (z * sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.75], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.011], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\
\mathbf{elif}\;z \leq 0.011:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\end{array}
\end{array}
if z < -0.75Initial program 99.7%
cancel-sign-sub-inv99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
sin-neg99.7%
fma-define99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
+-commutative99.7%
*-lft-identity99.7%
metadata-eval99.7%
cancel-sign-sub-inv99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
Simplified99.3%
if -0.75 < z < 0.010999999999999999Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 99.5%
if 0.010999999999999999 < z Initial program 99.8%
Taylor expanded in y around 0 97.1%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -19000000000.0) (not (<= z 2.9e+72))) (- x (* z (sin y))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -19000000000.0) || !(z <= 2.9e+72)) {
tmp = x - (z * sin(y));
} else {
tmp = cos(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 ((z <= (-19000000000.0d0)) .or. (.not. (z <= 2.9d+72))) then
tmp = x - (z * sin(y))
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -19000000000.0) || !(z <= 2.9e+72)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -19000000000.0) or not (z <= 2.9e+72): tmp = x - (z * math.sin(y)) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -19000000000.0) || !(z <= 2.9e+72)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -19000000000.0) || ~((z <= 2.9e+72))) tmp = x - (z * sin(y)); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -19000000000.0], N[Not[LessEqual[z, 2.9e+72]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -19000000000 \lor \neg \left(z \leq 2.9 \cdot 10^{+72}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -1.9e10 or 2.90000000000000017e72 < z Initial program 99.7%
add-log-exp99.7%
Applied egg-rr99.7%
add-log-exp99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 93.3%
if -1.9e10 < z < 2.90000000000000017e72Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 97.8%
Final simplification95.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e+77) (not (<= z 2.75e+191))) (* z (- (sin y))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+77) || !(z <= 2.75e+191)) {
tmp = z * -sin(y);
} else {
tmp = cos(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 ((z <= (-4.2d+77)) .or. (.not. (z <= 2.75d+191))) then
tmp = z * -sin(y)
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+77) || !(z <= 2.75e+191)) {
tmp = z * -Math.sin(y);
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e+77) or not (z <= 2.75e+191): tmp = z * -math.sin(y) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e+77) || !(z <= 2.75e+191)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.2e+77) || ~((z <= 2.75e+191))) tmp = z * -sin(y); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e+77], N[Not[LessEqual[z, 2.75e+191]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+77} \lor \neg \left(z \leq 2.75 \cdot 10^{+191}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -4.1999999999999997e77 or 2.7500000000000001e191 < z Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 72.3%
neg-mul-172.3%
distribute-rgt-neg-in72.3%
Simplified72.3%
if -4.1999999999999997e77 < z < 2.7500000000000001e191Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 91.4%
Final simplification86.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3100000000.0) (not (<= y 9e-6))) (+ (cos y) x) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3100000000.0) || !(y <= 9e-6)) {
tmp = cos(y) + x;
} 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 <= (-3100000000.0d0)) .or. (.not. (y <= 9d-6))) then
tmp = cos(y) + x
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 <= -3100000000.0) || !(y <= 9e-6)) {
tmp = Math.cos(y) + x;
} 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 <= -3100000000.0) or not (y <= 9e-6): tmp = math.cos(y) + x 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 <= -3100000000.0) || !(y <= 9e-6)) tmp = Float64(cos(y) + x); 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 <= -3100000000.0) || ~((y <= 9e-6))) tmp = cos(y) + x; 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, -3100000000.0], N[Not[LessEqual[y, 9e-6]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] + x), $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 -3100000000 \lor \neg \left(y \leq 9 \cdot 10^{-6}\right):\\
\;\;\;\;\cos y + x\\
\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 < -3.1e9 or 9.00000000000000023e-6 < y Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in z around 0 66.0%
if -3.1e9 < y < 9.00000000000000023e-6Initial program 99.9%
Taylor expanded in y around 0 98.6%
Final simplification83.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.062) (not (<= x 3e-35))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.062) || !(x <= 3e-35)) {
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 <= (-0.062d0)) .or. (.not. (x <= 3d-35))) 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 <= -0.062) || !(x <= 3e-35)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.062) or not (x <= 3e-35): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.062) || !(x <= 3e-35)) 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 <= -0.062) || ~((x <= 3e-35))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.062], N[Not[LessEqual[x, 3e-35]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.062 \lor \neg \left(x \leq 3 \cdot 10^{-35}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -0.062 or 2.99999999999999989e-35 < x Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 82.7%
if -0.062 < x < 2.99999999999999989e-35Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in z around 0 63.8%
Taylor expanded in x around 0 62.5%
Final simplification73.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.5e+27) (not (<= y 720.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.5e+27) || !(y <= 720.0)) {
tmp = x + 1.0;
} 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 <= (-3.5d+27)) .or. (.not. (y <= 720.0d0))) then
tmp = x + 1.0d0
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 <= -3.5e+27) || !(y <= 720.0)) {
tmp = x + 1.0;
} 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 <= -3.5e+27) or not (y <= 720.0): tmp = x + 1.0 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 <= -3.5e+27) || !(y <= 720.0)) tmp = Float64(x + 1.0); 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 <= -3.5e+27) || ~((y <= 720.0))) tmp = x + 1.0; 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, -3.5e+27], N[Not[LessEqual[y, 720.0]], $MachinePrecision]], N[(x + 1.0), $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 -3.5 \cdot 10^{+27} \lor \neg \left(y \leq 720\right):\\
\;\;\;\;x + 1\\
\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 < -3.5000000000000002e27 or 720 < y Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 44.8%
if -3.5000000000000002e27 < y < 720Initial program 99.9%
Taylor expanded in y around 0 95.3%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e+46) (not (<= y 840.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+46) || !(y <= 840.0)) {
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 <= (-1.45d+46)) .or. (.not. (y <= 840.0d0))) 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 <= -1.45e+46) || !(y <= 840.0)) {
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 <= -1.45e+46) or not (y <= 840.0): 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 <= -1.45e+46) || !(y <= 840.0)) 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 <= -1.45e+46) || ~((y <= 840.0))) 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, -1.45e+46], N[Not[LessEqual[y, 840.0]], $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 -1.45 \cdot 10^{+46} \lor \neg \left(y \leq 840\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -1.4500000000000001e46 or 840 < y Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 44.6%
if -1.4500000000000001e46 < y < 840Initial program 99.9%
Taylor expanded in y around 0 93.8%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -7e+86) (not (<= y 38000000.0))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+86) || !(y <= 38000000.0)) {
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 <= (-7d+86)) .or. (.not. (y <= 38000000.0d0))) 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 <= -7e+86) || !(y <= 38000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7e+86) or not (y <= 38000000.0): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7e+86) || !(y <= 38000000.0)) 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 <= -7e+86) || ~((y <= 38000000.0))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7e+86], N[Not[LessEqual[y, 38000000.0]], $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 -7 \cdot 10^{+86} \lor \neg \left(y \leq 38000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -7.00000000000000038e86 or 3.8e7 < y Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 43.4%
if -7.00000000000000038e86 < y < 3.8e7Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 92.5%
mul-1-neg92.5%
unsub-neg92.5%
Simplified92.5%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.6e+265) (+ x 1.0) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.6e+265) {
tmp = x + 1.0;
} else {
tmp = z * -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.6d+265) then
tmp = x + 1.0d0
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.6e+265) {
tmp = x + 1.0;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.6e+265: tmp = x + 1.0 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.6e+265) tmp = Float64(x + 1.0); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.6e+265) tmp = x + 1.0; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.6e+265], N[(x + 1.0), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.6 \cdot 10^{+265}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 1.60000000000000007e265Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 65.0%
if 1.60000000000000007e265 < z Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in z around -inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
distribute-lft-out--100.0%
mul-1-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 88.9%
Taylor expanded in z around inf 78.2%
mul-1-neg78.2%
Simplified78.2%
Final simplification65.5%
(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%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 63.2%
Final simplification63.2%
(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%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 45.6%
herbie shell --seed 2024172
(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))))