
(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 7 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 (let* ((t_0 (+ x (/ x (/ z y))))) (if (<= z -1.28e-245) t_0 (if (<= z 9.2e-148) (/ (* x y) z) t_0))))
double code(double x, double y, double z) {
double t_0 = x + (x / (z / y));
double tmp;
if (z <= -1.28e-245) {
tmp = t_0;
} else if (z <= 9.2e-148) {
tmp = (x * y) / 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 = x + (x / (z / y))
if (z <= (-1.28d-245)) then
tmp = t_0
else if (z <= 9.2d-148) then
tmp = (x * y) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (x / (z / y));
double tmp;
if (z <= -1.28e-245) {
tmp = t_0;
} else if (z <= 9.2e-148) {
tmp = (x * y) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (x / (z / y)) tmp = 0 if z <= -1.28e-245: tmp = t_0 elif z <= 9.2e-148: tmp = (x * y) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(x / Float64(z / y))) tmp = 0.0 if (z <= -1.28e-245) tmp = t_0; elseif (z <= 9.2e-148) tmp = Float64(Float64(x * y) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (x / (z / y)); tmp = 0.0; if (z <= -1.28e-245) tmp = t_0; elseif (z <= 9.2e-148) tmp = (x * y) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.28e-245], t$95$0, If[LessEqual[z, 9.2e-148], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{x}{\frac{z}{y}}\\
\mathbf{if}\;z \leq -1.28 \cdot 10^{-245}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-148}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.28e-245 or 9.1999999999999999e-148 < z Initial program 83.1%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity98.1%
Simplified98.1%
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
+-lowering-+.f64N/A
clear-numN/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
/-lowering-/.f6498.2%
Applied egg-rr98.2%
if -1.28e-245 < z < 9.1999999999999999e-148Initial program 98.0%
Taylor expanded in y around inf
*-lowering-*.f6498.0%
Simplified98.0%
Final simplification98.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (+ 1.0 (/ y z))))) (if (<= z -1.38e-245) t_0 (if (<= z 9.2e-148) (/ (* x y) z) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 + (y / z));
double tmp;
if (z <= -1.38e-245) {
tmp = t_0;
} else if (z <= 9.2e-148) {
tmp = (x * y) / 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 = x * (1.0d0 + (y / z))
if (z <= (-1.38d-245)) then
tmp = t_0
else if (z <= 9.2d-148) then
tmp = (x * y) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 + (y / z));
double tmp;
if (z <= -1.38e-245) {
tmp = t_0;
} else if (z <= 9.2e-148) {
tmp = (x * y) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 + (y / z)) tmp = 0 if z <= -1.38e-245: tmp = t_0 elif z <= 9.2e-148: tmp = (x * y) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 + Float64(y / z))) tmp = 0.0 if (z <= -1.38e-245) tmp = t_0; elseif (z <= 9.2e-148) tmp = Float64(Float64(x * y) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 + (y / z)); tmp = 0.0; if (z <= -1.38e-245) tmp = t_0; elseif (z <= 9.2e-148) tmp = (x * y) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.38e-245], t$95$0, If[LessEqual[z, 9.2e-148], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 + \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -1.38 \cdot 10^{-245}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-148}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.38000000000000006e-245 or 9.1999999999999999e-148 < z Initial program 83.1%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity98.1%
Simplified98.1%
if -1.38000000000000006e-245 < z < 9.1999999999999999e-148Initial program 98.0%
Taylor expanded in y around inf
*-lowering-*.f6498.0%
Simplified98.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* x y) z))) (if (<= y -7.5e-9) t_0 (if (<= y 0.0265) x t_0))))
double code(double x, double y, double z) {
double t_0 = (x * y) / z;
double tmp;
if (y <= -7.5e-9) {
tmp = t_0;
} else if (y <= 0.0265) {
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 = (x * y) / z
if (y <= (-7.5d-9)) then
tmp = t_0
else if (y <= 0.0265d0) 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 = (x * y) / z;
double tmp;
if (y <= -7.5e-9) {
tmp = t_0;
} else if (y <= 0.0265) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x * y) / z tmp = 0 if y <= -7.5e-9: tmp = t_0 elif y <= 0.0265: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x * y) / z) tmp = 0.0 if (y <= -7.5e-9) tmp = t_0; elseif (y <= 0.0265) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * y) / z; tmp = 0.0; if (y <= -7.5e-9) tmp = t_0; elseif (y <= 0.0265) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -7.5e-9], t$95$0, If[LessEqual[y, 0.0265], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot y}{z}\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.0265:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7.49999999999999933e-9 or 0.0264999999999999993 < y Initial program 90.6%
Taylor expanded in y around inf
*-lowering-*.f6476.2%
Simplified76.2%
if -7.49999999999999933e-9 < y < 0.0264999999999999993Initial program 80.6%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in y around 0
Simplified77.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (/ x z)))) (if (<= y -4.4e-8) t_0 (if (<= y 0.04) x t_0))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -4.4e-8) {
tmp = t_0;
} else if (y <= 0.04) {
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 <= (-4.4d-8)) then
tmp = t_0
else if (y <= 0.04d0) 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 <= -4.4e-8) {
tmp = t_0;
} else if (y <= 0.04) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -4.4e-8: tmp = t_0 elif y <= 0.04: 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 <= -4.4e-8) tmp = t_0; elseif (y <= 0.04) 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 <= -4.4e-8) tmp = t_0; elseif (y <= 0.04) 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, -4.4e-8], t$95$0, If[LessEqual[y, 0.04], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.04:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.3999999999999997e-8 or 0.0400000000000000008 < y Initial program 90.6%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity90.1%
Simplified90.1%
Taylor expanded in y around inf
*-rgt-identityN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
associate-/r*N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
/-lowering-/.f64N/A
/-lowering-/.f6470.7%
Simplified70.7%
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6475.9%
Applied egg-rr75.9%
if -4.3999999999999997e-8 < y < 0.0400000000000000008Initial program 80.6%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in y around 0
Simplified77.2%
Final simplification76.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (/ y z)))) (if (<= y -2.3e-7) t_0 (if (<= y 0.045) x t_0))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (y <= -2.3e-7) {
tmp = t_0;
} else if (y <= 0.045) {
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 = x * (y / z)
if (y <= (-2.3d-7)) then
tmp = t_0
else if (y <= 0.045d0) 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 = x * (y / z);
double tmp;
if (y <= -2.3e-7) {
tmp = t_0;
} else if (y <= 0.045) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if y <= -2.3e-7: tmp = t_0 elif y <= 0.045: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y / z)) tmp = 0.0 if (y <= -2.3e-7) tmp = t_0; elseif (y <= 0.045) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y / z); tmp = 0.0; if (y <= -2.3e-7) tmp = t_0; elseif (y <= 0.045) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.3e-7], t$95$0, If[LessEqual[y, 0.045], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.045:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.29999999999999995e-7 or 0.044999999999999998 < y Initial program 90.6%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity90.1%
Simplified90.1%
Taylor expanded in y around inf
/-lowering-/.f6469.7%
Simplified69.7%
if -2.29999999999999995e-7 < y < 0.044999999999999998Initial program 80.6%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in y around 0
Simplified77.2%
(FPCore (x y z) :precision binary64 (if (<= x 2e-13) (/ (* x (+ y z)) z) (+ x (/ x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e-13) {
tmp = (x * (y + z)) / z;
} else {
tmp = x + (x / (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 (x <= 2d-13) then
tmp = (x * (y + z)) / z
else
tmp = x + (x / (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2e-13) {
tmp = (x * (y + z)) / z;
} else {
tmp = x + (x / (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2e-13: tmp = (x * (y + z)) / z else: tmp = x + (x / (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2e-13) tmp = Float64(Float64(x * Float64(y + z)) / z); else tmp = Float64(x + Float64(x / Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2e-13) tmp = (x * (y + z)) / z; else tmp = x + (x / (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2e-13], N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x + N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if x < 2.0000000000000001e-13Initial program 88.8%
if 2.0000000000000001e-13 < x Initial program 76.9%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity99.9%
Simplified99.9%
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
+-lowering-+.f64N/A
clear-numN/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
/-lowering-/.f6499.9%
Applied egg-rr99.9%
Final simplification91.3%
(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.2%
associate-/l*N/A
*-lowering-*.f64N/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
distribute-lft-inN/A
associate-*l/N/A
*-inversesN/A
*-lft-identityN/A
*-inversesN/A
lft-mult-inverseN/A
*-inversesN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-inversesN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity94.4%
Simplified94.4%
Taylor expanded in y around 0
Simplified46.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 2024152
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ z (+ y z))))
(/ (* x (+ y z)) z))