
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - 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 * (y - z)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - 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 * (y - z)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (/ x (/ y (- y z))))
double code(double x, double y, double z) {
return x / (y / (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 / (y / (y - z))
end function
public static double code(double x, double y, double z) {
return x / (y / (y - z));
}
def code(x, y, z): return x / (y / (y - z))
function code(x, y, z) return Float64(x / Float64(y / Float64(y - z))) end
function tmp = code(x, y, z) tmp = x / (y / (y - z)); end
code[x_, y_, z_] := N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{y}{y - z}}
\end{array}
Initial program 85.2%
associate-*l/83.2%
Simplified83.2%
associate-/r/97.0%
Applied egg-rr97.0%
Final simplification97.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ (- z) y))))
(if (<= y -9e+124)
x
(if (<= y -2.3e+29)
t_0
(if (<= y -7e-94) (* y (/ x y)) (if (<= y 7.2e-20) t_0 x))))))
double code(double x, double y, double z) {
double t_0 = x * (-z / y);
double tmp;
if (y <= -9e+124) {
tmp = x;
} else if (y <= -2.3e+29) {
tmp = t_0;
} else if (y <= -7e-94) {
tmp = y * (x / y);
} else if (y <= 7.2e-20) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * (-z / y)
if (y <= (-9d+124)) then
tmp = x
else if (y <= (-2.3d+29)) then
tmp = t_0
else if (y <= (-7d-94)) then
tmp = y * (x / y)
else if (y <= 7.2d-20) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-z / y);
double tmp;
if (y <= -9e+124) {
tmp = x;
} else if (y <= -2.3e+29) {
tmp = t_0;
} else if (y <= -7e-94) {
tmp = y * (x / y);
} else if (y <= 7.2e-20) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-z / y) tmp = 0 if y <= -9e+124: tmp = x elif y <= -2.3e+29: tmp = t_0 elif y <= -7e-94: tmp = y * (x / y) elif y <= 7.2e-20: tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(-z) / y)) tmp = 0.0 if (y <= -9e+124) tmp = x; elseif (y <= -2.3e+29) tmp = t_0; elseif (y <= -7e-94) tmp = Float64(y * Float64(x / y)); elseif (y <= 7.2e-20) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-z / y); tmp = 0.0; if (y <= -9e+124) tmp = x; elseif (y <= -2.3e+29) tmp = t_0; elseif (y <= -7e-94) tmp = y * (x / y); elseif (y <= 7.2e-20) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+124], x, If[LessEqual[y, -2.3e+29], t$95$0, If[LessEqual[y, -7e-94], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-20], t$95$0, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-z}{y}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{+29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-94}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.0000000000000008e124 or 7.19999999999999948e-20 < y Initial program 75.9%
*-commutative75.9%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 82.1%
if -9.0000000000000008e124 < y < -2.3000000000000001e29 or -6.99999999999999996e-94 < y < 7.19999999999999948e-20Initial program 94.8%
associate-*l/91.7%
Simplified91.7%
associate-/r/94.1%
Applied egg-rr94.1%
Taylor expanded in y around 0 74.3%
mul-1-neg74.3%
associate-*r/72.2%
distribute-rgt-neg-in72.2%
distribute-neg-frac72.2%
Simplified72.2%
if -2.3000000000000001e29 < y < -6.99999999999999996e-94Initial program 83.3%
Taylor expanded in y around inf 62.2%
associate-/l*77.5%
associate-/r/80.9%
Applied egg-rr80.9%
Final simplification77.5%
(FPCore (x y z)
:precision binary64
(if (<= y -9e+124)
x
(if (<= y -1.6e+29)
(* x (/ (- z) y))
(if (<= y -2.35e-77)
(* y (/ x y))
(if (<= y 6.6e-20) (* z (/ (- x) y)) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9e+124) {
tmp = x;
} else if (y <= -1.6e+29) {
tmp = x * (-z / y);
} else if (y <= -2.35e-77) {
tmp = y * (x / y);
} else if (y <= 6.6e-20) {
tmp = z * (-x / y);
} 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 <= (-9d+124)) then
tmp = x
else if (y <= (-1.6d+29)) then
tmp = x * (-z / y)
else if (y <= (-2.35d-77)) then
tmp = y * (x / y)
else if (y <= 6.6d-20) then
tmp = z * (-x / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9e+124) {
tmp = x;
} else if (y <= -1.6e+29) {
tmp = x * (-z / y);
} else if (y <= -2.35e-77) {
tmp = y * (x / y);
} else if (y <= 6.6e-20) {
tmp = z * (-x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9e+124: tmp = x elif y <= -1.6e+29: tmp = x * (-z / y) elif y <= -2.35e-77: tmp = y * (x / y) elif y <= 6.6e-20: tmp = z * (-x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9e+124) tmp = x; elseif (y <= -1.6e+29) tmp = Float64(x * Float64(Float64(-z) / y)); elseif (y <= -2.35e-77) tmp = Float64(y * Float64(x / y)); elseif (y <= 6.6e-20) tmp = Float64(z * Float64(Float64(-x) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9e+124) tmp = x; elseif (y <= -1.6e+29) tmp = x * (-z / y); elseif (y <= -2.35e-77) tmp = y * (x / y); elseif (y <= 6.6e-20) tmp = z * (-x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9e+124], x, If[LessEqual[y, -1.6e+29], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.35e-77], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e-20], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{elif}\;y \leq -2.35 \cdot 10^{-77}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-20}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.0000000000000008e124 or 6.6e-20 < y Initial program 75.9%
*-commutative75.9%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 82.1%
if -9.0000000000000008e124 < y < -1.59999999999999993e29Initial program 94.0%
associate-*l/80.5%
Simplified80.5%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 62.2%
mul-1-neg62.2%
associate-*r/67.8%
distribute-rgt-neg-in67.8%
distribute-neg-frac67.8%
Simplified67.8%
if -1.59999999999999993e29 < y < -2.3499999999999999e-77Initial program 87.5%
Taylor expanded in y around inf 74.6%
associate-/l*85.2%
associate-/r/89.8%
Applied egg-rr89.8%
if -2.3499999999999999e-77 < y < 6.6e-20Initial program 93.5%
*-commutative93.5%
associate-*l/92.9%
*-commutative92.9%
div-sub92.9%
*-inverses92.9%
Simplified92.9%
Taylor expanded in z around inf 74.9%
mul-1-neg74.9%
associate-*l/74.4%
distribute-rgt-neg-out74.4%
*-commutative74.4%
Simplified74.4%
Final simplification78.6%
(FPCore (x y z)
:precision binary64
(if (<= y -9e+124)
x
(if (<= y -1.4e+29)
(* x (/ (- z) y))
(if (<= y -3.3e-76)
(* y (/ x y))
(if (<= y 4.4e-19) (/ z (/ (- y) x)) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9e+124) {
tmp = x;
} else if (y <= -1.4e+29) {
tmp = x * (-z / y);
} else if (y <= -3.3e-76) {
tmp = y * (x / y);
} else if (y <= 4.4e-19) {
tmp = z / (-y / x);
} 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 <= (-9d+124)) then
tmp = x
else if (y <= (-1.4d+29)) then
tmp = x * (-z / y)
else if (y <= (-3.3d-76)) then
tmp = y * (x / y)
else if (y <= 4.4d-19) then
tmp = z / (-y / x)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9e+124) {
tmp = x;
} else if (y <= -1.4e+29) {
tmp = x * (-z / y);
} else if (y <= -3.3e-76) {
tmp = y * (x / y);
} else if (y <= 4.4e-19) {
tmp = z / (-y / x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9e+124: tmp = x elif y <= -1.4e+29: tmp = x * (-z / y) elif y <= -3.3e-76: tmp = y * (x / y) elif y <= 4.4e-19: tmp = z / (-y / x) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9e+124) tmp = x; elseif (y <= -1.4e+29) tmp = Float64(x * Float64(Float64(-z) / y)); elseif (y <= -3.3e-76) tmp = Float64(y * Float64(x / y)); elseif (y <= 4.4e-19) tmp = Float64(z / Float64(Float64(-y) / x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9e+124) tmp = x; elseif (y <= -1.4e+29) tmp = x * (-z / y); elseif (y <= -3.3e-76) tmp = y * (x / y); elseif (y <= 4.4e-19) tmp = z / (-y / x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9e+124], x, If[LessEqual[y, -1.4e+29], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.3e-76], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e-19], N[(z / N[((-y) / x), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-76}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-19}:\\
\;\;\;\;\frac{z}{\frac{-y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.0000000000000008e124 or 4.3999999999999997e-19 < y Initial program 75.9%
*-commutative75.9%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 82.1%
if -9.0000000000000008e124 < y < -1.4e29Initial program 94.0%
associate-*l/80.5%
Simplified80.5%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 62.2%
mul-1-neg62.2%
associate-*r/67.8%
distribute-rgt-neg-in67.8%
distribute-neg-frac67.8%
Simplified67.8%
if -1.4e29 < y < -3.29999999999999984e-76Initial program 87.5%
Taylor expanded in y around inf 74.6%
associate-/l*85.2%
associate-/r/89.8%
Applied egg-rr89.8%
if -3.29999999999999984e-76 < y < 4.3999999999999997e-19Initial program 93.5%
*-commutative93.5%
associate-*l/92.9%
*-commutative92.9%
div-sub92.9%
*-inverses92.9%
Simplified92.9%
Taylor expanded in z around inf 74.9%
mul-1-neg74.9%
associate-*l/74.4%
distribute-rgt-neg-out74.4%
*-commutative74.4%
Simplified74.4%
associate-*r/74.9%
distribute-lft-neg-in74.9%
distribute-rgt-neg-out74.9%
associate-/l*74.4%
frac-2neg74.4%
add-sqr-sqrt40.3%
sqrt-unprod32.5%
sqr-neg32.5%
sqrt-unprod0.7%
add-sqr-sqrt1.5%
add-sqr-sqrt0.5%
sqrt-unprod27.7%
sqr-neg27.7%
sqrt-unprod35.0%
add-sqr-sqrt74.4%
Applied egg-rr74.4%
Final simplification78.6%
(FPCore (x y z)
:precision binary64
(if (<= y -1.1e+125)
x
(if (<= y -1.4e+28)
(* x (/ (- z) y))
(if (<= y -5.1e-76)
(* y (/ x y))
(if (<= y 6e-19) (/ (* z (- x)) y) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+125) {
tmp = x;
} else if (y <= -1.4e+28) {
tmp = x * (-z / y);
} else if (y <= -5.1e-76) {
tmp = y * (x / y);
} else if (y <= 6e-19) {
tmp = (z * -x) / y;
} 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+125)) then
tmp = x
else if (y <= (-1.4d+28)) then
tmp = x * (-z / y)
else if (y <= (-5.1d-76)) then
tmp = y * (x / y)
else if (y <= 6d-19) then
tmp = (z * -x) / y
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+125) {
tmp = x;
} else if (y <= -1.4e+28) {
tmp = x * (-z / y);
} else if (y <= -5.1e-76) {
tmp = y * (x / y);
} else if (y <= 6e-19) {
tmp = (z * -x) / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.1e+125: tmp = x elif y <= -1.4e+28: tmp = x * (-z / y) elif y <= -5.1e-76: tmp = y * (x / y) elif y <= 6e-19: tmp = (z * -x) / y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.1e+125) tmp = x; elseif (y <= -1.4e+28) tmp = Float64(x * Float64(Float64(-z) / y)); elseif (y <= -5.1e-76) tmp = Float64(y * Float64(x / y)); elseif (y <= 6e-19) tmp = Float64(Float64(z * Float64(-x)) / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.1e+125) tmp = x; elseif (y <= -1.4e+28) tmp = x * (-z / y); elseif (y <= -5.1e-76) tmp = y * (x / y); elseif (y <= 6e-19) tmp = (z * -x) / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.1e+125], x, If[LessEqual[y, -1.4e+28], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.1e-76], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e-19], N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+125}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{elif}\;y \leq -5.1 \cdot 10^{-76}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-19}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.09999999999999995e125 or 5.99999999999999985e-19 < y Initial program 75.9%
*-commutative75.9%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 82.1%
if -1.09999999999999995e125 < y < -1.4000000000000001e28Initial program 94.0%
associate-*l/80.5%
Simplified80.5%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 62.2%
mul-1-neg62.2%
associate-*r/67.8%
distribute-rgt-neg-in67.8%
distribute-neg-frac67.8%
Simplified67.8%
if -1.4000000000000001e28 < y < -5.09999999999999986e-76Initial program 87.5%
Taylor expanded in y around inf 74.6%
associate-/l*85.2%
associate-/r/89.8%
Applied egg-rr89.8%
if -5.09999999999999986e-76 < y < 5.99999999999999985e-19Initial program 93.5%
Taylor expanded in y around 0 74.9%
associate-*r*74.9%
neg-mul-174.9%
*-commutative74.9%
Simplified74.9%
Final simplification78.8%
(FPCore (x y z) :precision binary64 (if (<= y -3.3e+94) x (if (<= y 6.5e-151) (* y (/ x y)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.3e+94) {
tmp = x;
} else if (y <= 6.5e-151) {
tmp = y * (x / y);
} 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 <= (-3.3d+94)) then
tmp = x
else if (y <= 6.5d-151) then
tmp = y * (x / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.3e+94) {
tmp = x;
} else if (y <= 6.5e-151) {
tmp = y * (x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.3e+94: tmp = x elif y <= 6.5e-151: tmp = y * (x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.3e+94) tmp = x; elseif (y <= 6.5e-151) tmp = Float64(y * Float64(x / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.3e+94) tmp = x; elseif (y <= 6.5e-151) tmp = y * (x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.3e+94], x, If[LessEqual[y, 6.5e-151], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+94}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-151}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.3e94 or 6.4999999999999994e-151 < y Initial program 82.5%
*-commutative82.5%
associate-*l/98.1%
*-commutative98.1%
div-sub98.1%
*-inverses98.1%
Simplified98.1%
Taylor expanded in z around 0 69.9%
if -3.3e94 < y < 6.4999999999999994e-151Initial program 89.6%
Taylor expanded in y around inf 26.3%
associate-/l*31.5%
associate-/r/40.8%
Applied egg-rr40.8%
Final simplification58.8%
(FPCore (x y z) :precision binary64 (* x (- 1.0 (/ z y))))
double code(double x, double y, double z) {
return x * (1.0 - (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 * (1.0d0 - (z / y))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (z / y));
}
def code(x, y, z): return x * (1.0 - (z / y))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(z / y))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (z / y)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{y}\right)
\end{array}
Initial program 85.2%
*-commutative85.2%
associate-*l/97.0%
*-commutative97.0%
div-sub97.0%
*-inverses97.0%
Simplified97.0%
Final simplification97.0%
(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.2%
*-commutative85.2%
associate-*l/97.0%
*-commutative97.0%
div-sub97.0%
*-inverses97.0%
Simplified97.0%
Taylor expanded in z around 0 55.2%
Final simplification55.2%
(FPCore (x y z) :precision binary64 (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - 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 (z < (-2.060202331921739d+104)) then
tmp = x - ((z * x) / y)
else if (z < 1.6939766013828526d+213) then
tmp = x / (y / (y - z))
else
tmp = (y - z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < -2.060202331921739e+104: tmp = x - ((z * x) / y) elif z < 1.6939766013828526e+213: tmp = x / (y / (y - z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z < -2.060202331921739e+104) tmp = Float64(x - Float64(Float64(z * x) / y)); elseif (z < 1.6939766013828526e+213) tmp = Float64(x / Float64(y / Float64(y - z))); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < -2.060202331921739e+104) tmp = x - ((z * x) / y); elseif (z < 1.6939766013828526e+213) tmp = x / (y / (y - z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, -2.060202331921739e+104], N[(x - N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[Less[z, 1.6939766013828526e+213], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < -2.060202331921739 \cdot 10^{+104}:\\
\;\;\;\;x - \frac{z \cdot x}{y}\\
\mathbf{elif}\;z < 1.6939766013828526 \cdot 10^{+213}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
herbie shell --seed 2024024
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))