
(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 9 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 (/ x (/ y z))))
double code(double x, double y, double z) {
return x - (x / (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 - (x / (y / z))
end function
public static double code(double x, double y, double z) {
return x - (x / (y / z));
}
def code(x, y, z): return x - (x / (y / z))
function code(x, y, z) return Float64(x - Float64(x / Float64(y / z))) end
function tmp = code(x, y, z) tmp = x - (x / (y / z)); end
code[x_, y_, z_] := N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{x}{\frac{y}{z}}
\end{array}
Initial program 84.3%
remove-double-neg84.3%
distribute-frac-neg284.3%
distribute-frac-neg84.3%
distribute-rgt-neg-in84.3%
associate-/l*97.7%
distribute-frac-neg97.7%
distribute-frac-neg297.7%
remove-double-neg97.7%
div-sub97.7%
*-inverses97.7%
Simplified97.7%
sub-neg97.7%
distribute-rgt-in97.7%
*-un-lft-identity97.7%
distribute-neg-frac297.7%
Applied egg-rr97.7%
*-commutative97.7%
add-sqr-sqrt45.6%
sqrt-unprod54.6%
sqr-neg54.6%
sqrt-unprod27.0%
add-sqr-sqrt50.5%
cancel-sign-sub-inv50.5%
associate-*r/48.2%
add-sqr-sqrt21.5%
sqrt-unprod62.9%
sqr-neg62.9%
sqrt-unprod47.8%
add-sqr-sqrt94.2%
*-commutative94.2%
Applied egg-rr94.2%
Taylor expanded in z around 0 94.2%
associate-*l/91.6%
associate-/r/97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z)
:precision binary64
(if (or (<= z -3e+138)
(not (or (<= z 7.5e-6) (and (not (<= z 6.9e+55)) (<= z 2.35e+91)))))
(* (/ z y) (- x))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3e+138) || !((z <= 7.5e-6) || (!(z <= 6.9e+55) && (z <= 2.35e+91)))) {
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 ((z <= (-3d+138)) .or. (.not. (z <= 7.5d-6) .or. (.not. (z <= 6.9d+55)) .and. (z <= 2.35d+91))) 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 ((z <= -3e+138) || !((z <= 7.5e-6) || (!(z <= 6.9e+55) && (z <= 2.35e+91)))) {
tmp = (z / y) * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3e+138) or not ((z <= 7.5e-6) or (not (z <= 6.9e+55) and (z <= 2.35e+91))): tmp = (z / y) * -x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3e+138) || !((z <= 7.5e-6) || (!(z <= 6.9e+55) && (z <= 2.35e+91)))) tmp = Float64(Float64(z / y) * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3e+138) || ~(((z <= 7.5e-6) || (~((z <= 6.9e+55)) && (z <= 2.35e+91))))) tmp = (z / y) * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3e+138], N[Not[Or[LessEqual[z, 7.5e-6], And[N[Not[LessEqual[z, 6.9e+55]], $MachinePrecision], LessEqual[z, 2.35e+91]]]], $MachinePrecision]], N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+138} \lor \neg \left(z \leq 7.5 \cdot 10^{-6} \lor \neg \left(z \leq 6.9 \cdot 10^{+55}\right) \land z \leq 2.35 \cdot 10^{+91}\right):\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.0000000000000001e138 or 7.50000000000000019e-6 < z < 6.9000000000000004e55 or 2.3499999999999999e91 < z Initial program 87.0%
remove-double-neg87.0%
distribute-frac-neg287.0%
distribute-frac-neg87.0%
distribute-rgt-neg-in87.0%
associate-/l*94.3%
distribute-frac-neg94.3%
distribute-frac-neg294.3%
remove-double-neg94.3%
div-sub94.3%
*-inverses94.3%
Simplified94.3%
Taylor expanded in z around inf 80.0%
mul-1-neg80.0%
distribute-frac-neg280.0%
Simplified80.0%
if -3.0000000000000001e138 < z < 7.50000000000000019e-6 or 6.9000000000000004e55 < z < 2.3499999999999999e91Initial program 82.4%
remove-double-neg82.4%
distribute-frac-neg282.4%
distribute-frac-neg82.4%
distribute-rgt-neg-in82.4%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 75.9%
Final simplification77.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) (- x))))
(if (<= z -3.5e+140)
t_0
(if (<= z 1.1e-5)
x
(if (<= z 6.8e+59) (* (- z) (/ x y)) (if (<= z 4.9e+91) x t_0))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -x;
double tmp;
if (z <= -3.5e+140) {
tmp = t_0;
} else if (z <= 1.1e-5) {
tmp = x;
} else if (z <= 6.8e+59) {
tmp = -z * (x / y);
} else if (z <= 4.9e+91) {
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 = (z / y) * -x
if (z <= (-3.5d+140)) then
tmp = t_0
else if (z <= 1.1d-5) then
tmp = x
else if (z <= 6.8d+59) then
tmp = -z * (x / y)
else if (z <= 4.9d+91) 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 = (z / y) * -x;
double tmp;
if (z <= -3.5e+140) {
tmp = t_0;
} else if (z <= 1.1e-5) {
tmp = x;
} else if (z <= 6.8e+59) {
tmp = -z * (x / y);
} else if (z <= 4.9e+91) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -x tmp = 0 if z <= -3.5e+140: tmp = t_0 elif z <= 1.1e-5: tmp = x elif z <= 6.8e+59: tmp = -z * (x / y) elif z <= 4.9e+91: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * Float64(-x)) tmp = 0.0 if (z <= -3.5e+140) tmp = t_0; elseif (z <= 1.1e-5) tmp = x; elseif (z <= 6.8e+59) tmp = Float64(Float64(-z) * Float64(x / y)); elseif (z <= 4.9e+91) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -x; tmp = 0.0; if (z <= -3.5e+140) tmp = t_0; elseif (z <= 1.1e-5) tmp = x; elseif (z <= 6.8e+59) tmp = -z * (x / y); elseif (z <= 4.9e+91) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision]}, If[LessEqual[z, -3.5e+140], t$95$0, If[LessEqual[z, 1.1e-5], x, If[LessEqual[z, 6.8e+59], N[((-z) * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+91], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot \left(-x\right)\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+140}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+59}:\\
\;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+91}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.49999999999999989e140 or 4.9000000000000003e91 < z Initial program 86.8%
remove-double-neg86.8%
distribute-frac-neg286.8%
distribute-frac-neg86.8%
distribute-rgt-neg-in86.8%
associate-/l*93.8%
distribute-frac-neg93.8%
distribute-frac-neg293.8%
remove-double-neg93.8%
div-sub93.9%
*-inverses93.9%
Simplified93.9%
Taylor expanded in z around inf 80.1%
mul-1-neg80.1%
distribute-frac-neg280.1%
Simplified80.1%
if -3.49999999999999989e140 < z < 1.1e-5 or 6.80000000000000012e59 < z < 4.9000000000000003e91Initial program 82.4%
remove-double-neg82.4%
distribute-frac-neg282.4%
distribute-frac-neg82.4%
distribute-rgt-neg-in82.4%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 75.9%
if 1.1e-5 < z < 6.80000000000000012e59Initial program 89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
distribute-frac-neg89.9%
distribute-rgt-neg-in89.9%
associate-/l*99.5%
distribute-frac-neg99.5%
distribute-frac-neg299.5%
remove-double-neg99.5%
div-sub99.5%
*-inverses99.5%
Simplified99.5%
Taylor expanded in z around inf 79.3%
associate-*l/78.7%
associate-*l*78.7%
*-commutative78.7%
associate-*r/78.7%
mul-1-neg78.7%
Simplified78.7%
Final simplification77.5%
(FPCore (x y z)
:precision binary64
(if (<= z -3.4e+138)
(/ x (/ y (- z)))
(if (<= z 8.5e-6)
x
(if (<= z 5.2e+60)
(* (- z) (/ x y))
(if (<= z 3e+91) x (* (/ z y) (- x)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.4e+138) {
tmp = x / (y / -z);
} else if (z <= 8.5e-6) {
tmp = x;
} else if (z <= 5.2e+60) {
tmp = -z * (x / y);
} else if (z <= 3e+91) {
tmp = 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 (z <= (-3.4d+138)) then
tmp = x / (y / -z)
else if (z <= 8.5d-6) then
tmp = x
else if (z <= 5.2d+60) then
tmp = -z * (x / y)
else if (z <= 3d+91) then
tmp = 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 (z <= -3.4e+138) {
tmp = x / (y / -z);
} else if (z <= 8.5e-6) {
tmp = x;
} else if (z <= 5.2e+60) {
tmp = -z * (x / y);
} else if (z <= 3e+91) {
tmp = x;
} else {
tmp = (z / y) * -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.4e+138: tmp = x / (y / -z) elif z <= 8.5e-6: tmp = x elif z <= 5.2e+60: tmp = -z * (x / y) elif z <= 3e+91: tmp = x else: tmp = (z / y) * -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.4e+138) tmp = Float64(x / Float64(y / Float64(-z))); elseif (z <= 8.5e-6) tmp = x; elseif (z <= 5.2e+60) tmp = Float64(Float64(-z) * Float64(x / y)); elseif (z <= 3e+91) tmp = x; else tmp = Float64(Float64(z / y) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.4e+138) tmp = x / (y / -z); elseif (z <= 8.5e-6) tmp = x; elseif (z <= 5.2e+60) tmp = -z * (x / y); elseif (z <= 3e+91) tmp = x; else tmp = (z / y) * -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.4e+138], N[(x / N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-6], x, If[LessEqual[z, 5.2e+60], N[((-z) * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+91], x, N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+138}:\\
\;\;\;\;\frac{x}{\frac{y}{-z}}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+60}:\\
\;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+91}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -3.40000000000000011e138Initial program 88.6%
remove-double-neg88.6%
distribute-frac-neg288.6%
distribute-frac-neg88.6%
distribute-rgt-neg-in88.6%
associate-/l*93.2%
distribute-frac-neg93.2%
distribute-frac-neg293.2%
remove-double-neg93.2%
div-sub93.2%
*-inverses93.2%
Simplified93.2%
Taylor expanded in z around inf 81.7%
associate-*l/80.0%
associate-*l*80.0%
*-commutative80.0%
associate-*r/80.0%
mul-1-neg80.0%
Simplified80.0%
*-commutative80.0%
associate-/r/83.9%
frac-2neg83.9%
remove-double-neg83.9%
distribute-neg-frac283.9%
Applied egg-rr83.9%
if -3.40000000000000011e138 < z < 8.4999999999999999e-6 or 5.20000000000000016e60 < z < 3.00000000000000006e91Initial program 82.4%
remove-double-neg82.4%
distribute-frac-neg282.4%
distribute-frac-neg82.4%
distribute-rgt-neg-in82.4%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 75.9%
if 8.4999999999999999e-6 < z < 5.20000000000000016e60Initial program 89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
distribute-frac-neg89.9%
distribute-rgt-neg-in89.9%
associate-/l*99.5%
distribute-frac-neg99.5%
distribute-frac-neg299.5%
remove-double-neg99.5%
div-sub99.5%
*-inverses99.5%
Simplified99.5%
Taylor expanded in z around inf 79.3%
associate-*l/78.7%
associate-*l*78.7%
*-commutative78.7%
associate-*r/78.7%
mul-1-neg78.7%
Simplified78.7%
if 3.00000000000000006e91 < z Initial program 85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-frac-neg85.3%
distribute-rgt-neg-in85.3%
associate-/l*94.4%
distribute-frac-neg94.4%
distribute-frac-neg294.4%
remove-double-neg94.4%
div-sub94.4%
*-inverses94.4%
Simplified94.4%
Taylor expanded in z around inf 78.0%
mul-1-neg78.0%
distribute-frac-neg278.0%
Simplified78.0%
Final simplification77.7%
(FPCore (x y z)
:precision binary64
(if (<= z -3e+138)
(/ x (/ y (- z)))
(if (<= z 1.02e-5)
x
(if (<= z 3.9e+55)
(/ (* x (- z)) y)
(if (<= z 2.2e+91) x (* (/ z y) (- x)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3e+138) {
tmp = x / (y / -z);
} else if (z <= 1.02e-5) {
tmp = x;
} else if (z <= 3.9e+55) {
tmp = (x * -z) / y;
} else if (z <= 2.2e+91) {
tmp = 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 (z <= (-3d+138)) then
tmp = x / (y / -z)
else if (z <= 1.02d-5) then
tmp = x
else if (z <= 3.9d+55) then
tmp = (x * -z) / y
else if (z <= 2.2d+91) then
tmp = 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 (z <= -3e+138) {
tmp = x / (y / -z);
} else if (z <= 1.02e-5) {
tmp = x;
} else if (z <= 3.9e+55) {
tmp = (x * -z) / y;
} else if (z <= 2.2e+91) {
tmp = x;
} else {
tmp = (z / y) * -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3e+138: tmp = x / (y / -z) elif z <= 1.02e-5: tmp = x elif z <= 3.9e+55: tmp = (x * -z) / y elif z <= 2.2e+91: tmp = x else: tmp = (z / y) * -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3e+138) tmp = Float64(x / Float64(y / Float64(-z))); elseif (z <= 1.02e-5) tmp = x; elseif (z <= 3.9e+55) tmp = Float64(Float64(x * Float64(-z)) / y); elseif (z <= 2.2e+91) tmp = x; else tmp = Float64(Float64(z / y) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3e+138) tmp = x / (y / -z); elseif (z <= 1.02e-5) tmp = x; elseif (z <= 3.9e+55) tmp = (x * -z) / y; elseif (z <= 2.2e+91) tmp = x; else tmp = (z / y) * -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3e+138], N[(x / N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-5], x, If[LessEqual[z, 3.9e+55], N[(N[(x * (-z)), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 2.2e+91], x, N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+138}:\\
\;\;\;\;\frac{x}{\frac{y}{-z}}\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+55}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{y}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+91}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -3.0000000000000001e138Initial program 88.6%
remove-double-neg88.6%
distribute-frac-neg288.6%
distribute-frac-neg88.6%
distribute-rgt-neg-in88.6%
associate-/l*93.2%
distribute-frac-neg93.2%
distribute-frac-neg293.2%
remove-double-neg93.2%
div-sub93.2%
*-inverses93.2%
Simplified93.2%
Taylor expanded in z around inf 81.7%
associate-*l/80.0%
associate-*l*80.0%
*-commutative80.0%
associate-*r/80.0%
mul-1-neg80.0%
Simplified80.0%
*-commutative80.0%
associate-/r/83.9%
frac-2neg83.9%
remove-double-neg83.9%
distribute-neg-frac283.9%
Applied egg-rr83.9%
if -3.0000000000000001e138 < z < 1.0200000000000001e-5 or 3.90000000000000027e55 < z < 2.19999999999999999e91Initial program 82.4%
remove-double-neg82.4%
distribute-frac-neg282.4%
distribute-frac-neg82.4%
distribute-rgt-neg-in82.4%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 75.9%
if 1.0200000000000001e-5 < z < 3.90000000000000027e55Initial program 89.9%
Taylor expanded in y around 0 79.3%
associate-*r*79.3%
mul-1-neg79.3%
Simplified79.3%
if 2.19999999999999999e91 < z Initial program 85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-frac-neg85.3%
distribute-rgt-neg-in85.3%
associate-/l*94.4%
distribute-frac-neg94.4%
distribute-frac-neg294.4%
remove-double-neg94.4%
div-sub94.4%
*-inverses94.4%
Simplified94.4%
Taylor expanded in z around inf 78.0%
mul-1-neg78.0%
distribute-frac-neg278.0%
Simplified78.0%
Final simplification77.8%
(FPCore (x y z) :precision binary64 (if (<= x 4e+84) x (* y (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4e+84) {
tmp = x;
} else {
tmp = y * (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 (x <= 4d+84) then
tmp = x
else
tmp = y * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4e+84) {
tmp = x;
} else {
tmp = y * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4e+84: tmp = x else: tmp = y * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4e+84) tmp = x; else tmp = Float64(y * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4e+84) tmp = x; else tmp = y * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4e+84], x, N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+84}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < 4.00000000000000023e84Initial program 86.1%
remove-double-neg86.1%
distribute-frac-neg286.1%
distribute-frac-neg86.1%
distribute-rgt-neg-in86.1%
associate-/l*97.3%
distribute-frac-neg97.3%
distribute-frac-neg297.3%
remove-double-neg97.3%
div-sub97.3%
*-inverses97.3%
Simplified97.3%
Taylor expanded in z around 0 50.4%
if 4.00000000000000023e84 < x Initial program 74.4%
Taylor expanded in y around inf 38.0%
*-commutative38.0%
associate-/l*66.1%
Applied egg-rr66.1%
Final simplification52.8%
(FPCore (x y z) :precision binary64 (if (<= x 3.9e+90) x (/ (* x z) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 3.9e+90) {
tmp = x;
} else {
tmp = (x * z) / 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 <= 3.9d+90) then
tmp = x
else
tmp = (x * z) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 3.9e+90) {
tmp = x;
} else {
tmp = (x * z) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 3.9e+90: tmp = x else: tmp = (x * z) / z return tmp
function code(x, y, z) tmp = 0.0 if (x <= 3.9e+90) tmp = x; else tmp = Float64(Float64(x * z) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 3.9e+90) tmp = x; else tmp = (x * z) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 3.9e+90], x, N[(N[(x * z), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.9 \cdot 10^{+90}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z}{z}\\
\end{array}
\end{array}
if x < 3.9000000000000002e90Initial program 85.8%
remove-double-neg85.8%
distribute-frac-neg285.8%
distribute-frac-neg85.8%
distribute-rgt-neg-in85.8%
associate-/l*97.3%
distribute-frac-neg97.3%
distribute-frac-neg297.3%
remove-double-neg97.3%
div-sub97.3%
*-inverses97.3%
Simplified97.3%
Taylor expanded in z around 0 50.8%
if 3.9000000000000002e90 < x Initial program 75.6%
remove-double-neg75.6%
distribute-frac-neg275.6%
distribute-frac-neg75.6%
distribute-rgt-neg-in75.6%
associate-/l*100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in z around inf 73.2%
+-commutative73.2%
mul-1-neg73.2%
unsub-neg73.2%
Simplified73.2%
Taylor expanded in z around 0 32.6%
associate-*r/61.7%
*-commutative61.7%
Applied egg-rr61.7%
Final simplification52.5%
(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 84.3%
remove-double-neg84.3%
distribute-frac-neg284.3%
distribute-frac-neg84.3%
distribute-rgt-neg-in84.3%
associate-/l*97.7%
distribute-frac-neg97.7%
distribute-frac-neg297.7%
remove-double-neg97.7%
div-sub97.7%
*-inverses97.7%
Simplified97.7%
Final simplification97.7%
(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 84.3%
remove-double-neg84.3%
distribute-frac-neg284.3%
distribute-frac-neg84.3%
distribute-rgt-neg-in84.3%
associate-/l*97.7%
distribute-frac-neg97.7%
distribute-frac-neg297.7%
remove-double-neg97.7%
div-sub97.7%
*-inverses97.7%
Simplified97.7%
Taylor expanded in z around 0 51.7%
Final simplification51.7%
(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 2024080
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:alt
(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))