
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ 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 (or (<= z -3.6e+17) (not (<= z 3.4e-10))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e+17) || !(z <= 3.4e-10)) {
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 <= (-3.6d+17)) .or. (.not. (z <= 3.4d-10))) 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 <= -3.6e+17) || !(z <= 3.4e-10)) {
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 <= -3.6e+17) or not (z <= 3.4e-10): 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 <= -3.6e+17) || !(z <= 3.4e-10)) 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 <= -3.6e+17) || ~((z <= 3.4e-10))) 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, -3.6e+17], N[Not[LessEqual[z, 3.4e-10]], $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 -3.6 \cdot 10^{+17} \lor \neg \left(z \leq 3.4 \cdot 10^{-10}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.6e17 or 3.40000000000000015e-10 < z Initial program 99.8%
Taylor expanded in y around 0 99.4%
if -3.6e17 < z < 3.40000000000000015e-10Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.65e+108) (not (<= z 6.6e+27))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.65e+108) || !(z <= 6.6e+27)) {
tmp = 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 <= (-1.65d+108)) .or. (.not. (z <= 6.6d+27))) then
tmp = 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 <= -1.65e+108) || !(z <= 6.6e+27)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.65e+108) or not (z <= 6.6e+27): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.65e+108) || !(z <= 6.6e+27)) tmp = 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 <= -1.65e+108) || ~((z <= 6.6e+27))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.65e+108], N[Not[LessEqual[z, 6.6e+27]], $MachinePrecision]], N[(x - 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.65 \cdot 10^{+108} \lor \neg \left(z \leq 6.6 \cdot 10^{+27}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.6500000000000001e108 or 6.5999999999999996e27 < z Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in z around inf 90.5%
neg-mul-190.5%
Simplified90.5%
if -1.6500000000000001e108 < z < 6.5999999999999996e27Initial program 100.0%
Taylor expanded in z around 0 97.0%
+-commutative97.0%
Simplified97.0%
Final simplification94.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.22e+156) (not (<= z 2.3e+243))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.22e+156) || !(z <= 2.3e+243)) {
tmp = sin(y) * -z;
} 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.22d+156)) .or. (.not. (z <= 2.3d+243))) then
tmp = sin(y) * -z
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.22e+156) || !(z <= 2.3e+243)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.22e+156) or not (z <= 2.3e+243): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.22e+156) || !(z <= 2.3e+243)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.22e+156) || ~((z <= 2.3e+243))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.22e+156], N[Not[LessEqual[z, 2.3e+243]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+156} \lor \neg \left(z \leq 2.3 \cdot 10^{+243}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.21999999999999991e156 or 2.29999999999999987e243 < z Initial program 99.7%
Taylor expanded in z around inf 82.1%
mul-1-neg82.1%
*-commutative82.1%
distribute-rgt-neg-in82.1%
Simplified82.1%
if -1.21999999999999991e156 < z < 2.29999999999999987e243Initial program 99.9%
Taylor expanded in z around 0 87.5%
+-commutative87.5%
Simplified87.5%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.65e+39) (not (<= y 0.72))) (+ 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 <= -2.65e+39) || !(y <= 0.72)) {
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 <= (-2.65d+39)) .or. (.not. (y <= 0.72d0))) 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 <= -2.65e+39) || !(y <= 0.72)) {
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 <= -2.65e+39) or not (y <= 0.72): 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 <= -2.65e+39) || !(y <= 0.72)) 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 <= -2.65e+39) || ~((y <= 0.72))) 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, -2.65e+39], N[Not[LessEqual[y, 0.72]], $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 -2.65 \cdot 10^{+39} \lor \neg \left(y \leq 0.72\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 < -2.64999999999999989e39 or 0.71999999999999997 < y Initial program 99.8%
Taylor expanded in z around 0 72.0%
+-commutative72.0%
Simplified72.0%
if -2.64999999999999989e39 < y < 0.71999999999999997Initial program 100.0%
Taylor expanded in y around 0 96.6%
Final simplification84.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.00041) (not (<= x 1.25e-7))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00041) || !(x <= 1.25e-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 <= (-0.00041d0)) .or. (.not. (x <= 1.25d-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 <= -0.00041) || !(x <= 1.25e-7)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.00041) or not (x <= 1.25e-7): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.00041) || !(x <= 1.25e-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 <= -0.00041) || ~((x <= 1.25e-7))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.00041], N[Not[LessEqual[x, 1.25e-7]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00041 \lor \neg \left(x \leq 1.25 \cdot 10^{-7}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -4.0999999999999999e-4 or 1.24999999999999994e-7 < x Initial program 99.9%
Taylor expanded in y around 0 81.7%
+-commutative81.7%
Simplified81.7%
if -4.0999999999999999e-4 < x < 1.24999999999999994e-7Initial program 99.9%
Taylor expanded in x around 0 98.2%
Taylor expanded in z around 0 68.2%
Final simplification74.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.65e+39) (not (<= y 1.6e+45))) (+ 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 <= -2.65e+39) || !(y <= 1.6e+45)) {
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 <= (-2.65d+39)) .or. (.not. (y <= 1.6d+45))) 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 <= -2.65e+39) || !(y <= 1.6e+45)) {
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 <= -2.65e+39) or not (y <= 1.6e+45): 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 <= -2.65e+39) || !(y <= 1.6e+45)) 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 <= -2.65e+39) || ~((y <= 1.6e+45))) 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, -2.65e+39], N[Not[LessEqual[y, 1.6e+45]], $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 -2.65 \cdot 10^{+39} \lor \neg \left(y \leq 1.6 \cdot 10^{+45}\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 < -2.64999999999999989e39 or 1.6000000000000001e45 < y Initial program 99.8%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -2.64999999999999989e39 < y < 1.6000000000000001e45Initial program 100.0%
Taylor expanded in y around 0 91.9%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -540.0) (not (<= y 2.45e+45))) (+ x 1.0) (+ (+ x 1.0) (* y (- (* y -0.5) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -540.0) || !(y <= 2.45e+45)) {
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 <= (-540.0d0)) .or. (.not. (y <= 2.45d+45))) 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 <= -540.0) || !(y <= 2.45e+45)) {
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 <= -540.0) or not (y <= 2.45e+45): 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 <= -540.0) || !(y <= 2.45e+45)) 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 <= -540.0) || ~((y <= 2.45e+45))) 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, -540.0], N[Not[LessEqual[y, 2.45e+45]], $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 -540 \lor \neg \left(y \leq 2.45 \cdot 10^{+45}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\end{array}
\end{array}
if y < -540 or 2.4500000000000001e45 < y Initial program 99.8%
Taylor expanded in y around 0 38.2%
+-commutative38.2%
Simplified38.2%
if -540 < y < 2.4500000000000001e45Initial program 100.0%
Taylor expanded in y around 0 94.4%
associate-+r+94.4%
+-commutative94.4%
*-commutative94.4%
Simplified94.4%
Final simplification66.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1350.0) (not (<= y 2.3e+32))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1350.0) || !(y <= 2.3e+32)) {
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 <= (-1350.0d0)) .or. (.not. (y <= 2.3d+32))) 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 <= -1350.0) || !(y <= 2.3e+32)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1350.0) or not (y <= 2.3e+32): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1350.0) || !(y <= 2.3e+32)) 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 <= -1350.0) || ~((y <= 2.3e+32))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1350.0], N[Not[LessEqual[y, 2.3e+32]], $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 -1350 \lor \neg \left(y \leq 2.3 \cdot 10^{+32}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1350 or 2.3e32 < y Initial program 99.8%
Taylor expanded in y around 0 37.6%
+-commutative37.6%
Simplified37.6%
if -1350 < y < 2.3e32Initial program 100.0%
Taylor expanded in y around 0 95.5%
associate-+r+95.5%
+-commutative95.5%
associate-+l+95.5%
mul-1-neg95.5%
unsub-neg95.5%
Simplified95.5%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.7e-136) (+ x 1.0) (if (<= x 5.1e+28) (- 1.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e-136) {
tmp = x + 1.0;
} else if (x <= 5.1e+28) {
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 <= (-1.7d-136)) then
tmp = x + 1.0d0
else if (x <= 5.1d+28) 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 <= -1.7e-136) {
tmp = x + 1.0;
} else if (x <= 5.1e+28) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.7e-136: tmp = x + 1.0 elif x <= 5.1e+28: tmp = 1.0 - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.7e-136) tmp = Float64(x + 1.0); elseif (x <= 5.1e+28) 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 <= -1.7e-136) tmp = x + 1.0; elseif (x <= 5.1e+28) tmp = 1.0 - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.7e-136], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 5.1e+28], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-136}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+28}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.7e-136Initial program 99.9%
Taylor expanded in y around 0 63.4%
+-commutative63.4%
Simplified63.4%
if -1.7e-136 < x < 5.1000000000000004e28Initial program 99.9%
Taylor expanded in z around inf 99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 52.3%
+-commutative52.3%
mul-1-neg52.3%
unsub-neg52.3%
Simplified52.3%
Taylor expanded in x around 0 51.8%
sub-neg51.8%
distribute-lft-in51.8%
rgt-mult-inverse51.8%
distribute-rgt-neg-in51.8%
unsub-neg51.8%
Simplified51.8%
if 5.1000000000000004e28 < x Initial program 99.9%
Taylor expanded in x around inf 89.7%
Final simplification64.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.18e+191) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.18e+191) {
tmp = 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 (z <= (-1.18d+191)) then
tmp = 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 (z <= -1.18e+191) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.18e+191: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.18e+191) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.18e+191) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.18e+191], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.18 \cdot 10^{+191}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.17999999999999994e191Initial program 99.8%
Taylor expanded in y around 0 47.0%
+-commutative47.0%
fma-define47.0%
*-commutative47.0%
Simplified47.0%
Taylor expanded in z around inf 36.6%
associate-*r*36.6%
mul-1-neg36.6%
Simplified36.6%
if -1.17999999999999994e191 < z Initial program 99.9%
Taylor expanded in y around 0 63.3%
+-commutative63.3%
Simplified63.3%
Final simplification60.5%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 58.3%
+-commutative58.3%
Simplified58.3%
(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 40.7%
herbie shell --seed 2024129
(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))))