
(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 15 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%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.4e-7) (not (<= x 3.4e-17))) (+ 1.0 (fma z (- (sin y)) x)) (- (cos y) (* z (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.4e-7) || !(x <= 3.4e-17)) {
tmp = 1.0 + fma(z, -sin(y), x);
} else {
tmp = cos(y) - (z * sin(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -9.4e-7) || !(x <= 3.4e-17)) tmp = Float64(1.0 + fma(z, Float64(-sin(y)), x)); else tmp = Float64(cos(y) - Float64(z * sin(y))); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.4e-7], N[Not[LessEqual[x, 3.4e-17]], $MachinePrecision]], N[(1.0 + N[(z * (-N[Sin[y], $MachinePrecision]) + x), $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 -9.4 \cdot 10^{-7} \lor \neg \left(x \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;1 + \mathsf{fma}\left(z, -\sin y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\end{array}
\end{array}
if x < -9.4e-7 or 3.3999999999999998e-17 < 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.6%
if -9.4e-7 < x < 3.3999999999999998e-17Initial 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 0 99.2%
neg-mul-199.2%
sub-neg99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -1.05e-6) (not (<= x 3.4e-17)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.05e-6) || !(x <= 3.4e-17)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - 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 <= (-1.05d-6)) .or. (.not. (x <= 3.4d-17))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - 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 <= -1.05e-6) || !(x <= 3.4e-17)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -1.05e-6) or not (x <= 3.4e-17): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -1.05e-6) || !(x <= 3.4e-17)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -1.05e-6) || ~((x <= 3.4e-17))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.05e-6], N[Not[LessEqual[x, 3.4e-17]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{-6} \lor \neg \left(x \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.0499999999999999e-6 or 3.3999999999999998e-17 < x Initial program 99.9%
Taylor expanded in y around 0 99.6%
if -1.0499999999999999e-6 < x < 3.3999999999999998e-17Initial 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 0 99.2%
neg-mul-199.2%
sub-neg99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.75) (not (<= z 0.26))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.75) || !(z <= 0.26)) {
tmp = (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 <= (-0.75d0)) .or. (.not. (z <= 0.26d0))) then
tmp = (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 <= -0.75) || !(z <= 0.26)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.75) or not (z <= 0.26): tmp = (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 <= -0.75) || !(z <= 0.26)) tmp = Float64(Float64(x + 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 <= -0.75) || ~((z <= 0.26))) tmp = (x + 1.0) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.75], N[Not[LessEqual[z, 0.26]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - 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 -0.75 \lor \neg \left(z \leq 0.26\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -0.75 or 0.26000000000000001 < z Initial program 99.8%
Taylor expanded in y around 0 99.1%
if -0.75 < z < 0.26000000000000001Initial 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.3%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(if (<= x -6e+92)
x
(if (<= x -1.05e-123)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
(if (<= x 1.05e-9) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e+92) {
tmp = x;
} else if (x <= -1.05e-123) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else if (x <= 1.05e-9) {
tmp = cos(y);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-6d+92)) then
tmp = x
else if (x <= (-1.05d-123)) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
else if (x <= 1.05d-9) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6e+92) {
tmp = x;
} else if (x <= -1.05e-123) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else if (x <= 1.05e-9) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6e+92: tmp = x elif x <= -1.05e-123: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) elif x <= 1.05e-9: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6e+92) tmp = x; elseif (x <= -1.05e-123) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); elseif (x <= 1.05e-9) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6e+92) tmp = x; elseif (x <= -1.05e-123) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); elseif (x <= 1.05e-9) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6e+92], x, If[LessEqual[x, -1.05e-123], 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], If[LessEqual[x, 1.05e-9], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+92}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-123}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-9}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -6.00000000000000026e92Initial 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 x around inf 90.7%
if -6.00000000000000026e92 < x < -1.05e-123Initial program 99.8%
Taylor expanded in y around 0 73.5%
if -1.05e-123 < x < 1.0500000000000001e-9Initial 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 0 99.9%
neg-mul-199.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 67.1%
if 1.0500000000000001e-9 < x 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-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 79.2%
Final simplification74.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.15e+86) (not (<= z 1.42e+50))) (- 1.0 (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+86) || !(z <= 1.42e+50)) {
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.15d+86)) .or. (.not. (z <= 1.42d+50))) 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.15e+86) || !(z <= 1.42e+50)) {
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.15e+86) or not (z <= 1.42e+50): 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.15e+86) || !(z <= 1.42e+50)) 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.15e+86) || ~((z <= 1.42e+50))) 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.15e+86], N[Not[LessEqual[z, 1.42e+50]], $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.15 \cdot 10^{+86} \lor \neg \left(z \leq 1.42 \cdot 10^{+50}\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.14999999999999995e86 or 1.41999999999999994e50 < z Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around 0 77.1%
if -1.14999999999999995e86 < z < 1.41999999999999994e50Initial 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 93.9%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4e+100) (not (<= z 1.6e+155))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e+100) || !(z <= 1.6e+155)) {
tmp = sin(y) * -z;
} 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 <= (-2.4d+100)) .or. (.not. (z <= 1.6d+155))) then
tmp = sin(y) * -z
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 <= -2.4e+100) || !(z <= 1.6e+155)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e+100) or not (z <= 1.6e+155): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.4e+100) || !(z <= 1.6e+155)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.4e+100) || ~((z <= 1.6e+155))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e+100], N[Not[LessEqual[z, 1.6e+155]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+100} \lor \neg \left(z \leq 1.6 \cdot 10^{+155}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.40000000000000012e100 or 1.60000000000000006e155 < z Initial 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 71.8%
neg-mul-171.8%
distribute-rgt-neg-in71.8%
Simplified71.8%
if -2.40000000000000012e100 < z < 1.60000000000000006e155Initial 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 88.7%
Final simplification83.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -6300000.0) (not (<= y 3.3))) (+ 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 <= -6300000.0) || !(y <= 3.3)) {
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 <= (-6300000.0d0)) .or. (.not. (y <= 3.3d0))) 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 <= -6300000.0) || !(y <= 3.3)) {
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 <= -6300000.0) or not (y <= 3.3): 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 <= -6300000.0) || !(y <= 3.3)) 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 <= -6300000.0) || ~((y <= 3.3))) 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, -6300000.0], N[Not[LessEqual[y, 3.3]], $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 -6300000 \lor \neg \left(y \leq 3.3\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 < -6.3e6 or 3.2999999999999998 < 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 58.1%
if -6.3e6 < y < 3.2999999999999998Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification80.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -7000000000000.0) (not (<= y 3.7e+28))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7000000000000.0) || !(y <= 3.7e+28)) {
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 <= (-7000000000000.0d0)) .or. (.not. (y <= 3.7d+28))) 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 <= -7000000000000.0) || !(y <= 3.7e+28)) {
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 <= -7000000000000.0) or not (y <= 3.7e+28): 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 <= -7000000000000.0) || !(y <= 3.7e+28)) 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 <= -7000000000000.0) || ~((y <= 3.7e+28))) 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, -7000000000000.0], N[Not[LessEqual[y, 3.7e+28]], $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 -7000000000000 \lor \neg \left(y \leq 3.7 \cdot 10^{+28}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -7e12 or 3.6999999999999999e28 < 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 31.8%
if -7e12 < y < 3.6999999999999999e28Initial program 100.0%
Taylor expanded in y around 0 96.1%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -4000000000000.0) (not (<= y 1.56e+28))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4000000000000.0) || !(y <= 1.56e+28)) {
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 <= (-4000000000000.0d0)) .or. (.not. (y <= 1.56d+28))) 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 <= -4000000000000.0) || !(y <= 1.56e+28)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4000000000000.0) or not (y <= 1.56e+28): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4000000000000.0) || !(y <= 1.56e+28)) 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 <= -4000000000000.0) || ~((y <= 1.56e+28))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4000000000000.0], N[Not[LessEqual[y, 1.56e+28]], $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 -4000000000000 \lor \neg \left(y \leq 1.56 \cdot 10^{+28}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -4e12 or 1.5599999999999999e28 < 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 31.5%
if -4e12 < y < 1.5599999999999999e28Initial 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 y around 0 96.7%
mul-1-neg96.7%
unsub-neg96.7%
Simplified96.7%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (<= x -5.8e+36) x (if (<= x 3.8e-63) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+36) {
tmp = x;
} else if (x <= 3.8e-63) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-5.8d+36)) then
tmp = x
else if (x <= 3.8d-63) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+36) {
tmp = x;
} else if (x <= 3.8e-63) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.8e+36: tmp = x elif x <= 3.8e-63: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.8e+36) tmp = x; elseif (x <= 3.8e-63) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.8e+36) tmp = x; elseif (x <= 3.8e-63) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.8e+36], x, If[LessEqual[x, 3.8e-63], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+36}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-63}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -5.8e36Initial 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-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 83.2%
if -5.8e36 < x < 3.80000000000000017e-63Initial 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 0 98.4%
neg-mul-198.4%
sub-neg98.4%
Simplified98.4%
Taylor expanded in y around 0 54.0%
mul-1-neg54.0%
unsub-neg54.0%
*-commutative54.0%
Simplified54.0%
if 3.80000000000000017e-63 < x 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-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 74.4%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
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 <= (-1.0d0)) 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 <= -1.0) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) 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 <= -1.0) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 1 < 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 x around inf 78.3%
if -1 < x < 1Initial program 99.9%
add-cube-cbrt99.3%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 44.1%
+-commutative44.1%
Simplified44.1%
Taylor expanded in x around 0 43.3%
(FPCore (x y z) :precision binary64 (if (<= z 1.22e+238) (+ x 1.0) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.22e+238) {
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.22d+238) 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.22e+238) {
tmp = x + 1.0;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.22e+238: tmp = x + 1.0 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.22e+238) 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.22e+238) tmp = x + 1.0; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.22e+238], N[(x + 1.0), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.22 \cdot 10^{+238}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 1.2200000000000001e238Initial 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 61.7%
if 1.2200000000000001e238 < z Initial program 99.6%
cancel-sign-sub-inv99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
sin-neg99.6%
fma-define99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in z around inf 87.6%
neg-mul-187.6%
distribute-rgt-neg-in87.6%
Simplified87.6%
Taylor expanded in y around 0 46.9%
Final simplification60.8%
(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 58.9%
Final simplification58.9%
(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%
add-cube-cbrt99.4%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 58.9%
+-commutative58.9%
Simplified58.9%
Taylor expanded in x around 0 26.1%
herbie shell --seed 2024163
(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))))