
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + 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 = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y -112000.0)
(+ x z)
(if (<= y 4.1e+23)
(+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))
(if (<= y 2.8e+209) (* z (cos y)) (sin y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -112000.0) {
tmp = x + z;
} else if (y <= 4.1e+23) {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
} else if (y <= 2.8e+209) {
tmp = z * cos(y);
} else {
tmp = sin(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 (y <= (-112000.0d0)) then
tmp = x + z
else if (y <= 4.1d+23) then
tmp = x + (z + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
else if (y <= 2.8d+209) then
tmp = z * cos(y)
else
tmp = sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -112000.0) {
tmp = x + z;
} else if (y <= 4.1e+23) {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
} else if (y <= 2.8e+209) {
tmp = z * Math.cos(y);
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -112000.0: tmp = x + z elif y <= 4.1e+23: tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))) elif y <= 2.8e+209: tmp = z * math.cos(y) else: tmp = math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -112000.0) tmp = Float64(x + z); elseif (y <= 4.1e+23) tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))))); elseif (y <= 2.8e+209) tmp = Float64(z * cos(y)); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -112000.0) tmp = x + z; elseif (y <= 4.1e+23) tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))); elseif (y <= 2.8e+209) tmp = z * cos(y); else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -112000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 4.1e+23], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+209], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[Sin[y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -112000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+23}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+209}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if y < -112000Initial program 99.8%
Taylor expanded in y around 0 43.9%
if -112000 < y < 4.09999999999999996e23Initial program 100.0%
Taylor expanded in y around 0 97.0%
Taylor expanded in z around 0 97.0%
*-commutative97.0%
Simplified97.0%
if 4.09999999999999996e23 < y < 2.80000000000000013e209Initial program 99.8%
Taylor expanded in z around inf 46.5%
if 2.80000000000000013e209 < y Initial program 99.9%
Taylor expanded in y around 0 73.9%
Taylor expanded in x around 0 52.2%
Taylor expanded in z around 0 48.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.4e+15) (not (<= z 7e-12))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.4e+15) || !(z <= 7e-12)) {
tmp = x + (z * cos(y));
} else {
tmp = z + (x + sin(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 <= (-6.4d+15)) .or. (.not. (z <= 7d-12))) then
tmp = x + (z * cos(y))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.4e+15) || !(z <= 7e-12)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.4e+15) or not (z <= 7e-12): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.4e+15) || !(z <= 7e-12)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.4e+15) || ~((z <= 7e-12))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.4e+15], N[Not[LessEqual[z, 7e-12]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+15} \lor \neg \left(z \leq 7 \cdot 10^{-12}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -6.4e15 or 7.0000000000000001e-12 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
if -6.4e15 < z < 7.0000000000000001e-12Initial program 100.0%
Taylor expanded in y around 0 98.6%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.1e-46) (not (<= z 4.3e-13))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1e-46) || !(z <= 4.3e-13)) {
tmp = x + (z * cos(y));
} else {
tmp = x + sin(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.1d-46)) .or. (.not. (z <= 4.3d-13))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1e-46) || !(z <= 4.3e-13)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.1e-46) or not (z <= 4.3e-13): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.1e-46) || !(z <= 4.3e-13)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.1e-46) || ~((z <= 4.3e-13))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.1e-46], N[Not[LessEqual[z, 4.3e-13]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-46} \lor \neg \left(z \leq 4.3 \cdot 10^{-13}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.1e-46 or 4.2999999999999999e-13 < z Initial program 99.9%
Taylor expanded in x around inf 96.9%
if -1.1e-46 < z < 4.2999999999999999e-13Initial program 100.0%
Taylor expanded in z around 0 91.6%
+-commutative91.6%
Simplified91.6%
Final simplification94.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -106000.0) (not (<= y 2.5))) (+ x (sin y)) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -106000.0) || !(y <= 2.5)) {
tmp = x + sin(y);
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-106000.0d0)) .or. (.not. (y <= 2.5d0))) then
tmp = x + sin(y)
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -106000.0) || !(y <= 2.5)) {
tmp = x + Math.sin(y);
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -106000.0) or not (y <= 2.5): tmp = x + math.sin(y) else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -106000.0) || !(y <= 2.5)) tmp = Float64(x + sin(y)); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -106000.0) || ~((y <= 2.5))) tmp = x + sin(y); else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -106000.0], N[Not[LessEqual[y, 2.5]], $MachinePrecision]], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -106000 \lor \neg \left(y \leq 2.5\right):\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -106000 or 2.5 < y Initial program 99.8%
Taylor expanded in z around 0 64.7%
+-commutative64.7%
Simplified64.7%
if -106000 < y < 2.5Initial program 100.0%
Taylor expanded in y around 0 99.4%
Final simplification84.2%
(FPCore (x y z)
:precision binary64
(if (<= y -6400000000000.0)
(+ x z)
(if (<= y 3.3e+21)
(+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))
(sin y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6400000000000.0) {
tmp = x + z;
} else if (y <= 3.3e+21) {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
} else {
tmp = sin(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 (y <= (-6400000000000.0d0)) then
tmp = x + z
else if (y <= 3.3d+21) then
tmp = x + (z + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
else
tmp = sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6400000000000.0) {
tmp = x + z;
} else if (y <= 3.3e+21) {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6400000000000.0: tmp = x + z elif y <= 3.3e+21: tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))) else: tmp = math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6400000000000.0) tmp = Float64(x + z); elseif (y <= 3.3e+21) tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))))); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6400000000000.0) tmp = x + z; elseif (y <= 3.3e+21) tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))); else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6400000000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 3.3e+21], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6400000000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+21}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if y < -6.4e12Initial program 99.8%
Taylor expanded in y around 0 43.9%
if -6.4e12 < y < 3.3e21Initial program 100.0%
Taylor expanded in y around 0 97.6%
Taylor expanded in z around 0 97.6%
*-commutative97.6%
Simplified97.6%
if 3.3e21 < y Initial program 99.8%
Taylor expanded in y around 0 66.4%
Taylor expanded in x around 0 42.6%
Taylor expanded in z around 0 38.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3400000.0) (not (<= y 45000.0))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3400000.0) || !(y <= 45000.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-3400000.0d0)) .or. (.not. (y <= 45000.0d0))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3400000.0) || !(y <= 45000.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3400000.0) or not (y <= 45000.0): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3400000.0) || !(y <= 45000.0)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3400000.0) || ~((y <= 45000.0))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3400000.0], N[Not[LessEqual[y, 45000.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3400000 \lor \neg \left(y \leq 45000\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -3.4e6 or 45000 < y Initial program 99.8%
Taylor expanded in y around 0 38.2%
if -3.4e6 < y < 45000Initial program 100.0%
Taylor expanded in y around 0 98.8%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -32000000.0) (not (<= y 1.25e+22))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -32000000.0) || !(y <= 1.25e+22)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
}
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 <= (-32000000.0d0)) .or. (.not. (y <= 1.25d+22))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -32000000.0) || !(y <= 1.25e+22)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -32000000.0) or not (y <= 1.25e+22): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -32000000.0) || !(y <= 1.25e+22)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -32000000.0) || ~((y <= 1.25e+22))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -32000000.0], N[Not[LessEqual[y, 1.25e+22]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -32000000 \lor \neg \left(y \leq 1.25 \cdot 10^{+22}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -3.2e7 or 1.2499999999999999e22 < y Initial program 99.8%
Taylor expanded in y around 0 37.1%
if -3.2e7 < y < 1.2499999999999999e22Initial program 100.0%
Taylor expanded in y around 0 97.0%
Taylor expanded in z around 0 97.0%
*-commutative97.0%
Simplified97.0%
Final simplification72.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -200000.0) (not (<= y 9.5))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -200000.0) || !(y <= 9.5)) {
tmp = x + z;
} else {
tmp = z + (x + 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 ((y <= (-200000.0d0)) .or. (.not. (y <= 9.5d0))) then
tmp = x + z
else
tmp = z + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -200000.0) || !(y <= 9.5)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -200000.0) or not (y <= 9.5): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -200000.0) || !(y <= 9.5)) tmp = Float64(x + z); else tmp = Float64(z + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -200000.0) || ~((y <= 9.5))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -200000.0], N[Not[LessEqual[y, 9.5]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -200000 \lor \neg \left(y \leq 9.5\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -2e5 or 9.5 < y Initial program 99.8%
Taylor expanded in y around 0 37.9%
if -2e5 < y < 9.5Initial program 100.0%
Taylor expanded in y around 0 98.9%
associate-+r+98.9%
+-commutative98.9%
Simplified98.9%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e-69) x (if (<= x 3.8e-20) (+ x y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-69) {
tmp = x;
} else if (x <= 3.8e-20) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3.6d-69)) then
tmp = x
else if (x <= 3.8d-20) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-69) {
tmp = x;
} else if (x <= 3.8e-20) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.6e-69: tmp = x elif x <= 3.8e-20: tmp = x + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.6e-69) tmp = x; elseif (x <= 3.8e-20) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.6e-69) tmp = x; elseif (x <= 3.8e-20) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.6e-69], x, If[LessEqual[x, 3.8e-20], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-20}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.60000000000000018e-69 or 3.7999999999999998e-20 < x Initial program 100.0%
add-cbrt-cube99.9%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 60.1%
if -3.60000000000000018e-69 < x < 3.7999999999999998e-20Initial program 99.9%
Taylor expanded in y around 0 56.1%
associate-+r+56.1%
+-commutative56.1%
Simplified56.1%
Taylor expanded in z around 0 20.1%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 68.9%
(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%
add-cbrt-cube99.8%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 39.2%
herbie shell --seed 2024165
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))