
(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 (+ (* 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
(let* ((t_0 (* z (cos y))))
(if (<= z -4e+169)
t_0
(if (<= z -4e-134)
(+ x z)
(if (<= z -4.1e-257) (sin y) (if (<= z 2.7e+104) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4e+169) {
tmp = t_0;
} else if (z <= -4e-134) {
tmp = x + z;
} else if (z <= -4.1e-257) {
tmp = sin(y);
} else if (z <= 2.7e+104) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-4d+169)) then
tmp = t_0
else if (z <= (-4d-134)) then
tmp = x + z
else if (z <= (-4.1d-257)) then
tmp = sin(y)
else if (z <= 2.7d+104) then
tmp = x + z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -4e+169) {
tmp = t_0;
} else if (z <= -4e-134) {
tmp = x + z;
} else if (z <= -4.1e-257) {
tmp = Math.sin(y);
} else if (z <= 2.7e+104) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4e+169: tmp = t_0 elif z <= -4e-134: tmp = x + z elif z <= -4.1e-257: tmp = math.sin(y) elif z <= 2.7e+104: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -4e+169) tmp = t_0; elseif (z <= -4e-134) tmp = Float64(x + z); elseif (z <= -4.1e-257) tmp = sin(y); elseif (z <= 2.7e+104) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -4e+169) tmp = t_0; elseif (z <= -4e-134) tmp = x + z; elseif (z <= -4.1e-257) tmp = sin(y); elseif (z <= 2.7e+104) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+169], t$95$0, If[LessEqual[z, -4e-134], N[(x + z), $MachinePrecision], If[LessEqual[z, -4.1e-257], N[Sin[y], $MachinePrecision], If[LessEqual[z, 2.7e+104], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4 \cdot 10^{+169}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-134}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-257}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+104}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.99999999999999974e169 or 2.69999999999999985e104 < z Initial program 99.9%
Taylor expanded in z around inf 83.3%
if -3.99999999999999974e169 < z < -4.00000000000000016e-134 or -4.0999999999999997e-257 < z < 2.69999999999999985e104Initial program 100.0%
Taylor expanded in y around 0 74.8%
if -4.00000000000000016e-134 < z < -4.0999999999999997e-257Initial program 100.0%
Taylor expanded in x around 0 82.3%
Taylor expanded in z around 0 78.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (sin y))))
(if (<= y -6.2e+76)
t_0
(if (<= y -165.0)
(* z (cos y))
(if (<= y 1200000000000.0)
(+
x
(+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))
t_0)))))
double code(double x, double y, double z) {
double t_0 = x + sin(y);
double tmp;
if (y <= -6.2e+76) {
tmp = t_0;
} else if (y <= -165.0) {
tmp = z * cos(y);
} else if (y <= 1200000000000.0) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x + sin(y)
if (y <= (-6.2d+76)) then
tmp = t_0
else if (y <= (-165.0d0)) then
tmp = z * cos(y)
else if (y <= 1200000000000.0d0) then
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.sin(y);
double tmp;
if (y <= -6.2e+76) {
tmp = t_0;
} else if (y <= -165.0) {
tmp = z * Math.cos(y);
} else if (y <= 1200000000000.0) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.sin(y) tmp = 0 if y <= -6.2e+76: tmp = t_0 elif y <= -165.0: tmp = z * math.cos(y) elif y <= 1200000000000.0: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + sin(y)) tmp = 0.0 if (y <= -6.2e+76) tmp = t_0; elseif (y <= -165.0) tmp = Float64(z * cos(y)); elseif (y <= 1200000000000.0) tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + sin(y); tmp = 0.0; if (y <= -6.2e+76) tmp = t_0; elseif (y <= -165.0) tmp = z * cos(y); elseif (y <= 1200000000000.0) tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.2e+76], t$95$0, If[LessEqual[y, -165.0], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1200000000000.0], 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], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -165:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;y \leq 1200000000000:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6.20000000000000023e76 or 1.2e12 < y Initial program 99.9%
Taylor expanded in z around 0 67.6%
+-commutative67.6%
Simplified67.6%
if -6.20000000000000023e76 < y < -165Initial program 99.6%
Taylor expanded in z around inf 73.3%
if -165 < y < 1.2e12Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification84.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25) (not (<= z 1.9))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25) || !(z <= 1.9)) {
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 <= (-1.25d0)) .or. (.not. (z <= 1.9d0))) 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 <= -1.25) || !(z <= 1.9)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25) or not (z <= 1.9): 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 <= -1.25) || !(z <= 1.9)) 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 <= -1.25) || ~((z <= 1.9))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25], N[Not[LessEqual[z, 1.9]], $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 -1.25 \lor \neg \left(z \leq 1.9\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -1.25 or 1.8999999999999999 < z Initial program 99.9%
Taylor expanded in x around inf 97.6%
if -1.25 < z < 1.8999999999999999Initial program 100.0%
Taylor expanded in y around 0 99.6%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.8e-37) (not (<= z 1.9e-81))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e-37) || !(z <= 1.9e-81)) {
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.8d-37)) .or. (.not. (z <= 1.9d-81))) 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.8e-37) || !(z <= 1.9e-81)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.8e-37) or not (z <= 1.9e-81): 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.8e-37) || !(z <= 1.9e-81)) 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.8e-37) || ~((z <= 1.9e-81))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.8e-37], N[Not[LessEqual[z, 1.9e-81]], $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.8 \cdot 10^{-37} \lor \neg \left(z \leq 1.9 \cdot 10^{-81}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -6.80000000000000037e-37 or 1.8999999999999999e-81 < z Initial program 99.9%
Taylor expanded in x around inf 94.9%
if -6.80000000000000037e-37 < z < 1.8999999999999999e-81Initial program 100.0%
Taylor expanded in z around 0 92.7%
+-commutative92.7%
Simplified92.7%
Final simplification94.0%
(FPCore (x y z)
:precision binary64
(if (<= y -170.0)
(+ x z)
(if (<= y 2.1e+41)
(+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))
(sin y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -170.0) {
tmp = x + z;
} else if (y <= 2.1e+41) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (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 <= (-170.0d0)) then
tmp = x + z
else if (y <= 2.1d+41) then
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (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 <= -170.0) {
tmp = x + z;
} else if (y <= 2.1e+41) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -170.0: tmp = x + z elif y <= 2.1e+41: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) else: tmp = math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -170.0) tmp = Float64(x + z); elseif (y <= 2.1e+41) tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -170.0) tmp = x + z; elseif (y <= 2.1e+41) tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -170.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 2.1e+41], 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], N[Sin[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -170:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+41}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if y < -170Initial program 99.8%
Taylor expanded in y around 0 44.4%
if -170 < y < 2.1e41Initial program 100.0%
Taylor expanded in y around 0 98.0%
if 2.1e41 < y Initial program 99.9%
Taylor expanded in x around 0 78.5%
Taylor expanded in z around 0 41.4%
Final simplification73.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -170.0) (not (<= y 15000000000000.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 <= -170.0) || !(y <= 15000000000000.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 <= (-170.0d0)) .or. (.not. (y <= 15000000000000.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 <= -170.0) || !(y <= 15000000000000.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 <= -170.0) or not (y <= 15000000000000.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 <= -170.0) || !(y <= 15000000000000.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 <= -170.0) || ~((y <= 15000000000000.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, -170.0], N[Not[LessEqual[y, 15000000000000.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 -170 \lor \neg \left(y \leq 15000000000000\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 < -170 or 1.5e13 < y Initial program 99.9%
Taylor expanded in y around 0 37.5%
if -170 < y < 1.5e13Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification70.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -105.0) (not (<= y 13000000000000.0))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -105.0) || !(y <= 13000000000000.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (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 <= (-105.0d0)) .or. (.not. (y <= 13000000000000.0d0))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -105.0) || !(y <= 13000000000000.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -105.0) or not (y <= 13000000000000.0): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -105.0) || !(y <= 13000000000000.0)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -105.0) || ~((y <= 13000000000000.0))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -105.0], N[Not[LessEqual[y, 13000000000000.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -105 \lor \neg \left(y \leq 13000000000000\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -105 or 1.3e13 < y Initial program 99.9%
Taylor expanded in y around 0 37.5%
if -105 < y < 1.3e13Initial program 100.0%
Taylor expanded in y around 0 99.3%
associate-+r+99.3%
Simplified99.3%
Final simplification70.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+46) (not (<= y 3.2))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+46) || !(y <= 3.2)) {
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 <= (-2.9d+46)) .or. (.not. (y <= 3.2d0))) 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 <= -2.9e+46) || !(y <= 3.2)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+46) or not (y <= 3.2): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+46) || !(y <= 3.2)) 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 <= -2.9e+46) || ~((y <= 3.2))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+46], N[Not[LessEqual[y, 3.2]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+46} \lor \neg \left(y \leq 3.2\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -2.9000000000000002e46 or 3.2000000000000002 < y Initial program 99.9%
Taylor expanded in y around 0 38.0%
if -2.9000000000000002e46 < y < 3.2000000000000002Initial program 100.0%
Taylor expanded in y around 0 97.2%
associate-+r+97.2%
+-commutative97.2%
Simplified97.2%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.7e-102) (not (<= x 8.5e-132))) (+ x z) (+ y z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e-102) || !(x <= 8.5e-132)) {
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 <= (-2.7d-102)) .or. (.not. (x <= 8.5d-132))) 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 <= -2.7e-102) || !(x <= 8.5e-132)) {
tmp = x + z;
} else {
tmp = y + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.7e-102) or not (x <= 8.5e-132): tmp = x + z else: tmp = y + z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.7e-102) || !(x <= 8.5e-132)) 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 <= -2.7e-102) || ~((x <= 8.5e-132))) tmp = x + z; else tmp = y + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.7e-102], N[Not[LessEqual[x, 8.5e-132]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-102} \lor \neg \left(x \leq 8.5 \cdot 10^{-132}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + z\\
\end{array}
\end{array}
if x < -2.7e-102 or 8.49999999999999988e-132 < x Initial program 100.0%
Taylor expanded in y around 0 75.0%
if -2.7e-102 < x < 8.49999999999999988e-132Initial program 99.9%
Taylor expanded in x around 0 97.7%
Taylor expanded in y around 0 55.6%
+-commutative55.6%
Simplified55.6%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (<= x -75.0) x (if (<= x 130000000.0) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -75.0) {
tmp = x;
} else if (x <= 130000000.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 <= (-75.0d0)) then
tmp = x
else if (x <= 130000000.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 <= -75.0) {
tmp = x;
} else if (x <= 130000000.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -75.0: tmp = x elif x <= 130000000.0: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -75.0) tmp = x; elseif (x <= 130000000.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -75.0) tmp = x; elseif (x <= 130000000.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -75.0], x, If[LessEqual[x, 130000000.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -75:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 130000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -75 or 1.3e8 < x Initial program 100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 80.6%
if -75 < x < 1.3e8Initial program 99.9%
Taylor expanded in z around inf 58.7%
Taylor expanded in y around 0 40.4%
(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 64.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%
expm1-log1p-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 40.7%
herbie shell --seed 2024152
(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))))