
(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 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.32e-31) (fma z (cos y) x) (if (<= z 5.8e-49) (+ x (sin y)) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.32e-31) {
tmp = fma(z, cos(y), x);
} else if (z <= 5.8e-49) {
tmp = x + sin(y);
} else {
tmp = x + (z * cos(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.32e-31) tmp = fma(z, cos(y), x); elseif (z <= 5.8e-49) tmp = Float64(x + sin(y)); else tmp = Float64(x + Float64(z * cos(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.32e-31], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.8e-49], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-49}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\
\end{array}
\end{array}
if z < -1.3200000000000001e-31Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 99.3%
if -1.3200000000000001e-31 < z < 5.8e-49Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 95.3%
+-commutative95.3%
Simplified95.3%
if 5.8e-49 < z Initial program 99.9%
Taylor expanded in x around inf 98.2%
Final simplification97.3%
(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 (<= y -0.4)
t_0
(if (<= y 6000000000000.0)
(+ (+ z x) (* y (+ 1.0 (* -0.5 (* z y)))))
(if (<= y 1.55e+180) t_0 (if (<= y 5e+217) (+ z x) (sin y)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (y <= -0.4) {
tmp = t_0;
} else if (y <= 6000000000000.0) {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
} else if (y <= 1.55e+180) {
tmp = t_0;
} else if (y <= 5e+217) {
tmp = z + x;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (y <= (-0.4d0)) then
tmp = t_0
else if (y <= 6000000000000.0d0) then
tmp = (z + x) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
else if (y <= 1.55d+180) then
tmp = t_0
else if (y <= 5d+217) then
tmp = z + x
else
tmp = sin(y)
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 (y <= -0.4) {
tmp = t_0;
} else if (y <= 6000000000000.0) {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
} else if (y <= 1.55e+180) {
tmp = t_0;
} else if (y <= 5e+217) {
tmp = z + x;
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if y <= -0.4: tmp = t_0 elif y <= 6000000000000.0: tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))) elif y <= 1.55e+180: tmp = t_0 elif y <= 5e+217: tmp = z + x else: tmp = math.sin(y) return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (y <= -0.4) tmp = t_0; elseif (y <= 6000000000000.0) tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); elseif (y <= 1.55e+180) tmp = t_0; elseif (y <= 5e+217) tmp = Float64(z + x); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (y <= -0.4) tmp = t_0; elseif (y <= 6000000000000.0) tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))); elseif (y <= 1.55e+180) tmp = t_0; elseif (y <= 5e+217) tmp = z + x; else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.4], t$95$0, If[LessEqual[y, 6000000000000.0], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+180], t$95$0, If[LessEqual[y, 5e+217], N[(z + x), $MachinePrecision], N[Sin[y], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;y \leq -0.4:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6000000000000:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+180}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+217}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if y < -0.40000000000000002 or 6e12 < y < 1.54999999999999999e180Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 48.7%
if -0.40000000000000002 < y < 6e12Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 99.4%
associate-+r+99.4%
Simplified99.4%
if 1.54999999999999999e180 < y < 5.00000000000000041e217Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 65.2%
if 5.00000000000000041e217 < y Initial program 99.9%
Taylor expanded in x around 0 88.9%
Taylor expanded in z around 0 62.3%
Final simplification78.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -4.3e+36)
t_0
(if (<= z 1.1e-47) (+ x (sin y)) (if (<= z 6.5e+49) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4.3e+36) {
tmp = t_0;
} else if (z <= 1.1e-47) {
tmp = x + sin(y);
} else if (z <= 6.5e+49) {
tmp = z + x;
} 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 <= (-4.3d+36)) then
tmp = t_0
else if (z <= 1.1d-47) then
tmp = x + sin(y)
else if (z <= 6.5d+49) then
tmp = z + x
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 <= -4.3e+36) {
tmp = t_0;
} else if (z <= 1.1e-47) {
tmp = x + Math.sin(y);
} else if (z <= 6.5e+49) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4.3e+36: tmp = t_0 elif z <= 1.1e-47: tmp = x + math.sin(y) elif z <= 6.5e+49: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -4.3e+36) tmp = t_0; elseif (z <= 1.1e-47) tmp = Float64(x + sin(y)); elseif (z <= 6.5e+49) tmp = Float64(z + x); 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 <= -4.3e+36) tmp = t_0; elseif (z <= 1.1e-47) tmp = x + sin(y); elseif (z <= 6.5e+49) tmp = z + x; 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, -4.3e+36], t$95$0, If[LessEqual[z, 1.1e-47], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e+49], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-47}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+49}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.30000000000000005e36 or 6.5000000000000005e49 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 82.0%
if -4.30000000000000005e36 < z < 1.10000000000000009e-47Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 92.2%
+-commutative92.2%
Simplified92.2%
if 1.10000000000000009e-47 < z < 6.5000000000000005e49Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 93.7%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.3e-18) (not (<= z 9.6e-48))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.3e-18) || !(z <= 9.6e-48)) {
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 <= (-3.3d-18)) .or. (.not. (z <= 9.6d-48))) 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 <= -3.3e-18) || !(z <= 9.6e-48)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.3e-18) or not (z <= 9.6e-48): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.3e-18) || !(z <= 9.6e-48)) 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 <= -3.3e-18) || ~((z <= 9.6e-48))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.3e-18], N[Not[LessEqual[z, 9.6e-48]], $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 -3.3 \cdot 10^{-18} \lor \neg \left(z \leq 9.6 \cdot 10^{-48}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.3000000000000002e-18 or 9.6e-48 < z Initial program 99.9%
Taylor expanded in x around inf 98.6%
if -3.3000000000000002e-18 < z < 9.6e-48Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 95.3%
+-commutative95.3%
Simplified95.3%
Final simplification97.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e+97) (not (<= y 1.1e+216))) (sin y) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+97) || !(y <= 1.1e+216)) {
tmp = sin(y);
} else {
tmp = z + (y + 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 ((y <= (-2.7d+97)) .or. (.not. (y <= 1.1d+216))) then
tmp = sin(y)
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+97) || !(y <= 1.1e+216)) {
tmp = Math.sin(y);
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e+97) or not (y <= 1.1e+216): tmp = math.sin(y) else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e+97) || !(y <= 1.1e+216)) tmp = sin(y); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.7e+97) || ~((y <= 1.1e+216))) tmp = sin(y); else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e+97], N[Not[LessEqual[y, 1.1e+216]], $MachinePrecision]], N[Sin[y], $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+97} \lor \neg \left(y \leq 1.1 \cdot 10^{+216}\right):\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -2.69999999999999993e97 or 1.1e216 < y Initial program 99.8%
Taylor expanded in x around 0 79.4%
Taylor expanded in z around 0 42.8%
if -2.69999999999999993e97 < y < 1.1e216Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 80.5%
associate-+r+80.5%
+-commutative80.5%
Simplified80.5%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -3200000.0) (not (<= y 8e+28))) (+ z x) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3200000.0) || !(y <= 8e+28)) {
tmp = z + x;
} 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 <= (-3200000.0d0)) .or. (.not. (y <= 8d+28))) then
tmp = z + x
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 <= -3200000.0) || !(y <= 8e+28)) {
tmp = z + x;
} 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 <= -3200000.0) or not (y <= 8e+28): tmp = z + x 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 <= -3200000.0) || !(y <= 8e+28)) tmp = Float64(z + x); 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 <= -3200000.0) || ~((y <= 8e+28))) tmp = z + x; 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, -3200000.0], N[Not[LessEqual[y, 8e+28]], $MachinePrecision]], N[(z + x), $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 -3200000 \lor \neg \left(y \leq 8 \cdot 10^{+28}\right):\\
\;\;\;\;z + x\\
\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.2e6 or 7.99999999999999967e28 < y Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 32.7%
if -3.2e6 < y < 7.99999999999999967e28Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 97.5%
Final simplification69.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -3200000.0) (not (<= y 9e+27))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3200000.0) || !(y <= 9e+27)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * 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 <= (-3200000.0d0)) .or. (.not. (y <= 9d+27))) then
tmp = z + x
else
tmp = (z + x) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3200000.0) || !(y <= 9e+27)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3200000.0) or not (y <= 9e+27): tmp = z + x else: tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3200000.0) || !(y <= 9e+27)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3200000.0) || ~((y <= 9e+27))) tmp = z + x; else tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3200000.0], N[Not[LessEqual[y, 9e+27]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3200000 \lor \neg \left(y \leq 9 \cdot 10^{+27}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -3.2e6 or 8.9999999999999998e27 < y Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 32.5%
if -3.2e6 < y < 8.9999999999999998e27Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 98.1%
associate-+r+98.1%
Simplified98.1%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -8e+43) (not (<= y 1.45e+74))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8e+43) || !(y <= 1.45e+74)) {
tmp = z + x;
} else {
tmp = z + (y + 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 ((y <= (-8d+43)) .or. (.not. (y <= 1.45d+74))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8e+43) || !(y <= 1.45e+74)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8e+43) or not (y <= 1.45e+74): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8e+43) || !(y <= 1.45e+74)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8e+43) || ~((y <= 1.45e+74))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8e+43], N[Not[LessEqual[y, 1.45e+74]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+43} \lor \neg \left(y \leq 1.45 \cdot 10^{+74}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -8.00000000000000011e43 or 1.4500000000000001e74 < y Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 32.7%
if -8.00000000000000011e43 < y < 1.4500000000000001e74Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 91.2%
associate-+r+91.2%
+-commutative91.2%
Simplified91.2%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= x -5.8e+92) x (if (<= x 2e-112) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+92) {
tmp = x;
} else if (x <= 2e-112) {
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 <= (-5.8d+92)) then
tmp = x
else if (x <= 2d-112) 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 <= -5.8e+92) {
tmp = x;
} else if (x <= 2e-112) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.8e+92: tmp = x elif x <= 2e-112: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.8e+92) tmp = x; elseif (x <= 2e-112) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.8e+92) tmp = x; elseif (x <= 2e-112) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.8e+92], x, If[LessEqual[x, 2e-112], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+92}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-112}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.8000000000000001e92 or 1.9999999999999999e-112 < x Initial program 100.0%
add-cbrt-cube99.9%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 66.7%
if -5.8000000000000001e92 < x < 1.9999999999999999e-112Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 66.2%
Taylor expanded in y around 0 44.5%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 64.5%
Final simplification64.5%
(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.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 36.8%
herbie shell --seed 2024163
(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))))