
(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}
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= x_m 1.9e-45) (- x_m (/ (* x_m z) y)) (* x_m (- 1.0 (/ z y))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 1.9e-45) {
tmp = x_m - ((x_m * z) / y);
} else {
tmp = x_m * (1.0 - (z / y));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 1.9d-45) then
tmp = x_m - ((x_m * z) / y)
else
tmp = x_m * (1.0d0 - (z / y))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 1.9e-45) {
tmp = x_m - ((x_m * z) / y);
} else {
tmp = x_m * (1.0 - (z / y));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if x_m <= 1.9e-45: tmp = x_m - ((x_m * z) / y) else: tmp = x_m * (1.0 - (z / y)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (x_m <= 1.9e-45) tmp = Float64(x_m - Float64(Float64(x_m * z) / y)); else tmp = Float64(x_m * Float64(1.0 - Float64(z / y))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (x_m <= 1.9e-45) tmp = x_m - ((x_m * z) / y); else tmp = x_m * (1.0 - (z / y)); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 1.9e-45], N[(x$95$m - N[(N[(x$95$m * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 1.9 \cdot 10^{-45}:\\
\;\;\;\;x\_m - \frac{x\_m \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(1 - \frac{z}{y}\right)\\
\end{array}
\end{array}
if x < 1.89999999999999999e-45Initial program 87.6%
remove-double-neg87.6%
distribute-frac-neg287.6%
distribute-frac-neg87.6%
distribute-rgt-neg-in87.6%
associate-/l*94.1%
distribute-frac-neg94.1%
distribute-frac-neg294.1%
remove-double-neg94.1%
div-sub94.1%
*-inverses94.1%
Simplified94.1%
Taylor expanded in z around 0 93.4%
associate-*r/93.4%
mul-1-neg93.4%
distribute-rgt-neg-out93.4%
Simplified93.4%
if 1.89999999999999999e-45 < x Initial program 74.9%
remove-double-neg74.9%
distribute-frac-neg274.9%
distribute-frac-neg74.9%
distribute-rgt-neg-in74.9%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Final simplification94.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -2.4e+101) (not (<= z 6.2e+123))) (* x_m (/ (- z) y)) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -2.4e+101) || !(z <= 6.2e+123)) {
tmp = x_m * (-z / y);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-2.4d+101)) .or. (.not. (z <= 6.2d+123))) then
tmp = x_m * (-z / y)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -2.4e+101) || !(z <= 6.2e+123)) {
tmp = x_m * (-z / y);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -2.4e+101) or not (z <= 6.2e+123): tmp = x_m * (-z / y) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -2.4e+101) || !(z <= 6.2e+123)) tmp = Float64(x_m * Float64(Float64(-z) / y)); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -2.4e+101) || ~((z <= 6.2e+123))) tmp = x_m * (-z / y); else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -2.4e+101], N[Not[LessEqual[z, 6.2e+123]], $MachinePrecision]], N[(x$95$m * N[((-z) / y), $MachinePrecision]), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+101} \lor \neg \left(z \leq 6.2 \cdot 10^{+123}\right):\\
\;\;\;\;x\_m \cdot \frac{-z}{y}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -2.39999999999999988e101 or 6.20000000000000013e123 < z Initial program 87.7%
remove-double-neg87.7%
distribute-frac-neg287.7%
distribute-frac-neg87.7%
distribute-rgt-neg-in87.7%
associate-/l*89.9%
distribute-frac-neg89.9%
distribute-frac-neg289.9%
remove-double-neg89.9%
div-sub89.9%
*-inverses89.9%
Simplified89.9%
Taylor expanded in z around inf 82.1%
associate-*l/79.8%
associate-*l*79.8%
*-commutative79.8%
associate-*r/79.8%
mul-1-neg79.8%
Simplified79.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
div-inv79.7%
add-sqr-sqrt29.4%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod0.6%
add-sqr-sqrt1.3%
associate-*r*1.1%
*-commutative1.1%
associate-*l*1.2%
add-sqr-sqrt0.5%
sqrt-unprod19.9%
sqr-neg19.9%
sqrt-unprod30.4%
add-sqr-sqrt76.5%
div-inv76.6%
Applied egg-rr76.6%
if -2.39999999999999988e101 < z < 6.20000000000000013e123Initial program 83.0%
remove-double-neg83.0%
distribute-frac-neg283.0%
distribute-frac-neg83.0%
distribute-rgt-neg-in83.0%
associate-/l*98.3%
distribute-frac-neg98.3%
distribute-frac-neg298.3%
remove-double-neg98.3%
div-sub98.3%
*-inverses98.3%
Simplified98.3%
Taylor expanded in z around 0 75.1%
Final simplification75.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -5.6e+101) (not (<= z 3.5e+123))) (/ x_m (/ y (- z))) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -5.6e+101) || !(z <= 3.5e+123)) {
tmp = x_m / (y / -z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.6d+101)) .or. (.not. (z <= 3.5d+123))) then
tmp = x_m / (y / -z)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -5.6e+101) || !(z <= 3.5e+123)) {
tmp = x_m / (y / -z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -5.6e+101) or not (z <= 3.5e+123): tmp = x_m / (y / -z) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -5.6e+101) || !(z <= 3.5e+123)) tmp = Float64(x_m / Float64(y / Float64(-z))); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -5.6e+101) || ~((z <= 3.5e+123))) tmp = x_m / (y / -z); else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -5.6e+101], N[Not[LessEqual[z, 3.5e+123]], $MachinePrecision]], N[(x$95$m / N[(y / (-z)), $MachinePrecision]), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+101} \lor \neg \left(z \leq 3.5 \cdot 10^{+123}\right):\\
\;\;\;\;\frac{x\_m}{\frac{y}{-z}}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -5.59999999999999962e101 or 3.5e123 < z Initial program 87.7%
remove-double-neg87.7%
distribute-frac-neg287.7%
distribute-frac-neg87.7%
distribute-rgt-neg-in87.7%
associate-/l*89.9%
distribute-frac-neg89.9%
distribute-frac-neg289.9%
remove-double-neg89.9%
div-sub89.9%
*-inverses89.9%
Simplified89.9%
Taylor expanded in z around inf 82.1%
associate-*l/79.8%
associate-*l*79.8%
*-commutative79.8%
associate-*r/79.8%
mul-1-neg79.8%
Simplified79.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
div-inv79.7%
add-sqr-sqrt29.4%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod0.6%
add-sqr-sqrt1.3%
associate-*r*1.1%
*-commutative1.1%
associate-*l*1.2%
add-sqr-sqrt0.5%
sqrt-unprod19.9%
sqr-neg19.9%
sqrt-unprod30.4%
add-sqr-sqrt76.5%
div-inv76.6%
Applied egg-rr76.6%
clear-num76.6%
un-div-inv78.6%
Applied egg-rr78.6%
if -5.59999999999999962e101 < z < 3.5e123Initial program 83.0%
remove-double-neg83.0%
distribute-frac-neg283.0%
distribute-frac-neg83.0%
distribute-rgt-neg-in83.0%
associate-/l*98.3%
distribute-frac-neg98.3%
distribute-frac-neg298.3%
remove-double-neg98.3%
div-sub98.3%
*-inverses98.3%
Simplified98.3%
Taylor expanded in z around 0 75.1%
Final simplification76.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -2.95e+103)
(/ x_m (/ y (- z)))
(if (<= z 3.5e+123) x_m (/ z (/ y (- x_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -2.95e+103) {
tmp = x_m / (y / -z);
} else if (z <= 3.5e+123) {
tmp = x_m;
} else {
tmp = z / (y / -x_m);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.95d+103)) then
tmp = x_m / (y / -z)
else if (z <= 3.5d+123) then
tmp = x_m
else
tmp = z / (y / -x_m)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -2.95e+103) {
tmp = x_m / (y / -z);
} else if (z <= 3.5e+123) {
tmp = x_m;
} else {
tmp = z / (y / -x_m);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -2.95e+103: tmp = x_m / (y / -z) elif z <= 3.5e+123: tmp = x_m else: tmp = z / (y / -x_m) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -2.95e+103) tmp = Float64(x_m / Float64(y / Float64(-z))); elseif (z <= 3.5e+123) tmp = x_m; else tmp = Float64(z / Float64(y / Float64(-x_m))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -2.95e+103) tmp = x_m / (y / -z); elseif (z <= 3.5e+123) tmp = x_m; else tmp = z / (y / -x_m); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -2.95e+103], N[(x$95$m / N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+123], x$95$m, N[(z / N[(y / (-x$95$m)), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.95 \cdot 10^{+103}:\\
\;\;\;\;\frac{x\_m}{\frac{y}{-z}}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+123}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y}{-x\_m}}\\
\end{array}
\end{array}
if z < -2.9499999999999999e103Initial program 85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-frac-neg85.3%
distribute-rgt-neg-in85.3%
associate-/l*97.8%
distribute-frac-neg97.8%
distribute-frac-neg297.8%
remove-double-neg97.8%
div-sub97.8%
*-inverses97.8%
Simplified97.8%
Taylor expanded in z around inf 75.1%
associate-*l/75.1%
associate-*l*75.1%
*-commutative75.1%
associate-*r/75.1%
mul-1-neg75.1%
Simplified75.1%
distribute-frac-neg75.1%
distribute-rgt-neg-out75.1%
div-inv75.1%
add-sqr-sqrt31.0%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod0.8%
add-sqr-sqrt1.5%
associate-*r*1.4%
*-commutative1.4%
associate-*l*1.5%
add-sqr-sqrt0.7%
sqrt-unprod23.2%
sqr-neg23.2%
sqrt-unprod32.9%
add-sqr-sqrt79.1%
div-inv79.3%
Applied egg-rr79.3%
clear-num79.2%
un-div-inv79.3%
Applied egg-rr79.3%
if -2.9499999999999999e103 < z < 3.5e123Initial program 83.0%
remove-double-neg83.0%
distribute-frac-neg283.0%
distribute-frac-neg83.0%
distribute-rgt-neg-in83.0%
associate-/l*98.3%
distribute-frac-neg98.3%
distribute-frac-neg298.3%
remove-double-neg98.3%
div-sub98.3%
*-inverses98.3%
Simplified98.3%
Taylor expanded in z around 0 75.1%
if 3.5e123 < z Initial program 90.5%
remove-double-neg90.5%
distribute-frac-neg290.5%
distribute-frac-neg90.5%
distribute-rgt-neg-in90.5%
associate-/l*80.9%
distribute-frac-neg80.9%
distribute-frac-neg280.9%
remove-double-neg80.9%
div-sub80.9%
*-inverses80.9%
Simplified80.9%
Taylor expanded in z around inf 90.3%
associate-*l/85.3%
associate-*l*85.3%
*-commutative85.3%
associate-*r/85.3%
mul-1-neg85.3%
Simplified85.3%
distribute-frac-neg85.3%
distribute-rgt-neg-out85.3%
div-inv85.1%
add-sqr-sqrt27.6%
sqrt-unprod16.4%
sqr-neg16.4%
sqrt-unprod0.5%
add-sqr-sqrt1.0%
associate-*r*0.9%
*-commutative0.9%
associate-*l*0.8%
add-sqr-sqrt0.4%
sqrt-unprod16.1%
sqr-neg16.1%
sqrt-unprod27.5%
add-sqr-sqrt73.6%
div-inv73.6%
Applied egg-rr73.6%
*-commutative73.6%
associate-/r/83.0%
Applied egg-rr83.0%
Final simplification77.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -3.7e+101)
(/ x_m (/ y (- z)))
(if (<= z 3.7e+123) x_m (* z (/ (- x_m) y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.7e+101) {
tmp = x_m / (y / -z);
} else if (z <= 3.7e+123) {
tmp = x_m;
} else {
tmp = z * (-x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.7d+101)) then
tmp = x_m / (y / -z)
else if (z <= 3.7d+123) then
tmp = x_m
else
tmp = z * (-x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.7e+101) {
tmp = x_m / (y / -z);
} else if (z <= 3.7e+123) {
tmp = x_m;
} else {
tmp = z * (-x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -3.7e+101: tmp = x_m / (y / -z) elif z <= 3.7e+123: tmp = x_m else: tmp = z * (-x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -3.7e+101) tmp = Float64(x_m / Float64(y / Float64(-z))); elseif (z <= 3.7e+123) tmp = x_m; else tmp = Float64(z * Float64(Float64(-x_m) / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -3.7e+101) tmp = x_m / (y / -z); elseif (z <= 3.7e+123) tmp = x_m; else tmp = z * (-x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -3.7e+101], N[(x$95$m / N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+123], x$95$m, N[(z * N[((-x$95$m) / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+101}:\\
\;\;\;\;\frac{x\_m}{\frac{y}{-z}}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+123}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-x\_m}{y}\\
\end{array}
\end{array}
if z < -3.6999999999999997e101Initial program 85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-frac-neg85.3%
distribute-rgt-neg-in85.3%
associate-/l*97.8%
distribute-frac-neg97.8%
distribute-frac-neg297.8%
remove-double-neg97.8%
div-sub97.8%
*-inverses97.8%
Simplified97.8%
Taylor expanded in z around inf 75.1%
associate-*l/75.1%
associate-*l*75.1%
*-commutative75.1%
associate-*r/75.1%
mul-1-neg75.1%
Simplified75.1%
distribute-frac-neg75.1%
distribute-rgt-neg-out75.1%
div-inv75.1%
add-sqr-sqrt31.0%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod0.8%
add-sqr-sqrt1.5%
associate-*r*1.4%
*-commutative1.4%
associate-*l*1.5%
add-sqr-sqrt0.7%
sqrt-unprod23.2%
sqr-neg23.2%
sqrt-unprod32.9%
add-sqr-sqrt79.1%
div-inv79.3%
Applied egg-rr79.3%
clear-num79.2%
un-div-inv79.3%
Applied egg-rr79.3%
if -3.6999999999999997e101 < z < 3.69999999999999996e123Initial program 83.0%
remove-double-neg83.0%
distribute-frac-neg283.0%
distribute-frac-neg83.0%
distribute-rgt-neg-in83.0%
associate-/l*98.3%
distribute-frac-neg98.3%
distribute-frac-neg298.3%
remove-double-neg98.3%
div-sub98.3%
*-inverses98.3%
Simplified98.3%
Taylor expanded in z around 0 75.1%
if 3.69999999999999996e123 < z Initial program 90.5%
remove-double-neg90.5%
distribute-frac-neg290.5%
distribute-frac-neg90.5%
distribute-rgt-neg-in90.5%
associate-/l*80.9%
distribute-frac-neg80.9%
distribute-frac-neg280.9%
remove-double-neg80.9%
div-sub80.9%
*-inverses80.9%
Simplified80.9%
Taylor expanded in z around inf 90.3%
associate-*l/85.3%
associate-*l*85.3%
*-commutative85.3%
associate-*r/85.3%
mul-1-neg85.3%
Simplified85.3%
Final simplification77.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -2.6e+101)
(/ x_m (/ y (- z)))
(if (<= z 3.5e+123) x_m (/ (* x_m (- z)) y)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -2.6e+101) {
tmp = x_m / (y / -z);
} else if (z <= 3.5e+123) {
tmp = x_m;
} else {
tmp = (x_m * -z) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.6d+101)) then
tmp = x_m / (y / -z)
else if (z <= 3.5d+123) then
tmp = x_m
else
tmp = (x_m * -z) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -2.6e+101) {
tmp = x_m / (y / -z);
} else if (z <= 3.5e+123) {
tmp = x_m;
} else {
tmp = (x_m * -z) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -2.6e+101: tmp = x_m / (y / -z) elif z <= 3.5e+123: tmp = x_m else: tmp = (x_m * -z) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -2.6e+101) tmp = Float64(x_m / Float64(y / Float64(-z))); elseif (z <= 3.5e+123) tmp = x_m; else tmp = Float64(Float64(x_m * Float64(-z)) / y); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -2.6e+101) tmp = x_m / (y / -z); elseif (z <= 3.5e+123) tmp = x_m; else tmp = (x_m * -z) / y; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -2.6e+101], N[(x$95$m / N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+123], x$95$m, N[(N[(x$95$m * (-z)), $MachinePrecision] / y), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+101}:\\
\;\;\;\;\frac{x\_m}{\frac{y}{-z}}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+123}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(-z\right)}{y}\\
\end{array}
\end{array}
if z < -2.6e101Initial program 85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-frac-neg85.3%
distribute-rgt-neg-in85.3%
associate-/l*97.8%
distribute-frac-neg97.8%
distribute-frac-neg297.8%
remove-double-neg97.8%
div-sub97.8%
*-inverses97.8%
Simplified97.8%
Taylor expanded in z around inf 75.1%
associate-*l/75.1%
associate-*l*75.1%
*-commutative75.1%
associate-*r/75.1%
mul-1-neg75.1%
Simplified75.1%
distribute-frac-neg75.1%
distribute-rgt-neg-out75.1%
div-inv75.1%
add-sqr-sqrt31.0%
sqrt-unprod23.4%
sqr-neg23.4%
sqrt-unprod0.8%
add-sqr-sqrt1.5%
associate-*r*1.4%
*-commutative1.4%
associate-*l*1.5%
add-sqr-sqrt0.7%
sqrt-unprod23.2%
sqr-neg23.2%
sqrt-unprod32.9%
add-sqr-sqrt79.1%
div-inv79.3%
Applied egg-rr79.3%
clear-num79.2%
un-div-inv79.3%
Applied egg-rr79.3%
if -2.6e101 < z < 3.5e123Initial program 83.0%
remove-double-neg83.0%
distribute-frac-neg283.0%
distribute-frac-neg83.0%
distribute-rgt-neg-in83.0%
associate-/l*98.3%
distribute-frac-neg98.3%
distribute-frac-neg298.3%
remove-double-neg98.3%
div-sub98.3%
*-inverses98.3%
Simplified98.3%
Taylor expanded in z around 0 75.1%
if 3.5e123 < z Initial program 90.5%
Taylor expanded in y around 0 90.3%
associate-*r*90.3%
*-commutative90.3%
mul-1-neg90.3%
Simplified90.3%
Final simplification78.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 1.6e+180) (* x_m (- 1.0 (/ z y))) (/ (* x_m (- z)) y))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 1.6e+180) {
tmp = x_m * (1.0 - (z / y));
} else {
tmp = (x_m * -z) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.6d+180) then
tmp = x_m * (1.0d0 - (z / y))
else
tmp = (x_m * -z) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 1.6e+180) {
tmp = x_m * (1.0 - (z / y));
} else {
tmp = (x_m * -z) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= 1.6e+180: tmp = x_m * (1.0 - (z / y)) else: tmp = (x_m * -z) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 1.6e+180) tmp = Float64(x_m * Float64(1.0 - Float64(z / y))); else tmp = Float64(Float64(x_m * Float64(-z)) / y); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= 1.6e+180) tmp = x_m * (1.0 - (z / y)); else tmp = (x_m * -z) / y; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 1.6e+180], N[(x$95$m * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * (-z)), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.6 \cdot 10^{+180}:\\
\;\;\;\;x\_m \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(-z\right)}{y}\\
\end{array}
\end{array}
if z < 1.59999999999999997e180Initial program 83.2%
remove-double-neg83.2%
distribute-frac-neg283.2%
distribute-frac-neg83.2%
distribute-rgt-neg-in83.2%
associate-/l*97.8%
distribute-frac-neg97.8%
distribute-frac-neg297.8%
remove-double-neg97.8%
div-sub97.9%
*-inverses97.9%
Simplified97.9%
if 1.59999999999999997e180 < z Initial program 96.5%
Taylor expanded in y around 0 96.3%
associate-*r*96.3%
*-commutative96.3%
mul-1-neg96.3%
Simplified96.3%
Final simplification97.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 9.6e+179) (* x_m (- 1.0 (/ z y))) (/ (* x_m (- y z)) y))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 9.6e+179) {
tmp = x_m * (1.0 - (z / y));
} else {
tmp = (x_m * (y - z)) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 9.6d+179) then
tmp = x_m * (1.0d0 - (z / y))
else
tmp = (x_m * (y - z)) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 9.6e+179) {
tmp = x_m * (1.0 - (z / y));
} else {
tmp = (x_m * (y - z)) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= 9.6e+179: tmp = x_m * (1.0 - (z / y)) else: tmp = (x_m * (y - z)) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 9.6e+179) tmp = Float64(x_m * Float64(1.0 - Float64(z / y))); else tmp = Float64(Float64(x_m * Float64(y - z)) / y); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= 9.6e+179) tmp = x_m * (1.0 - (z / y)); else tmp = (x_m * (y - z)) / y; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 9.6e+179], N[(x$95$m * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 9.6 \cdot 10^{+179}:\\
\;\;\;\;x\_m \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{y}\\
\end{array}
\end{array}
if z < 9.6000000000000005e179Initial program 83.2%
remove-double-neg83.2%
distribute-frac-neg283.2%
distribute-frac-neg83.2%
distribute-rgt-neg-in83.2%
associate-/l*97.8%
distribute-frac-neg97.8%
distribute-frac-neg297.8%
remove-double-neg97.8%
div-sub97.9%
*-inverses97.9%
Simplified97.9%
if 9.6000000000000005e179 < z Initial program 96.5%
Final simplification97.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * x_m) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * x_m; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot x\_m
\end{array}
Initial program 84.6%
remove-double-neg84.6%
distribute-frac-neg284.6%
distribute-frac-neg84.6%
distribute-rgt-neg-in84.6%
associate-/l*95.5%
distribute-frac-neg95.5%
distribute-frac-neg295.5%
remove-double-neg95.5%
div-sub95.5%
*-inverses95.5%
Simplified95.5%
Taylor expanded in z around 0 55.4%
Final simplification55.4%
(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 2024076
(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))