
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
double code(double x, double y, double z) {
return (x * (y + z)) / 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 * (y + z)) / z
end function
public static double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
def code(x, y, z): return (x * (y + z)) / z
function code(x, y, z) return Float64(Float64(x * Float64(y + z)) / z) end
function tmp = code(x, y, z) tmp = (x * (y + z)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y + z\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
double code(double x, double y, double z) {
return (x * (y + z)) / 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 * (y + z)) / z
end function
public static double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
def code(x, y, z): return (x * (y + z)) / z
function code(x, y, z) return Float64(Float64(x * Float64(y + z)) / z) end
function tmp = code(x, y, z) tmp = (x * (y + z)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y + z\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.7e-68) (not (<= z 0.002))) (* x (/ (+ y z) z)) (* (+ y z) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-68) || !(z <= 0.002)) {
tmp = x * ((y + z) / z);
} else {
tmp = (y + z) * (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 ((z <= (-1.7d-68)) .or. (.not. (z <= 0.002d0))) then
tmp = x * ((y + z) / z)
else
tmp = (y + z) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-68) || !(z <= 0.002)) {
tmp = x * ((y + z) / z);
} else {
tmp = (y + z) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e-68) or not (z <= 0.002): tmp = x * ((y + z) / z) else: tmp = (y + z) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e-68) || !(z <= 0.002)) tmp = Float64(x * Float64(Float64(y + z) / z)); else tmp = Float64(Float64(y + z) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e-68) || ~((z <= 0.002))) tmp = x * ((y + z) / z); else tmp = (y + z) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e-68], N[Not[LessEqual[z, 0.002]], $MachinePrecision]], N[(x * N[(N[(y + z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y + z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-68} \lor \neg \left(z \leq 0.002\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -1.70000000000000009e-68 or 2e-3 < z Initial program 82.5%
associate-*r/99.9%
Simplified99.9%
if -1.70000000000000009e-68 < z < 2e-3Initial program 90.8%
associate-*l/97.5%
Simplified97.5%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (<= (/ (* x (+ y z)) z) 5e-18) (/ x (/ z (+ y z))) (* (+ y z) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (((x * (y + z)) / z) <= 5e-18) {
tmp = x / (z / (y + z));
} else {
tmp = (y + z) * (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 * (y + z)) / z) <= 5d-18) then
tmp = x / (z / (y + z))
else
tmp = (y + z) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * (y + z)) / z) <= 5e-18) {
tmp = x / (z / (y + z));
} else {
tmp = (y + z) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * (y + z)) / z) <= 5e-18: tmp = x / (z / (y + z)) else: tmp = (y + z) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(x * Float64(y + z)) / z) <= 5e-18) tmp = Float64(x / Float64(z / Float64(y + z))); else tmp = Float64(Float64(y + z) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * (y + z)) / z) <= 5e-18) tmp = x / (z / (y + z)); else tmp = (y + z) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 5e-18], N[(x / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq 5 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 y z)) z) < 5.00000000000000036e-18Initial program 88.4%
associate-/l*97.4%
Simplified97.4%
if 5.00000000000000036e-18 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 82.5%
associate-*l/99.8%
Simplified99.8%
Final simplification98.2%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.1e+26)
(and (not (<= y 5.5e-147)) (or (<= y 7.2e-124) (not (<= y 2e+40)))))
(* x (/ y z))
x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.1e+26) || (!(y <= 5.5e-147) && ((y <= 7.2e-124) || !(y <= 2e+40)))) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.1d+26)) .or. (.not. (y <= 5.5d-147)) .and. (y <= 7.2d-124) .or. (.not. (y <= 2d+40))) then
tmp = x * (y / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.1e+26) || (!(y <= 5.5e-147) && ((y <= 7.2e-124) || !(y <= 2e+40)))) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.1e+26) or (not (y <= 5.5e-147) and ((y <= 7.2e-124) or not (y <= 2e+40))): tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.1e+26) || (!(y <= 5.5e-147) && ((y <= 7.2e-124) || !(y <= 2e+40)))) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.1e+26) || (~((y <= 5.5e-147)) && ((y <= 7.2e-124) || ~((y <= 2e+40))))) tmp = x * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.1e+26], And[N[Not[LessEqual[y, 5.5e-147]], $MachinePrecision], Or[LessEqual[y, 7.2e-124], N[Not[LessEqual[y, 2e+40]], $MachinePrecision]]]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+26} \lor \neg \left(y \leq 5.5 \cdot 10^{-147}\right) \land \left(y \leq 7.2 \cdot 10^{-124} \lor \neg \left(y \leq 2 \cdot 10^{+40}\right)\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.10000000000000004e26 or 5.5e-147 < y < 7.20000000000000019e-124 or 2.00000000000000006e40 < y Initial program 91.6%
associate-*r/89.5%
Simplified89.5%
Taylor expanded in y around inf 79.6%
associate-*r/74.2%
Simplified74.2%
if -1.10000000000000004e26 < y < 5.5e-147 or 7.20000000000000019e-124 < y < 2.00000000000000006e40Initial program 81.4%
associate-*r/98.5%
Simplified98.5%
Taylor expanded in y around 0 76.2%
Final simplification75.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= y -1.7e+26)
t_0
(if (<= y 4.55e-147)
x
(if (<= y 6.5e-125) (* x (/ y z)) (if (<= y 2e-99) x t_0))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -1.7e+26) {
tmp = t_0;
} else if (y <= 4.55e-147) {
tmp = x;
} else if (y <= 6.5e-125) {
tmp = x * (y / z);
} else if (y <= 2e-99) {
tmp = 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 = y * (x / z)
if (y <= (-1.7d+26)) then
tmp = t_0
else if (y <= 4.55d-147) then
tmp = x
else if (y <= 6.5d-125) then
tmp = x * (y / z)
else if (y <= 2d-99) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -1.7e+26) {
tmp = t_0;
} else if (y <= 4.55e-147) {
tmp = x;
} else if (y <= 6.5e-125) {
tmp = x * (y / z);
} else if (y <= 2e-99) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -1.7e+26: tmp = t_0 elif y <= 4.55e-147: tmp = x elif y <= 6.5e-125: tmp = x * (y / z) elif y <= 2e-99: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -1.7e+26) tmp = t_0; elseif (y <= 4.55e-147) tmp = x; elseif (y <= 6.5e-125) tmp = Float64(x * Float64(y / z)); elseif (y <= 2e-99) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (y <= -1.7e+26) tmp = t_0; elseif (y <= 4.55e-147) tmp = x; elseif (y <= 6.5e-125) tmp = x * (y / z); elseif (y <= 2e-99) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.7e+26], t$95$0, If[LessEqual[y, 4.55e-147], x, If[LessEqual[y, 6.5e-125], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e-99], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.55 \cdot 10^{-147}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-125}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.7000000000000001e26 or 2e-99 < y Initial program 90.9%
associate-*r/89.9%
Simplified89.9%
Taylor expanded in y around inf 74.2%
associate-*l/75.2%
Applied egg-rr75.2%
if -1.7000000000000001e26 < y < 4.54999999999999977e-147 or 6.4999999999999999e-125 < y < 2e-99Initial program 79.8%
associate-*r/99.1%
Simplified99.1%
Taylor expanded in y around 0 81.7%
if 4.54999999999999977e-147 < y < 6.4999999999999999e-125Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around inf 85.6%
associate-*r/85.6%
Simplified85.6%
Final simplification78.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (/ z x))))
(if (<= y -1.15e+26)
t_0
(if (<= y 5.5e-147)
x
(if (<= y 6.5e-125) (* x (/ y z)) (if (<= y 2.5e-98) x t_0))))))
double code(double x, double y, double z) {
double t_0 = y / (z / x);
double tmp;
if (y <= -1.15e+26) {
tmp = t_0;
} else if (y <= 5.5e-147) {
tmp = x;
} else if (y <= 6.5e-125) {
tmp = x * (y / z);
} else if (y <= 2.5e-98) {
tmp = 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 = y / (z / x)
if (y <= (-1.15d+26)) then
tmp = t_0
else if (y <= 5.5d-147) then
tmp = x
else if (y <= 6.5d-125) then
tmp = x * (y / z)
else if (y <= 2.5d-98) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (z / x);
double tmp;
if (y <= -1.15e+26) {
tmp = t_0;
} else if (y <= 5.5e-147) {
tmp = x;
} else if (y <= 6.5e-125) {
tmp = x * (y / z);
} else if (y <= 2.5e-98) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y / (z / x) tmp = 0 if y <= -1.15e+26: tmp = t_0 elif y <= 5.5e-147: tmp = x elif y <= 6.5e-125: tmp = x * (y / z) elif y <= 2.5e-98: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y / Float64(z / x)) tmp = 0.0 if (y <= -1.15e+26) tmp = t_0; elseif (y <= 5.5e-147) tmp = x; elseif (y <= 6.5e-125) tmp = Float64(x * Float64(y / z)); elseif (y <= 2.5e-98) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (z / x); tmp = 0.0; if (y <= -1.15e+26) tmp = t_0; elseif (y <= 5.5e-147) tmp = x; elseif (y <= 6.5e-125) tmp = x * (y / z); elseif (y <= 2.5e-98) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.15e+26], t$95$0, If[LessEqual[y, 5.5e-147], x, If[LessEqual[y, 6.5e-125], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e-98], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\frac{z}{x}}\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-147}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-125}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-98}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.15e26 or 2.50000000000000009e-98 < y Initial program 90.9%
associate-*r/89.9%
Simplified89.9%
Taylor expanded in y around inf 74.2%
associate-*r/69.4%
Simplified69.4%
associate-*r/74.2%
*-commutative74.2%
associate-/l*75.2%
Applied egg-rr75.2%
if -1.15e26 < y < 5.5e-147 or 6.4999999999999999e-125 < y < 2.50000000000000009e-98Initial program 79.8%
associate-*r/99.1%
Simplified99.1%
Taylor expanded in y around 0 81.7%
if 5.5e-147 < y < 6.4999999999999999e-125Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around inf 85.6%
associate-*r/85.6%
Simplified85.6%
Final simplification78.3%
(FPCore (x y z)
:precision binary64
(if (<= y -1.15e+26)
(/ (* x y) z)
(if (<= y 5.5e-147)
x
(if (<= y 1.05e-123)
(* x (/ y z))
(if (<= y 1.32e-98) x (/ y (/ z x)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+26) {
tmp = (x * y) / z;
} else if (y <= 5.5e-147) {
tmp = x;
} else if (y <= 1.05e-123) {
tmp = x * (y / z);
} else if (y <= 1.32e-98) {
tmp = x;
} else {
tmp = y / (z / 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 <= (-1.15d+26)) then
tmp = (x * y) / z
else if (y <= 5.5d-147) then
tmp = x
else if (y <= 1.05d-123) then
tmp = x * (y / z)
else if (y <= 1.32d-98) then
tmp = x
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+26) {
tmp = (x * y) / z;
} else if (y <= 5.5e-147) {
tmp = x;
} else if (y <= 1.05e-123) {
tmp = x * (y / z);
} else if (y <= 1.32e-98) {
tmp = x;
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+26: tmp = (x * y) / z elif y <= 5.5e-147: tmp = x elif y <= 1.05e-123: tmp = x * (y / z) elif y <= 1.32e-98: tmp = x else: tmp = y / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+26) tmp = Float64(Float64(x * y) / z); elseif (y <= 5.5e-147) tmp = x; elseif (y <= 1.05e-123) tmp = Float64(x * Float64(y / z)); elseif (y <= 1.32e-98) tmp = x; else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e+26) tmp = (x * y) / z; elseif (y <= 5.5e-147) tmp = x; elseif (y <= 1.05e-123) tmp = x * (y / z); elseif (y <= 1.32e-98) tmp = x; else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+26], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 5.5e-147], x, If[LessEqual[y, 1.05e-123], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e-98], x, N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+26}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-147}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-123}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{-98}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < -1.15e26Initial program 91.6%
associate-*r/88.5%
Simplified88.5%
Taylor expanded in y around inf 77.9%
if -1.15e26 < y < 5.5e-147 or 1.05e-123 < y < 1.31999999999999995e-98Initial program 79.8%
associate-*r/99.1%
Simplified99.1%
Taylor expanded in y around 0 81.7%
if 5.5e-147 < y < 1.05e-123Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around inf 85.6%
associate-*r/85.6%
Simplified85.6%
if 1.31999999999999995e-98 < y Initial program 90.3%
associate-*r/90.9%
Simplified90.9%
Taylor expanded in y around inf 71.6%
associate-*r/69.8%
Simplified69.8%
associate-*r/71.6%
*-commutative71.6%
associate-/l*76.3%
Applied egg-rr76.3%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (* x (/ (+ y z) z)))
double code(double x, double y, double z) {
return x * ((y + z) / 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 * ((y + z) / z)
end function
public static double code(double x, double y, double z) {
return x * ((y + z) / z);
}
def code(x, y, z): return x * ((y + z) / z)
function code(x, y, z) return Float64(x * Float64(Float64(y + z) / z)) end
function tmp = code(x, y, z) tmp = x * ((y + z) / z); end
code[x_, y_, z_] := N[(x * N[(N[(y + z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y + z}{z}
\end{array}
Initial program 86.4%
associate-*r/94.1%
Simplified94.1%
Final simplification94.1%
(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 86.4%
associate-*r/94.1%
Simplified94.1%
Taylor expanded in y around 0 47.0%
Final simplification47.0%
(FPCore (x y z) :precision binary64 (/ x (/ z (+ y z))))
double code(double x, double y, double z) {
return x / (z / (y + 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 / (y + z))
end function
public static double code(double x, double y, double z) {
return x / (z / (y + z));
}
def code(x, y, z): return x / (z / (y + z))
function code(x, y, z) return Float64(x / Float64(z / Float64(y + z))) end
function tmp = code(x, y, z) tmp = x / (z / (y + z)); end
code[x_, y_, z_] := N[(x / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{z}{y + z}}
\end{array}
herbie shell --seed 2023290
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))