
(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 13 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 (+ (+ 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}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.45) (fma z (cos y) x) (if (<= z 1.65) (+ (+ x (sin y)) z) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.45) {
tmp = fma(z, cos(y), x);
} else if (z <= 1.65) {
tmp = (x + sin(y)) + z;
} else {
tmp = x + (z * cos(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.45) tmp = fma(z, cos(y), x); elseif (z <= 1.65) tmp = Float64(Float64(x + sin(y)) + z); else tmp = Float64(x + Float64(z * cos(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.45], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.65], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\mathbf{elif}\;z \leq 1.65:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\
\end{array}
\end{array}
if z < -1.44999999999999996Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 99.3%
if -1.44999999999999996 < z < 1.6499999999999999Initial program 100.0%
Taylor expanded in y around 0 98.8%
if 1.6499999999999999 < z Initial program 99.9%
Taylor expanded in x around inf 98.6%
(FPCore (x y z)
:precision binary64
(if (<= x -0.24)
(+ x z)
(if (<= x -5e-217)
(+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))
(if (<= x 5.6e-76) (* z (cos y)) (if (<= x 2.3e-38) (sin y) (+ x z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.24) {
tmp = x + z;
} else if (x <= -5e-217) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else if (x <= 5.6e-76) {
tmp = z * cos(y);
} else if (x <= 2.3e-38) {
tmp = sin(y);
} else {
tmp = x + 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 <= (-0.24d0)) then
tmp = x + z
else if (x <= (-5d-217)) then
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
else if (x <= 5.6d-76) then
tmp = z * cos(y)
else if (x <= 2.3d-38) then
tmp = sin(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.24) {
tmp = x + z;
} else if (x <= -5e-217) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else if (x <= 5.6e-76) {
tmp = z * Math.cos(y);
} else if (x <= 2.3e-38) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.24: tmp = x + z elif x <= -5e-217: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) elif x <= 5.6e-76: tmp = z * math.cos(y) elif x <= 2.3e-38: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.24) tmp = Float64(x + z); elseif (x <= -5e-217) tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); elseif (x <= 5.6e-76) tmp = Float64(z * cos(y)); elseif (x <= 2.3e-38) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.24) tmp = x + z; elseif (x <= -5e-217) tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); elseif (x <= 5.6e-76) tmp = z * cos(y); elseif (x <= 2.3e-38) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.24], N[(x + z), $MachinePrecision], If[LessEqual[x, -5e-217], 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], If[LessEqual[x, 5.6e-76], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e-38], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.24:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-217}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-76}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-38}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -0.23999999999999999 or 2.30000000000000002e-38 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 86.8%
if -0.23999999999999999 < x < -5.0000000000000002e-217Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 60.9%
if -5.0000000000000002e-217 < x < 5.6000000000000002e-76Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 73.7%
if 5.6000000000000002e-76 < x < 2.30000000000000002e-38Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in z around 0 86.5%
Final simplification78.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4) (not (<= z 0.5))) (+ x (* z (cos y))) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4) || !(z <= 0.5)) {
tmp = x + (z * cos(y));
} else {
tmp = (x + sin(y)) + z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-2.4d0)) .or. (.not. (z <= 0.5d0))) then
tmp = x + (z * cos(y))
else
tmp = (x + sin(y)) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4) || !(z <= 0.5)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4) or not (z <= 0.5): tmp = x + (z * math.cos(y)) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.4) || !(z <= 0.5)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.4) || ~((z <= 0.5))) tmp = x + (z * cos(y)); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4], N[Not[LessEqual[z, 0.5]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \lor \neg \left(z \leq 0.5\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -2.39999999999999991 or 0.5 < z Initial program 99.9%
Taylor expanded in x around inf 99.0%
if -2.39999999999999991 < z < 0.5Initial program 100.0%
Taylor expanded in y around 0 98.8%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.4e-56) (not (<= z 6.5e-27))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.4e-56) || !(z <= 6.5e-27)) {
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 <= (-6.4d-56)) .or. (.not. (z <= 6.5d-27))) 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 <= -6.4e-56) || !(z <= 6.5e-27)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.4e-56) or not (z <= 6.5e-27): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.4e-56) || !(z <= 6.5e-27)) 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 <= -6.4e-56) || ~((z <= 6.5e-27))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.4e-56], N[Not[LessEqual[z, 6.5e-27]], $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 -6.4 \cdot 10^{-56} \lor \neg \left(z \leq 6.5 \cdot 10^{-27}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -6.39999999999999971e-56 or 6.50000000000000025e-27 < z Initial program 99.8%
Taylor expanded in x around inf 94.5%
if -6.39999999999999971e-56 < z < 6.50000000000000025e-27Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 95.1%
+-commutative95.1%
Simplified95.1%
Final simplification94.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.9e+58) (not (<= z 8.2e+71))) (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.9e+58) || !(z <= 8.2e+71)) {
tmp = 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 <= (-3.9d+58)) .or. (.not. (z <= 8.2d+71))) then
tmp = 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 <= -3.9e+58) || !(z <= 8.2e+71)) {
tmp = z * Math.cos(y);
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.9e+58) or not (z <= 8.2e+71): tmp = z * math.cos(y) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.9e+58) || !(z <= 8.2e+71)) tmp = 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 <= -3.9e+58) || ~((z <= 8.2e+71))) tmp = z * cos(y); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.9e+58], N[Not[LessEqual[z, 8.2e+71]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+58} \lor \neg \left(z \leq 8.2 \cdot 10^{+71}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.9000000000000001e58 or 8.2000000000000004e71 < z Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 86.2%
if -3.9000000000000001e58 < z < 8.2000000000000004e71Initial program 100.0%
+-commutative100.0%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around 0 87.2%
+-commutative87.2%
Simplified87.2%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -3000.0) (not (<= y 1.9e+54))) (+ 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 <= -3000.0) || !(y <= 1.9e+54)) {
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 <= (-3000.0d0)) .or. (.not. (y <= 1.9d+54))) 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 <= -3000.0) || !(y <= 1.9e+54)) {
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 <= -3000.0) or not (y <= 1.9e+54): 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 <= -3000.0) || !(y <= 1.9e+54)) 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 <= -3000.0) || ~((y <= 1.9e+54))) 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, -3000.0], N[Not[LessEqual[y, 1.9e+54]], $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 -3000 \lor \neg \left(y \leq 1.9 \cdot 10^{+54}\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 < -3e3 or 1.9000000000000001e54 < y Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 43.2%
if -3e3 < y < 1.9000000000000001e54Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 96.7%
Final simplification72.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -32000000000000.0) (not (<= y 4.6e+25))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -32000000000000.0) || !(y <= 4.6e+25)) {
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 <= (-32000000000000.0d0)) .or. (.not. (y <= 4.6d+25))) 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 <= -32000000000000.0) || !(y <= 4.6e+25)) {
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 <= -32000000000000.0) or not (y <= 4.6e+25): 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 <= -32000000000000.0) || !(y <= 4.6e+25)) 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 <= -32000000000000.0) || ~((y <= 4.6e+25))) 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, -32000000000000.0], N[Not[LessEqual[y, 4.6e+25]], $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 -32000000000000 \lor \neg \left(y \leq 4.6 \cdot 10^{+25}\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.2e13 or 4.5999999999999996e25 < y Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 43.0%
if -3.2e13 < y < 4.5999999999999996e25Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 96.7%
Taylor expanded in z around 0 96.2%
*-commutative96.2%
Simplified96.2%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -126000.0) (not (<= y 38000000.0))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -126000.0) || !(y <= 38000000.0)) {
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 <= (-126000.0d0)) .or. (.not. (y <= 38000000.0d0))) 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 <= -126000.0) || !(y <= 38000000.0)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -126000.0) or not (y <= 38000000.0): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -126000.0) || !(y <= 38000000.0)) 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 <= -126000.0) || ~((y <= 38000000.0))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -126000.0], N[Not[LessEqual[y, 38000000.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -126000 \lor \neg \left(y \leq 38000000\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -126000 or 3.8e7 < y Initial program 99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 43.3%
if -126000 < y < 3.8e7Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 98.0%
associate-+r+98.0%
+-commutative98.0%
Simplified98.0%
Final simplification72.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -7.5e-54) (not (<= x 7.2e-15))) (+ x z) (+ y z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e-54) || !(x <= 7.2e-15)) {
tmp = x + z;
} else {
tmp = 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 <= (-7.5d-54)) .or. (.not. (x <= 7.2d-15))) then
tmp = x + z
else
tmp = y + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e-54) || !(x <= 7.2e-15)) {
tmp = x + z;
} else {
tmp = y + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.5e-54) or not (x <= 7.2e-15): tmp = x + z else: tmp = y + z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.5e-54) || !(x <= 7.2e-15)) tmp = Float64(x + z); else tmp = Float64(y + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7.5e-54) || ~((x <= 7.2e-15))) tmp = x + z; else tmp = y + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.5e-54], N[Not[LessEqual[x, 7.2e-15]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-54} \lor \neg \left(x \leq 7.2 \cdot 10^{-15}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + z\\
\end{array}
\end{array}
if x < -7.5000000000000005e-54 or 7.2000000000000002e-15 < x Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 83.9%
if -7.5000000000000005e-54 < x < 7.2000000000000002e-15Initial program 99.9%
Taylor expanded in x around 0 94.5%
Taylor expanded in y around 0 50.8%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (<= x -4e-20) x (if (<= x 230000000000.0) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4e-20) {
tmp = x;
} else if (x <= 230000000000.0) {
tmp = 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 <= (-4d-20)) then
tmp = x
else if (x <= 230000000000.0d0) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4e-20) {
tmp = x;
} else if (x <= 230000000000.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4e-20: tmp = x elif x <= 230000000000.0: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4e-20) tmp = x; elseif (x <= 230000000000.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4e-20) tmp = x; elseif (x <= 230000000000.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4e-20], x, If[LessEqual[x, 230000000000.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 230000000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.99999999999999978e-20 or 2.3e11 < x Initial program 100.0%
add-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 73.4%
if -3.99999999999999978e-20 < x < 2.3e11Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 55.3%
Taylor expanded in y around 0 37.3%
(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%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 66.0%
(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-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 43.1%
herbie shell --seed 2024172
(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))))