
(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 13 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%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -6e+24) x (if (<= x 3.7e+97) (- (cos y) (* z (sin y))) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e+24) {
tmp = x;
} else if (x <= 3.7e+97) {
tmp = cos(y) - (z * sin(y));
} 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 <= (-6d+24)) then
tmp = x
else if (x <= 3.7d+97) then
tmp = cos(y) - (z * sin(y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6e+24) {
tmp = x;
} else if (x <= 3.7e+97) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6e+24: tmp = x elif x <= 3.7e+97: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6e+24) tmp = x; elseif (x <= 3.7e+97) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6e+24) tmp = x; elseif (x <= 3.7e+97) tmp = cos(y) - (z * sin(y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6e+24], x, If[LessEqual[x, 3.7e+97], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+97}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.9999999999999999e24 or 3.70000000000000001e97 < 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-define100.0%
sin-neg100.0%
Simplified100.0%
+-commutative100.0%
fma-undefine99.9%
distribute-rgt-neg-in99.9%
associate-+l+99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-define99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 85.0%
if -5.9999999999999999e24 < x < 3.70000000000000001e97Initial 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 94.9%
neg-mul-194.9%
sub-neg94.9%
Simplified94.9%
Final simplification90.7%
(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
(let* ((t_0 (* z (- (sin y)))))
(if (<= z -8.6e+204)
t_0
(if (<= z -7.8e+64)
(- (+ x 1.0) (* y z))
(if (or (<= z -1.6e+54) (not (<= z 1.06e+70))) t_0 (+ (cos y) x))))))
double code(double x, double y, double z) {
double t_0 = z * -sin(y);
double tmp;
if (z <= -8.6e+204) {
tmp = t_0;
} else if (z <= -7.8e+64) {
tmp = (x + 1.0) - (y * z);
} else if ((z <= -1.6e+54) || !(z <= 1.06e+70)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * -sin(y)
if (z <= (-8.6d+204)) then
tmp = t_0
else if (z <= (-7.8d+64)) then
tmp = (x + 1.0d0) - (y * z)
else if ((z <= (-1.6d+54)) .or. (.not. (z <= 1.06d+70))) then
tmp = t_0
else
tmp = cos(y) + x
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 (z <= -8.6e+204) {
tmp = t_0;
} else if (z <= -7.8e+64) {
tmp = (x + 1.0) - (y * z);
} else if ((z <= -1.6e+54) || !(z <= 1.06e+70)) {
tmp = t_0;
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): t_0 = z * -math.sin(y) tmp = 0 if z <= -8.6e+204: tmp = t_0 elif z <= -7.8e+64: tmp = (x + 1.0) - (y * z) elif (z <= -1.6e+54) or not (z <= 1.06e+70): tmp = t_0 else: tmp = math.cos(y) + x return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-sin(y))) tmp = 0.0 if (z <= -8.6e+204) tmp = t_0; elseif (z <= -7.8e+64) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif ((z <= -1.6e+54) || !(z <= 1.06e+70)) tmp = t_0; else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -sin(y); tmp = 0.0; if (z <= -8.6e+204) tmp = t_0; elseif (z <= -7.8e+64) tmp = (x + 1.0) - (y * z); elseif ((z <= -1.6e+54) || ~((z <= 1.06e+70))) tmp = t_0; else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[z, -8.6e+204], t$95$0, If[LessEqual[z, -7.8e+64], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.6e+54], N[Not[LessEqual[z, 1.06e+70]], $MachinePrecision]], t$95$0, N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-\sin y\right)\\
\mathbf{if}\;z \leq -8.6 \cdot 10^{+204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{+64}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+54} \lor \neg \left(z \leq 1.06 \cdot 10^{+70}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -8.6e204 or -7.7999999999999996e64 < z < -1.6e54 or 1.06e70 < 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.8%
sin-neg99.8%
Simplified99.8%
+-commutative99.8%
fma-undefine99.7%
distribute-rgt-neg-in99.7%
associate-+l+99.7%
distribute-lft-neg-in99.7%
add-cube-cbrt98.2%
associate-*r*98.2%
fma-define98.3%
pow298.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 82.2%
mul-1-neg82.2%
*-commutative82.2%
distribute-rgt-neg-in82.2%
Simplified82.2%
if -8.6e204 < z < -7.7999999999999996e64Initial 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.2%
associate-+r+65.2%
mul-1-neg65.2%
unsub-neg65.2%
+-commutative65.2%
*-commutative65.2%
Simplified65.2%
if -1.6e54 < z < 1.06e70Initial 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 95.2%
Final simplification88.6%
(FPCore (x y z)
:precision binary64
(if (<= y -1.2e+58)
(+ x 1.0)
(if (<= y 1.7e+30)
(- (+ x 1.0) (* y z))
(if (<= y 1.4e+175) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+58) {
tmp = x + 1.0;
} else if (y <= 1.7e+30) {
tmp = (x + 1.0) - (y * z);
} else if (y <= 1.4e+175) {
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 (y <= (-1.2d+58)) then
tmp = x + 1.0d0
else if (y <= 1.7d+30) then
tmp = (x + 1.0d0) - (y * z)
else if (y <= 1.4d+175) 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 (y <= -1.2e+58) {
tmp = x + 1.0;
} else if (y <= 1.7e+30) {
tmp = (x + 1.0) - (y * z);
} else if (y <= 1.4e+175) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.2e+58: tmp = x + 1.0 elif y <= 1.7e+30: tmp = (x + 1.0) - (y * z) elif y <= 1.4e+175: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.2e+58) tmp = Float64(x + 1.0); elseif (y <= 1.7e+30) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif (y <= 1.4e+175) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.2e+58) tmp = x + 1.0; elseif (y <= 1.7e+30) tmp = (x + 1.0) - (y * z); elseif (y <= 1.4e+175) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.2e+58], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.7e+30], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+175], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+58}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+30}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+175}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.2e58 or 1.4000000000000001e175 < 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 41.5%
+-commutative41.5%
Simplified41.5%
if -1.2e58 < y < 1.7000000000000001e30Initial 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 92.1%
associate-+r+92.1%
mul-1-neg92.1%
unsub-neg92.1%
+-commutative92.1%
*-commutative92.1%
Simplified92.1%
if 1.7000000000000001e30 < y < 1.4000000000000001e175Initial 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 84.6%
neg-mul-184.6%
sub-neg84.6%
Simplified84.6%
Taylor expanded in z around 0 40.9%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.15e+19) (not (<= y 11000000.0))) (+ (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 <= -3.15e+19) || !(y <= 11000000.0)) {
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 <= (-3.15d+19)) .or. (.not. (y <= 11000000.0d0))) 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 <= -3.15e+19) || !(y <= 11000000.0)) {
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 <= -3.15e+19) or not (y <= 11000000.0): 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 <= -3.15e+19) || !(y <= 11000000.0)) 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 <= -3.15e+19) || ~((y <= 11000000.0))) 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, -3.15e+19], N[Not[LessEqual[y, 11000000.0]], $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 -3.15 \cdot 10^{+19} \lor \neg \left(y \leq 11000000\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.15e19 or 1.1e7 < 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 53.5%
if -3.15e19 < y < 1.1e7Initial program 100.0%
Taylor expanded in y around 0 97.0%
Final simplification77.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.5e+19) (not (<= y 3000000000.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 <= -5.5e+19) || !(y <= 3000000000.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 <= (-5.5d+19)) .or. (.not. (y <= 3000000000.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 <= -5.5e+19) || !(y <= 3000000000.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 <= -5.5e+19) or not (y <= 3000000000.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 <= -5.5e+19) || !(y <= 3000000000.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 <= -5.5e+19) || ~((y <= 3000000000.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, -5.5e+19], N[Not[LessEqual[y, 3000000000.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 -5.5 \cdot 10^{+19} \lor \neg \left(y \leq 3000000000\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 < -5.5e19 or 3e9 < 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 35.6%
+-commutative35.6%
Simplified35.6%
if -5.5e19 < y < 3e9Initial program 100.0%
Taylor expanded in y around 0 97.0%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -3e+54) (not (<= y 22.0))) (+ x 1.0) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+54) || !(y <= 22.0)) {
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 <= (-3d+54)) .or. (.not. (y <= 22.0d0))) 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 <= -3e+54) || !(y <= 22.0)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3e+54) or not (y <= 22.0): tmp = x + 1.0 else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3e+54) || !(y <= 22.0)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3e+54) || ~((y <= 22.0))) tmp = x + 1.0; else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3e+54], N[Not[LessEqual[y, 22.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+54} \lor \neg \left(y \leq 22\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -2.9999999999999999e54 or 22 < 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 37.0%
+-commutative37.0%
Simplified37.0%
if -2.9999999999999999e54 < y < 22Initial 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 92.7%
associate-+r+92.7%
mul-1-neg92.7%
unsub-neg92.7%
+-commutative92.7%
*-commutative92.7%
Simplified92.7%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (<= x -2.9e+23) x (if (<= x 2.55e+38) (- 1.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.9e+23) {
tmp = x;
} else if (x <= 2.55e+38) {
tmp = 1.0 - (y * z);
} 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 <= (-2.9d+23)) then
tmp = x
else if (x <= 2.55d+38) then
tmp = 1.0d0 - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.9e+23) {
tmp = x;
} else if (x <= 2.55e+38) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.9e+23: tmp = x elif x <= 2.55e+38: tmp = 1.0 - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.9e+23) tmp = x; elseif (x <= 2.55e+38) tmp = Float64(1.0 - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.9e+23) tmp = x; elseif (x <= 2.55e+38) tmp = 1.0 - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.9e+23], x, If[LessEqual[x, 2.55e+38], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{+38}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.90000000000000013e23 or 2.5500000000000001e38 < 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%
+-commutative99.9%
fma-undefine99.9%
distribute-rgt-neg-in99.9%
associate-+l+99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-define99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.7%
if -2.90000000000000013e23 < x < 2.5500000000000001e38Initial 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 97.2%
neg-mul-197.2%
sub-neg97.2%
Simplified97.2%
Taylor expanded in y around 0 56.0%
mul-1-neg56.0%
unsub-neg56.0%
Simplified56.0%
Final simplification67.5%
(FPCore (x y z) :precision binary64 (if (<= x -0.00115) x (if (<= x 4.6e-10) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00115) {
tmp = x;
} else if (x <= 4.6e-10) {
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.00115d0)) then
tmp = x
else if (x <= 4.6d-10) 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.00115) {
tmp = x;
} else if (x <= 4.6e-10) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00115: tmp = x elif x <= 4.6e-10: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00115) tmp = x; elseif (x <= 4.6e-10) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.00115) tmp = x; elseif (x <= 4.6e-10) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00115], x, If[LessEqual[x, 4.6e-10], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00115:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.00115 or 4.60000000000000014e-10 < 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%
+-commutative99.9%
fma-undefine99.9%
distribute-rgt-neg-in99.9%
associate-+l+99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.5%
associate-*r*99.5%
fma-define99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 73.0%
if -0.00115 < x < 4.60000000000000014e-10Initial 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.3%
neg-mul-199.3%
sub-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 45.4%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= z 1.65e+207) (+ x 1.0) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.65e+207) {
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.65d+207) 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.65e+207) {
tmp = x + 1.0;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.65e+207: tmp = x + 1.0 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.65e+207) 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.65e+207) tmp = x + 1.0; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.65e+207], N[(x + 1.0), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.65 \cdot 10^{+207}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 1.65e207Initial 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.6%
+-commutative65.6%
Simplified65.6%
if 1.65e207 < 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.9%
sin-neg99.9%
Simplified99.9%
+-commutative99.9%
fma-undefine99.8%
distribute-rgt-neg-in99.8%
associate-+l+99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt98.0%
associate-*r*98.1%
fma-define98.1%
pow298.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 85.3%
mul-1-neg85.3%
*-commutative85.3%
distribute-rgt-neg-in85.3%
Simplified85.3%
Taylor expanded in y around 0 34.7%
mul-1-neg34.7%
distribute-rgt-neg-in34.7%
Simplified34.7%
Final simplification62.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 60.2%
+-commutative60.2%
Simplified60.2%
Final simplification60.2%
(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%
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 61.4%
neg-mul-161.4%
sub-neg61.4%
Simplified61.4%
Taylor expanded in y around 0 22.8%
Final simplification22.8%
herbie shell --seed 2024079
(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))))