
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -460.0) (not (<= x 1.08)))
(- (+ 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 <= -460.0) || !(x <= 1.08)) {
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 <= (-460.0d0)) .or. (.not. (x <= 1.08d0))) 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 <= -460.0) || !(x <= 1.08)) {
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 <= -460.0) or not (x <= 1.08): 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 <= -460.0) || !(x <= 1.08)) 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 <= -460.0) || ~((x <= 1.08))) 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, -460.0], N[Not[LessEqual[x, 1.08]], $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 -460 \lor \neg \left(x \leq 1.08\right):\\
\;\;\;\;\left(x + -1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -460 or 1.0800000000000001 < x Initial program 99.9%
expm1-log1p-u46.2%
expm1-undefine46.2%
Applied egg-rr46.2%
expm1-define46.2%
+-commutative46.2%
Simplified46.2%
expm1-undefine46.2%
log1p-undefine46.2%
rem-exp-log99.9%
+-commutative99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 98.4%
if -460 < x < 1.0800000000000001Initial program 99.8%
Taylor expanded in x around 0 97.9%
Final simplification98.2%
(FPCore (x y z)
:precision binary64
(if (<= z -1.3e+70)
(+ 1.0 (+ x (* y (- (* y -0.5) z))))
(if (<= z 36000.0)
(+ x (cos y))
(if (or (<= z 3.4e+97) (not (<= z 1.2e+184)))
(* z (- (sin y)))
(+ 1.0 (fma (- y) z x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+70) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else if (z <= 36000.0) {
tmp = x + cos(y);
} else if ((z <= 3.4e+97) || !(z <= 1.2e+184)) {
tmp = z * -sin(y);
} else {
tmp = 1.0 + fma(-y, z, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.3e+70) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); elseif (z <= 36000.0) tmp = Float64(x + cos(y)); elseif ((z <= 3.4e+97) || !(z <= 1.2e+184)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(1.0 + fma(Float64(-y), z, x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.3e+70], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 36000.0], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3.4e+97], N[Not[LessEqual[z, 1.2e+184]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(1.0 + N[((-y) * z + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+70}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{elif}\;z \leq 36000:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+97} \lor \neg \left(z \leq 1.2 \cdot 10^{+184}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(-y, z, x\right)\\
\end{array}
\end{array}
if z < -1.3e70Initial program 99.8%
Taylor expanded in y around 0 71.9%
if -1.3e70 < z < 36000Initial program 100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
if 36000 < z < 3.4000000000000001e97 or 1.19999999999999998e184 < z Initial program 99.6%
Taylor expanded in z around inf 77.4%
associate-*r*77.4%
neg-mul-177.4%
*-commutative77.4%
Simplified77.4%
if 3.4000000000000001e97 < z < 1.19999999999999998e184Initial program 99.8%
Taylor expanded in y around 0 75.8%
+-commutative75.8%
associate-*r*75.8%
fma-define75.8%
mul-1-neg75.8%
Simplified75.8%
Final simplification88.1%
(FPCore (x y z)
:precision binary64
(if (<= z -1e+70)
(+ 1.0 (+ x (* y (- (* y -0.5) z))))
(if (<= z 36000.0)
(+ x (cos y))
(if (or (<= z 4.15e+96) (not (<= z 1.65e+182)))
(* z (- (sin y)))
(+ 1.0 (- x (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+70) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else if (z <= 36000.0) {
tmp = x + cos(y);
} else if ((z <= 4.15e+96) || !(z <= 1.65e+182)) {
tmp = z * -sin(y);
} 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 (z <= (-1d+70)) then
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
else if (z <= 36000.0d0) then
tmp = x + cos(y)
else if ((z <= 4.15d+96) .or. (.not. (z <= 1.65d+182))) then
tmp = z * -sin(y)
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 (z <= -1e+70) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else if (z <= 36000.0) {
tmp = x + Math.cos(y);
} else if ((z <= 4.15e+96) || !(z <= 1.65e+182)) {
tmp = z * -Math.sin(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1e+70: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) elif z <= 36000.0: tmp = x + math.cos(y) elif (z <= 4.15e+96) or not (z <= 1.65e+182): tmp = z * -math.sin(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1e+70) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); elseif (z <= 36000.0) tmp = Float64(x + cos(y)); elseif ((z <= 4.15e+96) || !(z <= 1.65e+182)) tmp = Float64(z * Float64(-sin(y))); 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 (z <= -1e+70) tmp = 1.0 + (x + (y * ((y * -0.5) - z))); elseif (z <= 36000.0) tmp = x + cos(y); elseif ((z <= 4.15e+96) || ~((z <= 1.65e+182))) tmp = z * -sin(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1e+70], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 36000.0], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.15e+96], N[Not[LessEqual[z, 1.65e+182]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+70}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{elif}\;z \leq 36000:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;z \leq 4.15 \cdot 10^{+96} \lor \neg \left(z \leq 1.65 \cdot 10^{+182}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.00000000000000007e70Initial program 99.8%
Taylor expanded in y around 0 71.9%
if -1.00000000000000007e70 < z < 36000Initial program 100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
if 36000 < z < 4.1499999999999999e96 or 1.65e182 < z Initial program 99.6%
Taylor expanded in z around inf 77.4%
associate-*r*77.4%
neg-mul-177.4%
*-commutative77.4%
Simplified77.4%
if 4.1499999999999999e96 < z < 1.65e182Initial program 99.8%
Taylor expanded in y around 0 75.8%
mul-1-neg75.8%
unsub-neg75.8%
Simplified75.8%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e+135) (not (<= z 36000.0))) (- (+ x -1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+135) || !(z <= 36000.0)) {
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 <= (-2.5d+135)) .or. (.not. (z <= 36000.0d0))) 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 <= -2.5e+135) || !(z <= 36000.0)) {
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 <= -2.5e+135) or not (z <= 36000.0): 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 <= -2.5e+135) || !(z <= 36000.0)) 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 <= -2.5e+135) || ~((z <= 36000.0))) 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, -2.5e+135], N[Not[LessEqual[z, 36000.0]], $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 -2.5 \cdot 10^{+135} \lor \neg \left(z \leq 36000\right):\\
\;\;\;\;\left(x + -1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.50000000000000015e135 or 36000 < z Initial program 99.7%
expm1-log1p-u74.3%
expm1-undefine74.3%
Applied egg-rr74.3%
expm1-define74.3%
+-commutative74.3%
Simplified74.3%
expm1-undefine74.3%
log1p-undefine74.3%
rem-exp-log99.7%
+-commutative99.7%
associate-+r+99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 91.5%
if -2.50000000000000015e135 < z < 36000Initial program 100.0%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
Simplified97.1%
Final simplification95.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0005) (not (<= y 0.08))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0005) || !(y <= 0.08)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 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 <= (-0.0005d0)) .or. (.not. (y <= 0.08d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 0.16666666666666666d0) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0005) || !(y <= 0.08)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0005) or not (y <= 0.08): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0005) || !(y <= 0.08)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(y * z) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0005) || ~((y <= 0.08))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0005], N[Not[LessEqual[y, 0.08]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0005 \lor \neg \left(y \leq 0.08\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -5.0000000000000001e-4 or 0.0800000000000000017 < y Initial program 99.8%
Taylor expanded in z around 0 65.0%
+-commutative65.0%
Simplified65.0%
if -5.0000000000000001e-4 < y < 0.0800000000000000017Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification83.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.7e-17) (not (<= x 1.75e-7))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.7e-17) || !(x <= 1.75e-7)) {
tmp = x + 1.0;
} else {
tmp = cos(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.7d-17)) .or. (.not. (x <= 1.75d-7))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.7e-17) || !(x <= 1.75e-7)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.7e-17) or not (x <= 1.75e-7): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.7e-17) || !(x <= 1.75e-7)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.7e-17) || ~((x <= 1.75e-7))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.7e-17], N[Not[LessEqual[x, 1.75e-7]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-17} \lor \neg \left(x \leq 1.75 \cdot 10^{-7}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -1.6999999999999999e-17 or 1.74999999999999992e-7 < x Initial program 99.9%
add-sqr-sqrt51.6%
pow251.6%
associate--l+51.6%
Applied egg-rr51.6%
Taylor expanded in y around 0 83.7%
if -1.6999999999999999e-17 < x < 1.74999999999999992e-7Initial program 99.8%
Taylor expanded in x around 0 99.7%
Taylor expanded in z around 0 63.6%
Final simplification73.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.1e+16) (not (<= y 7200000000.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1e+16) || !(y <= 7200000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 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.1d+16)) .or. (.not. (y <= 7200000000.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 0.16666666666666666d0) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1e+16) || !(y <= 7200000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.1e+16) or not (y <= 7200000000.0): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.1e+16) || !(y <= 7200000000.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(y * z) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.1e+16) || ~((y <= 7200000000.0))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.1e+16], N[Not[LessEqual[y, 7200000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+16} \lor \neg \left(y \leq 7200000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -3.1e16 or 7.2e9 < y Initial program 99.8%
add-sqr-sqrt49.2%
pow249.2%
associate--l+49.2%
Applied egg-rr49.2%
Taylor expanded in y around 0 42.4%
if -3.1e16 < y < 7.2e9Initial program 100.0%
Taylor expanded in y around 0 97.3%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.5e+14) (not (<= y 28000000000.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+14) || !(y <= 28000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-5.5d+14)) .or. (.not. (y <= 28000000000.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+14) || !(y <= 28000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.5e+14) or not (y <= 28000000000.0): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.5e+14) || !(y <= 28000000000.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.5e+14) || ~((y <= 28000000000.0))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.5e+14], N[Not[LessEqual[y, 28000000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+14} \lor \neg \left(y \leq 28000000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -5.5e14 or 2.8e10 < y Initial program 99.8%
add-sqr-sqrt48.3%
pow248.3%
associate--l+48.3%
Applied egg-rr48.3%
Taylor expanded in y around 0 42.4%
if -5.5e14 < y < 2.8e10Initial program 100.0%
Taylor expanded in y around 0 97.0%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -52000000000000.0) (not (<= y 1950000000000.0))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -52000000000000.0) || !(y <= 1950000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-52000000000000.0d0)) .or. (.not. (y <= 1950000000000.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -52000000000000.0) || !(y <= 1950000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -52000000000000.0) or not (y <= 1950000000000.0): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -52000000000000.0) || !(y <= 1950000000000.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -52000000000000.0) || ~((y <= 1950000000000.0))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -52000000000000.0], N[Not[LessEqual[y, 1950000000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -52000000000000 \lor \neg \left(y \leq 1950000000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -5.2e13 or 1.95e12 < y Initial program 99.8%
add-sqr-sqrt48.3%
pow248.3%
associate--l+48.3%
Applied egg-rr48.3%
Taylor expanded in y around 0 42.4%
if -5.2e13 < y < 1.95e12Initial program 100.0%
Taylor expanded in y around 0 96.4%
mul-1-neg96.4%
unsub-neg96.4%
Simplified96.4%
Final simplification72.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.8e-9) (not (<= x 1.65e-85))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.8e-9) || !(x <= 1.65e-85)) {
tmp = x + 1.0;
} else {
tmp = 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 ((x <= (-2.8d-9)) .or. (.not. (x <= 1.65d-85))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.8e-9) || !(x <= 1.65e-85)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.8e-9) or not (x <= 1.65e-85): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.8e-9) || !(x <= 1.65e-85)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.8e-9) || ~((x <= 1.65e-85))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.8e-9], N[Not[LessEqual[x, 1.65e-85]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-9} \lor \neg \left(x \leq 1.65 \cdot 10^{-85}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -2.79999999999999984e-9 or 1.64999999999999986e-85 < x Initial program 99.9%
add-sqr-sqrt50.4%
pow250.4%
associate--l+50.4%
Applied egg-rr50.4%
Taylor expanded in y around 0 80.9%
if -2.79999999999999984e-9 < x < 1.64999999999999986e-85Initial program 99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 55.6%
mul-1-neg55.6%
unsub-neg55.6%
*-commutative55.6%
Simplified55.6%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 1.2) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 1.2) {
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.2d0) 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.2) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 1.2: 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.2) 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.2) 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.2], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 1.19999999999999996 < x Initial program 99.9%
add-sqr-sqrt48.9%
pow248.9%
associate--l+48.9%
Applied egg-rr48.9%
Taylor expanded in x around inf 85.5%
if -1 < x < 1.19999999999999996Initial program 99.8%
Taylor expanded in x around 0 97.9%
Taylor expanded in y around 0 41.8%
Final simplification62.6%
(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%
add-sqr-sqrt59.9%
pow259.9%
associate--l+59.9%
Applied egg-rr59.9%
Taylor expanded in y around 0 63.4%
Final simplification63.4%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 58.6%
Taylor expanded in y around 0 23.3%
Final simplification23.3%
herbie shell --seed 2024067
(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))))