
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.75e+39) x (if (<= x 3.1e-38) (- (cos y) (* z (sin y))) (+ x (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+39) {
tmp = x;
} else if (x <= 3.1e-38) {
tmp = cos(y) - (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 (x <= (-1.75d+39)) then
tmp = x
else if (x <= 3.1d-38) then
tmp = cos(y) - (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 (x <= -1.75e+39) {
tmp = x;
} else if (x <= 3.1e-38) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.75e+39: tmp = x elif x <= 3.1e-38: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.75e+39) tmp = x; elseif (x <= 3.1e-38) tmp = Float64(cos(y) - 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 (x <= -1.75e+39) tmp = x; elseif (x <= 3.1e-38) tmp = cos(y) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.75e+39], x, If[LessEqual[x, 3.1e-38], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-38}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if x < -1.7500000000000001e39Initial program 100.0%
Taylor expanded in x around inf 86.1%
if -1.7500000000000001e39 < x < 3.09999999999999983e-38Initial program 99.9%
Taylor expanded in x around 0 99.6%
if 3.09999999999999983e-38 < x Initial program 100.0%
Taylor expanded in z around 0 85.1%
+-commutative85.1%
Simplified85.1%
Final simplification92.7%
(FPCore (x y z)
:precision binary64
(if (<= x -7.5e+97)
x
(if (<= x -2.8e-8)
(+ 1.0 (+ x (* y (- (* y (* z (* y 0.16666666666666666))) z))))
(if (<= x 1.25e-8) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+97) {
tmp = x;
} else if (x <= -2.8e-8) {
tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z)));
} else if (x <= 1.25e-8) {
tmp = cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-7.5d+97)) then
tmp = x
else if (x <= (-2.8d-8)) then
tmp = 1.0d0 + (x + (y * ((y * (z * (y * 0.16666666666666666d0))) - z)))
else if (x <= 1.25d-8) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+97) {
tmp = x;
} else if (x <= -2.8e-8) {
tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z)));
} else if (x <= 1.25e-8) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.5e+97: tmp = x elif x <= -2.8e-8: tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z))) elif x <= 1.25e-8: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.5e+97) tmp = x; elseif (x <= -2.8e-8) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(z * Float64(y * 0.16666666666666666))) - z)))); elseif (x <= 1.25e-8) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.5e+97) tmp = x; elseif (x <= -2.8e-8) tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z))); elseif (x <= 1.25e-8) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.5e+97], x, If[LessEqual[x, -2.8e-8], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(z * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e-8], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+97}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-8}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(z \cdot \left(y \cdot 0.16666666666666666\right)\right) - z\right)\right)\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-8}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -7.5000000000000004e97Initial program 100.0%
Taylor expanded in x around inf 95.2%
if -7.5000000000000004e97 < x < -2.7999999999999999e-8Initial program 99.8%
Taylor expanded in y around 0 61.8%
Taylor expanded in y around inf 61.8%
*-commutative61.8%
*-commutative61.8%
associate-*r*61.8%
Simplified61.8%
if -2.7999999999999999e-8 < x < 1.2499999999999999e-8Initial program 99.9%
Taylor expanded in x around 0 99.6%
Taylor expanded in z around 0 72.0%
if 1.2499999999999999e-8 < x Initial program 100.0%
Taylor expanded in y around 0 80.0%
+-commutative80.0%
Simplified80.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.3e+184) (not (<= z 1.26e+193))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e+184) || !(z <= 1.26e+193)) {
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 <= (-1.3d+184)) .or. (.not. (z <= 1.26d+193))) 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 <= -1.3e+184) || !(z <= 1.26e+193)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e+184) or not (z <= 1.26e+193): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e+184) || !(z <= 1.26e+193)) 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 <= -1.3e+184) || ~((z <= 1.26e+193))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e+184], N[Not[LessEqual[z, 1.26e+193]], $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 -1.3 \cdot 10^{+184} \lor \neg \left(z \leq 1.26 \cdot 10^{+193}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.29999999999999997e184 or 1.2599999999999999e193 < z Initial program 99.9%
Taylor expanded in z around inf 72.8%
mul-1-neg72.8%
*-commutative72.8%
distribute-rgt-neg-in72.8%
Simplified72.8%
if -1.29999999999999997e184 < z < 1.2599999999999999e193Initial program 99.9%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
Simplified89.6%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.3e+19) (not (<= y 340.0))) (+ 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 <= -7.3e+19) || !(y <= 340.0)) {
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 <= (-7.3d+19)) .or. (.not. (y <= 340.0d0))) 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 <= -7.3e+19) || !(y <= 340.0)) {
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 <= -7.3e+19) or not (y <= 340.0): 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 <= -7.3e+19) || !(y <= 340.0)) 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 <= -7.3e+19) || ~((y <= 340.0))) 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, -7.3e+19], N[Not[LessEqual[y, 340.0]], $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 -7.3 \cdot 10^{+19} \lor \neg \left(y \leq 340\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 < -7.3e19 or 340 < y Initial program 99.9%
Taylor expanded in z around 0 68.9%
+-commutative68.9%
Simplified68.9%
if -7.3e19 < y < 340Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification84.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e+22) (not (<= y 5.2e+47))) (+ 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 <= -6e+22) || !(y <= 5.2e+47)) {
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 <= (-6d+22)) .or. (.not. (y <= 5.2d+47))) 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 <= -6e+22) || !(y <= 5.2e+47)) {
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 <= -6e+22) or not (y <= 5.2e+47): 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 <= -6e+22) || !(y <= 5.2e+47)) 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 <= -6e+22) || ~((y <= 5.2e+47))) 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, -6e+22], N[Not[LessEqual[y, 5.2e+47]], $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 -6 \cdot 10^{+22} \lor \neg \left(y \leq 5.2 \cdot 10^{+47}\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 < -6e22 or 5.20000000000000007e47 < y Initial program 99.9%
Taylor expanded in y around 0 37.9%
+-commutative37.9%
Simplified37.9%
if -6e22 < y < 5.20000000000000007e47Initial program 100.0%
Taylor expanded in y around 0 93.5%
Final simplification69.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.2e+23) (not (<= y 710.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (* z (* y 0.16666666666666666))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.2e+23) || !(y <= 710.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - 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 <= (-4.2d+23)) .or. (.not. (y <= 710.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (z * (y * 0.16666666666666666d0))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.2e+23) || !(y <= 710.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.2e+23) or not (y <= 710.0): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.2e+23) || !(y <= 710.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(z * Float64(y * 0.16666666666666666))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.2e+23) || ~((y <= 710.0))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (z * (y * 0.16666666666666666))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.2e+23], N[Not[LessEqual[y, 710.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(z * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+23} \lor \neg \left(y \leq 710\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(z \cdot \left(y \cdot 0.16666666666666666\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -4.2000000000000003e23 or 710 < y Initial program 99.9%
Taylor expanded in y around 0 36.7%
+-commutative36.7%
Simplified36.7%
if -4.2000000000000003e23 < y < 710Initial program 100.0%
Taylor expanded in y around 0 98.7%
Taylor expanded in y around inf 98.5%
*-commutative98.5%
*-commutative98.5%
associate-*r*98.5%
Simplified98.5%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.3e+19) (not (<= y 5.5e+48))) (+ x 1.0) (+ (+ x 1.0) (* y (- (* y -0.5) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.3e+19) || !(y <= 5.5e+48)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (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 <= (-7.3d+19)) .or. (.not. (y <= 5.5d+48))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) + (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 <= -7.3e+19) || !(y <= 5.5e+48)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.3e+19) or not (y <= 5.5e+48): tmp = x + 1.0 else: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.3e+19) || !(y <= 5.5e+48)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.3e+19) || ~((y <= 5.5e+48))) tmp = x + 1.0; else tmp = (x + 1.0) + (y * ((y * -0.5) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.3e+19], N[Not[LessEqual[y, 5.5e+48]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.3 \cdot 10^{+19} \lor \neg \left(y \leq 5.5 \cdot 10^{+48}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\end{array}
\end{array}
if y < -7.3e19 or 5.5000000000000002e48 < y Initial program 99.9%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -7.3e19 < y < 5.5000000000000002e48Initial program 100.0%
Taylor expanded in y around 0 92.5%
associate-+r+92.5%
+-commutative92.5%
*-commutative92.5%
Simplified92.5%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.5e+96) (not (<= y 4.5e-24))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+96) || !(y <= 4.5e-24)) {
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 <= (-1.5d+96)) .or. (.not. (y <= 4.5d-24))) 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 <= -1.5e+96) || !(y <= 4.5e-24)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.5e+96) or not (y <= 4.5e-24): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.5e+96) || !(y <= 4.5e-24)) tmp = Float64(x + 1.0); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.5e+96) || ~((y <= 4.5e-24))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.5e+96], N[Not[LessEqual[y, 4.5e-24]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+96} \lor \neg \left(y \leq 4.5 \cdot 10^{-24}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.5e96 or 4.4999999999999997e-24 < y Initial program 99.9%
Taylor expanded in y around 0 40.4%
+-commutative40.4%
Simplified40.4%
if -1.5e96 < y < 4.4999999999999997e-24Initial program 100.0%
Taylor expanded in y around 0 93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
mul-1-neg93.7%
unsub-neg93.7%
Simplified93.7%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.75e+39) x (if (<= x 1.22e-24) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+39) {
tmp = x;
} else if (x <= 1.22e-24) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.75d+39)) then
tmp = x
else if (x <= 1.22d-24) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+39) {
tmp = x;
} else if (x <= 1.22e-24) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.75e+39: tmp = x elif x <= 1.22e-24: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.75e+39) tmp = x; elseif (x <= 1.22e-24) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.75e+39) tmp = x; elseif (x <= 1.22e-24) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.75e+39], x, If[LessEqual[x, 1.22e-24], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-24}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.7500000000000001e39Initial program 100.0%
Taylor expanded in x around inf 86.1%
if -1.7500000000000001e39 < x < 1.22000000000000004e-24Initial program 99.9%
Taylor expanded in y around 0 52.6%
associate-+r+52.6%
+-commutative52.6%
associate-+l+52.6%
mul-1-neg52.6%
unsub-neg52.6%
Simplified52.6%
Taylor expanded in x around 0 52.6%
if 1.22000000000000004e-24 < x Initial program 100.0%
Taylor expanded in y around 0 77.2%
+-commutative77.2%
Simplified77.2%
(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 60.8%
+-commutative60.8%
Simplified60.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 39.8%
herbie shell --seed 2024145
(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))))