
(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
(let* ((t_0 (* z (sin y))))
(if (or (<= x -1.65e-8) (not (<= x 6e-9)))
(+ 1.0 (- 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 <= -1.65e-8) || !(x <= 6e-9)) {
tmp = 1.0 + (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 <= (-1.65d-8)) .or. (.not. (x <= 6d-9))) then
tmp = 1.0d0 + (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 <= -1.65e-8) || !(x <= 6e-9)) {
tmp = 1.0 + (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 <= -1.65e-8) or not (x <= 6e-9): tmp = 1.0 + (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 <= -1.65e-8) || !(x <= 6e-9)) tmp = Float64(1.0 + 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 <= -1.65e-8) || ~((x <= 6e-9))) tmp = 1.0 + (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, -1.65e-8], N[Not[LessEqual[x, 6e-9]], $MachinePrecision]], N[(1.0 + N[(x - t$95$0), $MachinePrecision]), $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.65 \cdot 10^{-8} \lor \neg \left(x \leq 6 \cdot 10^{-9}\right):\\
\;\;\;\;1 + \left(x - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.64999999999999989e-8 or 5.99999999999999996e-9 < x Initial program 99.9%
Taylor expanded in z around -inf 82.4%
mul-1-neg82.4%
distribute-rgt-neg-in82.4%
distribute-lft-out--82.4%
mul-1-neg82.4%
remove-double-neg82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in y around 0 81.9%
Taylor expanded in z around 0 99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
if -1.64999999999999989e-8 < x < 5.99999999999999996e-9Initial program 99.9%
Taylor expanded in x around 0 99.4%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.52) (not (<= z 0.0026))) (+ 1.0 (- x (* z (sin y)))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.52) || !(z <= 0.0026)) {
tmp = 1.0 + (x - (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.52d0)) .or. (.not. (z <= 0.0026d0))) then
tmp = 1.0d0 + (x - (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.52) || !(z <= 0.0026)) {
tmp = 1.0 + (x - (z * Math.sin(y)));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.52) or not (z <= 0.0026): tmp = 1.0 + (x - (z * math.sin(y))) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.52) || !(z <= 0.0026)) tmp = Float64(1.0 + Float64(x - 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.52) || ~((z <= 0.0026))) tmp = 1.0 + (x - (z * sin(y))); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.52], N[Not[LessEqual[z, 0.0026]], $MachinePrecision]], N[(1.0 + N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.52 \lor \neg \left(z \leq 0.0026\right):\\
\;\;\;\;1 + \left(x - z \cdot \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -0.52000000000000002 or 0.0025999999999999999 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 98.3%
Taylor expanded in z around 0 98.4%
neg-mul-198.4%
unsub-neg98.4%
Simplified98.4%
if -0.52000000000000002 < z < 0.0025999999999999999Initial program 100.0%
Taylor expanded in z around 0 99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -82000000000000.0) (not (<= z 29500.0))) (* z (- (/ x z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -82000000000000.0) || !(z <= 29500.0)) {
tmp = z * ((x / 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 <= (-82000000000000.0d0)) .or. (.not. (z <= 29500.0d0))) then
tmp = z * ((x / 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 <= -82000000000000.0) || !(z <= 29500.0)) {
tmp = z * ((x / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -82000000000000.0) or not (z <= 29500.0): tmp = z * ((x / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -82000000000000.0) || !(z <= 29500.0)) tmp = Float64(z * Float64(Float64(x / 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 <= -82000000000000.0) || ~((z <= 29500.0))) tmp = z * ((x / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -82000000000000.0], N[Not[LessEqual[z, 29500.0]], $MachinePrecision]], N[(z * N[(N[(x / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -82000000000000 \lor \neg \left(z \leq 29500\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -8.2e13 or 29500 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 90.7%
if -8.2e13 < z < 29500Initial program 100.0%
Taylor expanded in z around 0 98.4%
+-commutative98.4%
Simplified98.4%
Final simplification94.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.15e+26) (not (<= z 62000000.0))) (- 1.0 (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+26) || !(z <= 62000000.0)) {
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+26)) .or. (.not. (z <= 62000000.0d0))) 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+26) || !(z <= 62000000.0)) {
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+26) or not (z <= 62000000.0): 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+26) || !(z <= 62000000.0)) 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+26) || ~((z <= 62000000.0))) 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+26], N[Not[LessEqual[z, 62000000.0]], $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^{+26} \lor \neg \left(z \leq 62000000\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.15e26 or 6.2e7 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 99.3%
Taylor expanded in x around 0 76.7%
sub-neg76.7%
distribute-lft-in76.7%
rgt-mult-inverse76.7%
distribute-rgt-neg-in76.7%
unsub-neg76.7%
Simplified76.7%
if -1.15e26 < z < 6.2e7Initial program 100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.5e+119) (not (<= z 1.3e+105))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.5e+119) || !(z <= 1.3e+105)) {
tmp = 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 <= (-3.5d+119)) .or. (.not. (z <= 1.3d+105))) then
tmp = 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 <= -3.5e+119) || !(z <= 1.3e+105)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.5e+119) or not (z <= 1.3e+105): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.5e+119) || !(z <= 1.3e+105)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.5e+119) || ~((z <= 1.3e+105))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.5e+119], N[Not[LessEqual[z, 1.3e+105]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+119} \lor \neg \left(z \leq 1.3 \cdot 10^{+105}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.5000000000000001e119 or 1.3000000000000001e105 < z Initial program 99.8%
Taylor expanded in z around inf 76.7%
associate-*r*76.7%
neg-mul-176.7%
*-commutative76.7%
Simplified76.7%
if -3.5000000000000001e119 < z < 1.3000000000000001e105Initial program 100.0%
Taylor expanded in z around 0 88.8%
+-commutative88.8%
Simplified88.8%
Final simplification84.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.6e+29) (not (<= y 3.4e-10))) (+ 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 <= -1.6e+29) || !(y <= 3.4e-10)) {
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 <= (-1.6d+29)) .or. (.not. (y <= 3.4d-10))) 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 <= -1.6e+29) || !(y <= 3.4e-10)) {
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 <= -1.6e+29) or not (y <= 3.4e-10): 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 <= -1.6e+29) || !(y <= 3.4e-10)) 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 <= -1.6e+29) || ~((y <= 3.4e-10))) 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, -1.6e+29], N[Not[LessEqual[y, 3.4e-10]], $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 -1.6 \cdot 10^{+29} \lor \neg \left(y \leq 3.4 \cdot 10^{-10}\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 < -1.59999999999999993e29 or 3.40000000000000015e-10 < y Initial program 99.9%
Taylor expanded in z around 0 57.4%
+-commutative57.4%
Simplified57.4%
if -1.59999999999999993e29 < y < 3.40000000000000015e-10Initial program 99.9%
Taylor expanded in y around 0 94.6%
Final simplification74.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.45e-9) (not (<= x 1.35e-8))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.45e-9) || !(x <= 1.35e-8)) {
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.45d-9)) .or. (.not. (x <= 1.35d-8))) 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.45e-9) || !(x <= 1.35e-8)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.45e-9) or not (x <= 1.35e-8): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.45e-9) || !(x <= 1.35e-8)) 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.45e-9) || ~((x <= 1.35e-8))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.45e-9], N[Not[LessEqual[x, 1.35e-8]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-9} \lor \neg \left(x \leq 1.35 \cdot 10^{-8}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -1.44999999999999996e-9 or 1.35000000000000001e-8 < x Initial program 99.9%
Taylor expanded in y around 0 80.6%
+-commutative80.6%
Simplified80.6%
if -1.44999999999999996e-9 < x < 1.35000000000000001e-8Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.1%
associate-*r*99.1%
fma-define99.1%
pow299.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 99.4%
mul-1-neg99.4%
sub-neg99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in z around 0 54.6%
Final simplification66.2%
(FPCore (x y z)
:precision binary64
(if (<= y -1.15e+17)
(* x (+ 1.0 (/ 1.0 x)))
(if (<= y 45.0)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+17) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 45.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - 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 (y <= (-1.15d+17)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 45.0d0) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - 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 (y <= -1.15e+17) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 45.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+17: tmp = x * (1.0 + (1.0 / x)) elif y <= 45.0: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+17) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 45.0) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e+17) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 45.0) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+17], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 45.0], 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], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+17}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 45:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.15e17Initial program 99.8%
Taylor expanded in x around inf 87.7%
associate--l+87.7%
div-sub87.8%
Simplified87.8%
Taylor expanded in y around 0 34.9%
if -1.15e17 < y < 45Initial program 100.0%
Taylor expanded in y around 0 97.8%
if 45 < y Initial program 99.9%
Taylor expanded in y around 0 32.8%
+-commutative32.8%
Simplified32.8%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e+27) (* x (+ 1.0 (/ 1.0 x))) (if (<= y 42.0) (+ 1.0 (+ x (* y (- (* y -0.5) z)))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+27) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 42.0) {
tmp = 1.0 + (x + (y * ((y * -0.5) - 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 (y <= (-6.5d+27)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 42.0d0) then
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - 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 (y <= -6.5e+27) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 42.0) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.5e+27: tmp = x * (1.0 + (1.0 / x)) elif y <= 42.0: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.5e+27) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 42.0) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.5e+27) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 42.0) tmp = 1.0 + (x + (y * ((y * -0.5) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.5e+27], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 42.0], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 42:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -6.5000000000000005e27Initial program 99.8%
Taylor expanded in x around inf 88.8%
associate--l+88.8%
div-sub88.8%
Simplified88.8%
Taylor expanded in y around 0 36.0%
if -6.5000000000000005e27 < y < 42Initial program 100.0%
Taylor expanded in y around 0 95.9%
if 42 < y Initial program 99.9%
Taylor expanded in y around 0 32.8%
+-commutative32.8%
Simplified32.8%
Final simplification63.2%
(FPCore (x y z) :precision binary64 (if (<= y -5.3e+42) (* x (+ 1.0 (/ 1.0 x))) (if (<= y 3.4e-10) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.3e+42) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 3.4e-10) {
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 (y <= (-5.3d+42)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 3.4d-10) 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 (y <= -5.3e+42) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 3.4e-10) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.3e+42: tmp = x * (1.0 + (1.0 / x)) elif y <= 3.4e-10: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.3e+42) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 3.4e-10) tmp = Float64(x + 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 (y <= -5.3e+42) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 3.4e-10) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.3e+42], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e-10], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{+42}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-10}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -5.30000000000000028e42Initial program 99.8%
Taylor expanded in x around inf 89.2%
associate--l+89.2%
div-sub89.2%
Simplified89.2%
Taylor expanded in y around 0 37.1%
if -5.30000000000000028e42 < y < 3.40000000000000015e-10Initial program 99.9%
Taylor expanded in y around 0 92.0%
associate-+r+92.0%
+-commutative92.0%
associate-+l+92.0%
mul-1-neg92.0%
unsub-neg92.0%
Simplified92.0%
if 3.40000000000000015e-10 < y Initial program 99.9%
Taylor expanded in y around 0 35.5%
+-commutative35.5%
Simplified35.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.8e-13) (not (<= x 4.8e-17))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.8e-13) || !(x <= 4.8e-17)) {
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-13)) .or. (.not. (x <= 4.8d-17))) 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-13) || !(x <= 4.8e-17)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.8e-13) or not (x <= 4.8e-17): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.8e-13) || !(x <= 4.8e-17)) 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-13) || ~((x <= 4.8e-17))) 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-13], N[Not[LessEqual[x, 4.8e-17]], $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^{-13} \lor \neg \left(x \leq 4.8 \cdot 10^{-17}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -2.8000000000000002e-13 or 4.79999999999999973e-17 < x Initial program 99.9%
Taylor expanded in y around 0 79.1%
+-commutative79.1%
Simplified79.1%
if -2.8000000000000002e-13 < x < 4.79999999999999973e-17Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.1%
associate-*r*99.1%
fma-define99.1%
pow299.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 99.9%
mul-1-neg99.9%
sub-neg99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 48.0%
mul-1-neg48.0%
unsub-neg48.0%
Simplified48.0%
Final simplification62.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%
Taylor expanded in x around inf 79.9%
if -1 < x < 1Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.1%
associate-*r*99.2%
fma-define99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 98.3%
mul-1-neg98.3%
sub-neg98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in y around 0 34.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%
Taylor expanded in y around 0 55.2%
+-commutative55.2%
Simplified55.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%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.4%
associate-*r*99.3%
fma-define99.3%
pow299.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 64.7%
mul-1-neg64.7%
sub-neg64.7%
*-commutative64.7%
Simplified64.7%
Taylor expanded in y around 0 20.9%
herbie shell --seed 2024091
(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))))