
(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 100.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (if (or (<= x -6.6e+14) (not (<= x 0.56))) (- x t_0) (- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -6.6e+14) || !(x <= 0.56)) {
tmp = x - 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 <= (-6.6d+14)) .or. (.not. (x <= 0.56d0))) then
tmp = x - 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 <= -6.6e+14) || !(x <= 0.56)) {
tmp = x - 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 <= -6.6e+14) or not (x <= 0.56): tmp = x - 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 <= -6.6e+14) || !(x <= 0.56)) tmp = Float64(x - 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 <= -6.6e+14) || ~((x <= 0.56))) tmp = x - 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, -6.6e+14], N[Not[LessEqual[x, 0.56]], $MachinePrecision]], N[(x - 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 -6.6 \cdot 10^{+14} \lor \neg \left(x \leq 0.56\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -6.6e14 or 0.56000000000000005 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
if -6.6e14 < x < 0.56000000000000005Initial program 99.9%
Taylor expanded in x around 0 98.5%
Final simplification99.0%
(FPCore (x y z)
:precision binary64
(if (<= x -6.8e+37)
x
(if (<= x -5.6e-303)
(- (+ x 1.0) (* y z))
(if (<= x 1.3e-189) (* z (- (sin y))) (if (<= x 0.65) (cos y) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.8e+37) {
tmp = x;
} else if (x <= -5.6e-303) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 1.3e-189) {
tmp = z * -sin(y);
} else if (x <= 0.65) {
tmp = cos(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 <= (-6.8d+37)) then
tmp = x
else if (x <= (-5.6d-303)) then
tmp = (x + 1.0d0) - (y * z)
else if (x <= 1.3d-189) then
tmp = z * -sin(y)
else if (x <= 0.65d0) then
tmp = cos(y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.8e+37) {
tmp = x;
} else if (x <= -5.6e-303) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 1.3e-189) {
tmp = z * -Math.sin(y);
} else if (x <= 0.65) {
tmp = Math.cos(y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.8e+37: tmp = x elif x <= -5.6e-303: tmp = (x + 1.0) - (y * z) elif x <= 1.3e-189: tmp = z * -math.sin(y) elif x <= 0.65: tmp = math.cos(y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.8e+37) tmp = x; elseif (x <= -5.6e-303) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif (x <= 1.3e-189) tmp = Float64(z * Float64(-sin(y))); elseif (x <= 0.65) tmp = cos(y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.8e+37) tmp = x; elseif (x <= -5.6e-303) tmp = (x + 1.0) - (y * z); elseif (x <= 1.3e-189) tmp = z * -sin(y); elseif (x <= 0.65) tmp = cos(y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.8e+37], x, If[LessEqual[x, -5.6e-303], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.3e-189], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 0.65], N[Cos[y], $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5.6 \cdot 10^{-303}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-189}:\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.80000000000000011e37 or 0.650000000000000022 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
Taylor expanded in x around inf 88.5%
if -6.80000000000000011e37 < x < -5.6e-303Initial program 99.9%
Taylor expanded in y around 0 83.8%
Taylor expanded in y around 0 64.2%
if -5.6e-303 < x < 1.2999999999999999e-189Initial program 99.9%
Taylor expanded in x around inf 63.1%
Taylor expanded in x around 0 63.1%
mul-1-neg63.1%
*-commutative63.1%
distribute-rgt-neg-in63.1%
Simplified63.1%
if 1.2999999999999999e-189 < x < 0.650000000000000022Initial program 99.9%
Taylor expanded in x around 0 97.6%
Taylor expanded in y around 0 66.7%
Taylor expanded in z around 0 64.3%
Final simplification75.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))) (t_1 (- x t_0)))
(if (<= x -6.6e+14)
t_1
(if (<= x 2.5e-104)
(- 1.0 t_0)
(if (<= x 2.6e-15) (- (cos y) (* y z)) t_1)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = x - t_0;
double tmp;
if (x <= -6.6e+14) {
tmp = t_1;
} else if (x <= 2.5e-104) {
tmp = 1.0 - t_0;
} else if (x <= 2.6e-15) {
tmp = cos(y) - (y * z);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = z * sin(y)
t_1 = x - t_0
if (x <= (-6.6d+14)) then
tmp = t_1
else if (x <= 2.5d-104) then
tmp = 1.0d0 - t_0
else if (x <= 2.6d-15) then
tmp = cos(y) - (y * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = x - t_0;
double tmp;
if (x <= -6.6e+14) {
tmp = t_1;
} else if (x <= 2.5e-104) {
tmp = 1.0 - t_0;
} else if (x <= 2.6e-15) {
tmp = Math.cos(y) - (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = x - t_0 tmp = 0 if x <= -6.6e+14: tmp = t_1 elif x <= 2.5e-104: tmp = 1.0 - t_0 elif x <= 2.6e-15: tmp = math.cos(y) - (y * z) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(x - t_0) tmp = 0.0 if (x <= -6.6e+14) tmp = t_1; elseif (x <= 2.5e-104) tmp = Float64(1.0 - t_0); elseif (x <= 2.6e-15) tmp = Float64(cos(y) - Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = x - t_0; tmp = 0.0; if (x <= -6.6e+14) tmp = t_1; elseif (x <= 2.5e-104) tmp = 1.0 - t_0; elseif (x <= 2.6e-15) tmp = cos(y) - (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - t$95$0), $MachinePrecision]}, If[LessEqual[x, -6.6e+14], t$95$1, If[LessEqual[x, 2.5e-104], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 2.6e-15], N[(N[Cos[y], $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := x - t\_0\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-104}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-15}:\\
\;\;\;\;\cos y - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.6e14 or 2.60000000000000004e-15 < x Initial program 100.0%
Taylor expanded in x around inf 98.1%
if -6.6e14 < x < 2.49999999999999989e-104Initial program 99.9%
Taylor expanded in y around 0 81.2%
Taylor expanded in x around 0 80.8%
if 2.49999999999999989e-104 < x < 2.60000000000000004e-15Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 77.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5e-39) (not (<= z 3.3e-110))) (- (+ x 1.0) (* z (sin y))) (- (+ x (cos y)) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e-39) || !(z <= 3.3e-110)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = (x + cos(y)) - (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 ((z <= (-5.5d-39)) .or. (.not. (z <= 3.3d-110))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = (x + cos(y)) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e-39) || !(z <= 3.3e-110)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = (x + Math.cos(y)) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5e-39) or not (z <= 3.3e-110): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = (x + math.cos(y)) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5e-39) || !(z <= 3.3e-110)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(Float64(x + cos(y)) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.5e-39) || ~((z <= 3.3e-110))) tmp = (x + 1.0) - (z * sin(y)); else tmp = (x + cos(y)) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5e-39], N[Not[LessEqual[z, 3.3e-110]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-39} \lor \neg \left(z \leq 3.3 \cdot 10^{-110}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \cos y\right) - y \cdot z\\
\end{array}
\end{array}
if z < -5.50000000000000018e-39 or 3.2999999999999999e-110 < z Initial program 99.9%
Taylor expanded in y around 0 94.1%
if -5.50000000000000018e-39 < z < 3.2999999999999999e-110Initial program 100.0%
Taylor expanded in y around 0 92.5%
Final simplification93.6%
(FPCore (x y z) :precision binary64 (if (or (<= x 3e-105) (not (<= x 7.5e-28))) (- (+ x 1.0) (* z (sin y))) (- (cos y) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= 3e-105) || !(x <= 7.5e-28)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = cos(y) - (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= 3d-105) .or. (.not. (x <= 7.5d-28))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = cos(y) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= 3e-105) || !(x <= 7.5e-28)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = Math.cos(y) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= 3e-105) or not (x <= 7.5e-28): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = math.cos(y) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= 3e-105) || !(x <= 7.5e-28)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(cos(y) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= 3e-105) || ~((x <= 7.5e-28))) tmp = (x + 1.0) - (z * sin(y)); else tmp = cos(y) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, 3e-105], N[Not[LessEqual[x, 7.5e-28]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-105} \lor \neg \left(x \leq 7.5 \cdot 10^{-28}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\cos y - y \cdot z\\
\end{array}
\end{array}
if x < 3.0000000000000001e-105 or 7.5000000000000003e-28 < x Initial program 100.0%
Taylor expanded in y around 0 90.4%
if 3.0000000000000001e-105 < x < 7.5000000000000003e-28Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 78.4%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (<= x -1.4e+38) x (if (<= x -2.9e-287) (- (+ x 1.0) (* y z)) (if (<= x 0.68) (cos y) x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e+38) {
tmp = x;
} else if (x <= -2.9e-287) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 0.68) {
tmp = cos(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 <= (-1.4d+38)) then
tmp = x
else if (x <= (-2.9d-287)) then
tmp = (x + 1.0d0) - (y * z)
else if (x <= 0.68d0) then
tmp = cos(y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e+38) {
tmp = x;
} else if (x <= -2.9e-287) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 0.68) {
tmp = Math.cos(y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4e+38: tmp = x elif x <= -2.9e-287: tmp = (x + 1.0) - (y * z) elif x <= 0.68: tmp = math.cos(y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4e+38) tmp = x; elseif (x <= -2.9e-287) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif (x <= 0.68) tmp = cos(y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4e+38) tmp = x; elseif (x <= -2.9e-287) tmp = (x + 1.0) - (y * z); elseif (x <= 0.68) tmp = cos(y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4e+38], x, If[LessEqual[x, -2.9e-287], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.68], N[Cos[y], $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-287}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;x \leq 0.68:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.4e38 or 0.680000000000000049 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
Taylor expanded in x around inf 88.5%
if -1.4e38 < x < -2.8999999999999998e-287Initial program 99.9%
Taylor expanded in y around 0 84.0%
Taylor expanded in y around 0 63.4%
if -2.8999999999999998e-287 < x < 0.680000000000000049Initial program 99.9%
Taylor expanded in x around 0 98.4%
Taylor expanded in y around 0 55.5%
Taylor expanded in z around 0 57.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (if (or (<= x -6.6e+14) (not (<= x 1.55))) (- x t_0) (- 1.0 t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -6.6e+14) || !(x <= 1.55)) {
tmp = x - t_0;
} else {
tmp = 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 <= (-6.6d+14)) .or. (.not. (x <= 1.55d0))) then
tmp = x - t_0
else
tmp = 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 <= -6.6e+14) || !(x <= 1.55)) {
tmp = x - t_0;
} else {
tmp = 1.0 - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -6.6e+14) or not (x <= 1.55): tmp = x - t_0 else: tmp = 1.0 - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -6.6e+14) || !(x <= 1.55)) tmp = Float64(x - t_0); else tmp = Float64(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 <= -6.6e+14) || ~((x <= 1.55))) tmp = x - t_0; else tmp = 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[Or[LessEqual[x, -6.6e+14], N[Not[LessEqual[x, 1.55]], $MachinePrecision]], N[(x - t$95$0), $MachinePrecision], N[(1.0 - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{+14} \lor \neg \left(x \leq 1.55\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - t\_0\\
\end{array}
\end{array}
if x < -6.6e14 or 1.55000000000000004 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
if -6.6e14 < x < 1.55000000000000004Initial program 99.9%
Taylor expanded in y around 0 75.8%
Taylor expanded in x around 0 75.6%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (<= x -3.8e+16) x (if (<= x 8.6e+64) (- 1.0 (* z (sin y))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e+16) {
tmp = x;
} else if (x <= 8.6e+64) {
tmp = 1.0 - (z * sin(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 <= (-3.8d+16)) then
tmp = x
else if (x <= 8.6d+64) then
tmp = 1.0d0 - (z * sin(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 <= -3.8e+16) {
tmp = x;
} else if (x <= 8.6e+64) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.8e+16: tmp = x elif x <= 8.6e+64: tmp = 1.0 - (z * math.sin(y)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.8e+16) tmp = x; elseif (x <= 8.6e+64) tmp = Float64(1.0 - Float64(z * sin(y))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.8e+16) tmp = x; elseif (x <= 8.6e+64) tmp = 1.0 - (z * sin(y)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.8e+16], x, If[LessEqual[x, 8.6e+64], N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{+64}:\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -3.8e16Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 93.3%
if -3.8e16 < x < 8.5999999999999995e64Initial program 99.9%
Taylor expanded in y around 0 77.4%
Taylor expanded in x around 0 74.4%
if 8.5999999999999995e64 < x Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 94.7%
+-commutative94.7%
Simplified94.7%
(FPCore (x y z) :precision binary64 (if (<= x -5e+37) x (if (<= x 2.2e+69) (- (+ x 1.0) (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5e+37) {
tmp = x;
} else if (x <= 2.2e+69) {
tmp = (x + 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 <= (-5d+37)) then
tmp = x
else if (x <= 2.2d+69) then
tmp = (x + 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 <= -5e+37) {
tmp = x;
} else if (x <= 2.2e+69) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5e+37: tmp = x elif x <= 2.2e+69: tmp = (x + 1.0) - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5e+37) tmp = x; elseif (x <= 2.2e+69) tmp = Float64(Float64(x + 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 <= -5e+37) tmp = x; elseif (x <= 2.2e+69) tmp = (x + 1.0) - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5e+37], x, If[LessEqual[x, 2.2e+69], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+69}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -4.99999999999999989e37Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 93.2%
if -4.99999999999999989e37 < x < 2.2000000000000002e69Initial program 99.9%
Taylor expanded in y around 0 77.6%
Taylor expanded in y around 0 50.8%
if 2.2000000000000002e69 < x Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 94.7%
+-commutative94.7%
Simplified94.7%
(FPCore (x y z) :precision binary64 (if (<= x -7e+14) x (if (<= x 49000000.0) (- 1.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7e+14) {
tmp = x;
} else if (x <= 49000000.0) {
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 <= (-7d+14)) then
tmp = x
else if (x <= 49000000.0d0) 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 <= -7e+14) {
tmp = x;
} else if (x <= 49000000.0) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7e+14: tmp = x elif x <= 49000000.0: tmp = 1.0 - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7e+14) tmp = x; elseif (x <= 49000000.0) 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 <= -7e+14) tmp = x; elseif (x <= 49000000.0) tmp = 1.0 - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7e+14], x, If[LessEqual[x, 49000000.0], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+14}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 49000000:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7e14 or 4.9e7 < x Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 89.6%
if -7e14 < x < 4.9e7Initial program 99.9%
Taylor expanded in x around 0 97.8%
Taylor expanded in y around 0 61.0%
Taylor expanded in y around 0 49.0%
*-commutative49.0%
neg-mul-149.0%
unsub-neg49.0%
Simplified49.0%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (<= x -0.013) x (if (<= x 1.1) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.013) {
tmp = x;
} else if (x <= 1.1) {
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.013d0)) then
tmp = x
else if (x <= 1.1d0) 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.013) {
tmp = x;
} else if (x <= 1.1) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.013: tmp = x elif x <= 1.1: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.013) tmp = x; elseif (x <= 1.1) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.013) tmp = x; elseif (x <= 1.1) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.013], x, If[LessEqual[x, 1.1], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.013:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.0129999999999999994 or 1.1000000000000001 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
Taylor expanded in x around inf 86.5%
if -0.0129999999999999994 < x < 1.1000000000000001Initial program 99.9%
Taylor expanded in x around 0 98.5%
Taylor expanded in y around 0 61.0%
Taylor expanded in y around 0 32.5%
(FPCore (x y z) :precision binary64 (if (<= z -4.1e+263) (* z (- y)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e+263) {
tmp = z * -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 (z <= (-4.1d+263)) then
tmp = z * -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 (z <= -4.1e+263) {
tmp = z * -y;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.1e+263: tmp = z * -y else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.1e+263) tmp = Float64(z * Float64(-y)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.1e+263) tmp = z * -y; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.1e+263], N[(z * (-y)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+263}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -4.09999999999999986e263Initial program 100.0%
Taylor expanded in x around 0 82.8%
Taylor expanded in y around 0 71.6%
Taylor expanded in y around inf 71.6%
associate-*r*71.6%
neg-mul-171.6%
*-commutative71.6%
Simplified71.6%
if -4.09999999999999986e263 < z Initial program 100.0%
Taylor expanded in y around 0 86.8%
Taylor expanded in z around 0 61.7%
+-commutative61.7%
Simplified61.7%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 87.4%
Taylor expanded in z around 0 59.6%
+-commutative59.6%
Simplified59.6%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 57.1%
Taylor expanded in y around 0 34.7%
Taylor expanded in y around 0 17.7%
herbie shell --seed 2024086
(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))))