
(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 9 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 (<= x -3e+98) (+ x (/ x (/ z y))) (if (<= x 1e-296) (fma (/ x z) y x) (* x (+ 1.0 (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3e+98) {
tmp = x + (x / (z / y));
} else if (x <= 1e-296) {
tmp = fma((x / z), y, x);
} else {
tmp = x * (1.0 + (y / z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -3e+98) tmp = Float64(x + Float64(x / Float64(z / y))); elseif (x <= 1e-296) tmp = fma(Float64(x / z), y, x); else tmp = Float64(x * Float64(1.0 + Float64(y / z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -3e+98], N[(x + N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e-296], N[(N[(x / z), $MachinePrecision] * y + x), $MachinePrecision], N[(x * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+98}:\\
\;\;\;\;x + \frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;x \leq 10^{-296}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z}\right)\\
\end{array}
\end{array}
if x < -3.0000000000000001e98Initial program 75.7%
associate-*l/87.6%
distribute-rgt-in70.0%
*-commutative70.0%
associate-/r/87.5%
*-inverses87.5%
/-rgt-identity87.5%
associate-*r/89.7%
*-commutative89.7%
associate-*r/100.0%
fma-def99.9%
Simplified99.9%
fma-udef100.0%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
if -3.0000000000000001e98 < x < 1e-296Initial program 90.9%
associate-*l/84.6%
distribute-lft-in84.7%
fma-def84.7%
associate-/r/96.8%
*-inverses96.8%
/-rgt-identity96.8%
Simplified96.8%
if 1e-296 < x Initial program 85.8%
associate-*l/81.4%
distribute-rgt-in75.9%
*-commutative75.9%
associate-/r/89.3%
*-inverses89.3%
/-rgt-identity89.3%
associate-*r/95.7%
*-commutative95.7%
associate-*r/97.5%
fma-def97.5%
Simplified97.5%
Taylor expanded in x around 0 97.5%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(if (<= z -1.6e+72)
x
(if (<= z 14.6)
(* y (/ x z))
(if (<= z 1.8e+80) x (if (<= z 6.4e+134) (* x (/ y z)) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+72) {
tmp = x;
} else if (z <= 14.6) {
tmp = y * (x / z);
} else if (z <= 1.8e+80) {
tmp = x;
} else if (z <= 6.4e+134) {
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 (z <= (-1.6d+72)) then
tmp = x
else if (z <= 14.6d0) then
tmp = y * (x / z)
else if (z <= 1.8d+80) then
tmp = x
else if (z <= 6.4d+134) 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 (z <= -1.6e+72) {
tmp = x;
} else if (z <= 14.6) {
tmp = y * (x / z);
} else if (z <= 1.8e+80) {
tmp = x;
} else if (z <= 6.4e+134) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e+72: tmp = x elif z <= 14.6: tmp = y * (x / z) elif z <= 1.8e+80: tmp = x elif z <= 6.4e+134: tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e+72) tmp = x; elseif (z <= 14.6) tmp = Float64(y * Float64(x / z)); elseif (z <= 1.8e+80) tmp = x; elseif (z <= 6.4e+134) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.6e+72) tmp = x; elseif (z <= 14.6) tmp = y * (x / z); elseif (z <= 1.8e+80) tmp = x; elseif (z <= 6.4e+134) tmp = x * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e+72], x, If[LessEqual[z, 14.6], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+80], x, If[LessEqual[z, 6.4e+134], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+72}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 14.6:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+80}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.6000000000000001e72 or 14.5999999999999996 < z < 1.79999999999999997e80 or 6.4000000000000001e134 < z Initial program 73.6%
associate-*l/73.6%
Simplified73.6%
Taylor expanded in z around inf 82.5%
if -1.6000000000000001e72 < z < 14.5999999999999996Initial program 94.0%
associate-*l/90.3%
Simplified90.3%
Taylor expanded in z around 0 73.9%
associate-*r/73.5%
Simplified73.5%
if 1.79999999999999997e80 < z < 6.4000000000000001e134Initial program 85.3%
associate-*l/85.4%
distribute-rgt-in85.4%
*-commutative85.4%
associate-/r/85.6%
*-inverses85.6%
/-rgt-identity85.6%
associate-*r/85.5%
*-commutative85.5%
associate-*r/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around inf 68.6%
Final simplification76.7%
(FPCore (x y z)
:precision binary64
(if (<= z -1.8e+71)
x
(if (<= z 16.0)
(/ y (/ z x))
(if (<= z 5.7e+81) x (if (<= z 5.9e+134) (* x (/ y z)) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.8e+71) {
tmp = x;
} else if (z <= 16.0) {
tmp = y / (z / x);
} else if (z <= 5.7e+81) {
tmp = x;
} else if (z <= 5.9e+134) {
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 (z <= (-1.8d+71)) then
tmp = x
else if (z <= 16.0d0) then
tmp = y / (z / x)
else if (z <= 5.7d+81) then
tmp = x
else if (z <= 5.9d+134) 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 (z <= -1.8e+71) {
tmp = x;
} else if (z <= 16.0) {
tmp = y / (z / x);
} else if (z <= 5.7e+81) {
tmp = x;
} else if (z <= 5.9e+134) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.8e+71: tmp = x elif z <= 16.0: tmp = y / (z / x) elif z <= 5.7e+81: tmp = x elif z <= 5.9e+134: tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.8e+71) tmp = x; elseif (z <= 16.0) tmp = Float64(y / Float64(z / x)); elseif (z <= 5.7e+81) tmp = x; elseif (z <= 5.9e+134) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.8e+71) tmp = x; elseif (z <= 16.0) tmp = y / (z / x); elseif (z <= 5.7e+81) tmp = x; elseif (z <= 5.9e+134) tmp = x * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.8e+71], x, If[LessEqual[z, 16.0], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.7e+81], x, If[LessEqual[z, 5.9e+134], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+71}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 16:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.8e71 or 16 < z < 5.70000000000000033e81 or 5.90000000000000008e134 < z Initial program 73.6%
associate-*l/73.6%
Simplified73.6%
Taylor expanded in z around inf 82.5%
if -1.8e71 < z < 16Initial program 94.0%
associate-*l/90.3%
Simplified90.3%
Taylor expanded in z around 0 73.9%
associate-/l*73.8%
Simplified73.8%
if 5.70000000000000033e81 < z < 5.90000000000000008e134Initial program 85.3%
associate-*l/85.4%
distribute-rgt-in85.4%
*-commutative85.4%
associate-/r/85.6%
*-inverses85.6%
/-rgt-identity85.6%
associate-*r/85.5%
*-commutative85.5%
associate-*r/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around inf 68.6%
Final simplification76.8%
(FPCore (x y z)
:precision binary64
(if (<= z -7.6e-50)
x
(if (<= z 28.5)
(/ (* x y) z)
(if (<= z 9.6e+80) x (if (<= z 5.9e+134) (* x (/ y z)) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.6e-50) {
tmp = x;
} else if (z <= 28.5) {
tmp = (x * y) / z;
} else if (z <= 9.6e+80) {
tmp = x;
} else if (z <= 5.9e+134) {
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 (z <= (-7.6d-50)) then
tmp = x
else if (z <= 28.5d0) then
tmp = (x * y) / z
else if (z <= 9.6d+80) then
tmp = x
else if (z <= 5.9d+134) 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 (z <= -7.6e-50) {
tmp = x;
} else if (z <= 28.5) {
tmp = (x * y) / z;
} else if (z <= 9.6e+80) {
tmp = x;
} else if (z <= 5.9e+134) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.6e-50: tmp = x elif z <= 28.5: tmp = (x * y) / z elif z <= 9.6e+80: tmp = x elif z <= 5.9e+134: tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.6e-50) tmp = x; elseif (z <= 28.5) tmp = Float64(Float64(x * y) / z); elseif (z <= 9.6e+80) tmp = x; elseif (z <= 5.9e+134) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.6e-50) tmp = x; elseif (z <= 28.5) tmp = (x * y) / z; elseif (z <= 9.6e+80) tmp = x; elseif (z <= 5.9e+134) tmp = x * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.6e-50], x, If[LessEqual[z, 28.5], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 9.6e+80], x, If[LessEqual[z, 5.9e+134], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{-50}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 28.5:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+80}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.5999999999999998e-50 or 28.5 < z < 9.59999999999999916e80 or 5.90000000000000008e134 < z Initial program 78.4%
associate-*l/79.1%
Simplified79.1%
Taylor expanded in z around inf 76.0%
if -7.5999999999999998e-50 < z < 28.5Initial program 93.5%
associate-*l/88.2%
Simplified88.2%
Taylor expanded in z around 0 79.3%
if 9.59999999999999916e80 < z < 5.90000000000000008e134Initial program 85.3%
associate-*l/85.4%
distribute-rgt-in85.4%
*-commutative85.4%
associate-/r/85.6%
*-inverses85.6%
/-rgt-identity85.6%
associate-*r/85.5%
*-commutative85.5%
associate-*r/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around inf 68.6%
Final simplification77.2%
(FPCore (x y z) :precision binary64 (if (<= x -6.2e+23) (+ x (/ x (/ z y))) (if (<= x 6.1e-266) (/ (* x (+ z y)) z) (* x (+ 1.0 (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e+23) {
tmp = x + (x / (z / y));
} else if (x <= 6.1e-266) {
tmp = (x * (z + y)) / z;
} else {
tmp = x * (1.0 + (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 <= (-6.2d+23)) then
tmp = x + (x / (z / y))
else if (x <= 6.1d-266) then
tmp = (x * (z + y)) / z
else
tmp = x * (1.0d0 + (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e+23) {
tmp = x + (x / (z / y));
} else if (x <= 6.1e-266) {
tmp = (x * (z + y)) / z;
} else {
tmp = x * (1.0 + (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.2e+23: tmp = x + (x / (z / y)) elif x <= 6.1e-266: tmp = (x * (z + y)) / z else: tmp = x * (1.0 + (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.2e+23) tmp = Float64(x + Float64(x / Float64(z / y))); elseif (x <= 6.1e-266) tmp = Float64(Float64(x * Float64(z + y)) / z); else tmp = Float64(x * Float64(1.0 + Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.2e+23) tmp = x + (x / (z / y)); elseif (x <= 6.1e-266) tmp = (x * (z + y)) / z; else tmp = x * (1.0 + (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.2e+23], N[(x + N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.1e-266], N[(N[(x * N[(z + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+23}:\\
\;\;\;\;x + \frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;x \leq 6.1 \cdot 10^{-266}:\\
\;\;\;\;\frac{x \cdot \left(z + y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z}\right)\\
\end{array}
\end{array}
if x < -6.19999999999999941e23Initial program 77.6%
associate-*l/91.4%
distribute-rgt-in79.3%
*-commutative79.3%
associate-/r/91.4%
*-inverses91.4%
/-rgt-identity91.4%
associate-*r/90.1%
*-commutative90.1%
associate-*r/99.9%
fma-def99.8%
Simplified99.8%
fma-udef99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -6.19999999999999941e23 < x < 6.1e-266Initial program 94.1%
if 6.1e-266 < x Initial program 84.7%
associate-*l/85.0%
distribute-rgt-in79.0%
*-commutative79.0%
associate-/r/91.0%
*-inverses91.0%
/-rgt-identity91.0%
associate-*r/95.4%
*-commutative95.4%
associate-*r/98.2%
fma-def98.2%
Simplified98.2%
Taylor expanded in x around 0 98.2%
Final simplification97.3%
(FPCore (x y z) :precision binary64 (if (<= z -4.3e+71) x (if (<= z 15.0) (* y (/ x z)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.3e+71) {
tmp = x;
} else if (z <= 15.0) {
tmp = y * (x / 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 (z <= (-4.3d+71)) then
tmp = x
else if (z <= 15.0d0) then
tmp = y * (x / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.3e+71) {
tmp = x;
} else if (z <= 15.0) {
tmp = y * (x / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.3e+71: tmp = x elif z <= 15.0: tmp = y * (x / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.3e+71) tmp = x; elseif (z <= 15.0) tmp = Float64(y * Float64(x / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.3e+71) tmp = x; elseif (z <= 15.0) tmp = y * (x / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.3e+71], x, If[LessEqual[z, 15.0], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+71}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 15:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.29999999999999984e71 or 15 < z Initial program 75.0%
associate-*l/75.0%
Simplified75.0%
Taylor expanded in z around inf 76.9%
if -4.29999999999999984e71 < z < 15Initial program 94.0%
associate-*l/90.3%
Simplified90.3%
Taylor expanded in z around 0 73.9%
associate-*r/73.5%
Simplified73.5%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (* x (+ 1.0 (/ y z))))
double code(double x, double y, double z) {
return x * (1.0 + (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 * (1.0d0 + (y / z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 + (y / z));
}
def code(x, y, z): return x * (1.0 + (y / z))
function code(x, y, z) return Float64(x * Float64(1.0 + Float64(y / z))) end
function tmp = code(x, y, z) tmp = x * (1.0 + (y / z)); end
code[x_, y_, z_] := N[(x * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + \frac{y}{z}\right)
\end{array}
Initial program 85.9%
associate-*l/83.7%
distribute-rgt-in78.0%
*-commutative78.0%
associate-/r/91.7%
*-inverses91.7%
/-rgt-identity91.7%
associate-*r/93.8%
*-commutative93.8%
associate-*r/95.1%
fma-def95.1%
Simplified95.1%
Taylor expanded in x around 0 95.1%
Final simplification95.1%
(FPCore (x y z) :precision binary64 (+ x (/ x (/ z y))))
double code(double x, double y, double z) {
return x + (x / (z / 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 + (x / (z / y))
end function
public static double code(double x, double y, double z) {
return x + (x / (z / y));
}
def code(x, y, z): return x + (x / (z / y))
function code(x, y, z) return Float64(x + Float64(x / Float64(z / y))) end
function tmp = code(x, y, z) tmp = x + (x / (z / y)); end
code[x_, y_, z_] := N[(x + N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{x}{\frac{z}{y}}
\end{array}
Initial program 85.9%
associate-*l/83.7%
distribute-rgt-in78.0%
*-commutative78.0%
associate-/r/91.7%
*-inverses91.7%
/-rgt-identity91.7%
associate-*r/93.8%
*-commutative93.8%
associate-*r/95.1%
fma-def95.1%
Simplified95.1%
fma-udef95.1%
clear-num95.1%
un-div-inv95.1%
Applied egg-rr95.1%
Final simplification95.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 85.9%
associate-*l/83.7%
Simplified83.7%
Taylor expanded in z around inf 46.8%
Final simplification46.8%
(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 2023238
(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))