
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(let* ((t_1 (sqrt (* x_m 2.0))))
(*
z_s
(*
x_s
(if (<= z_m 1.5e-133)
(/ (* x_m 2.0) (* z_m (- y t)))
(* (/ t_1 (- y t)) (/ t_1 z_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double t_1 = sqrt((x_m * 2.0));
double tmp;
if (z_m <= 1.5e-133) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (t_1 / (y - t)) * (t_1 / z_m);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x_m * 2.0d0))
if (z_m <= 1.5d-133) then
tmp = (x_m * 2.0d0) / (z_m * (y - t))
else
tmp = (t_1 / (y - t)) * (t_1 / z_m)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double t_1 = Math.sqrt((x_m * 2.0));
double tmp;
if (z_m <= 1.5e-133) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (t_1 / (y - t)) * (t_1 / z_m);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): t_1 = math.sqrt((x_m * 2.0)) tmp = 0 if z_m <= 1.5e-133: tmp = (x_m * 2.0) / (z_m * (y - t)) else: tmp = (t_1 / (y - t)) * (t_1 / z_m) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) t_1 = sqrt(Float64(x_m * 2.0)) tmp = 0.0 if (z_m <= 1.5e-133) tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(t_1 / Float64(y - t)) * Float64(t_1 / z_m)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) t_1 = sqrt((x_m * 2.0)); tmp = 0.0; if (z_m <= 1.5e-133) tmp = (x_m * 2.0) / (z_m * (y - t)); else tmp = (t_1 / (y - t)) * (t_1 / z_m); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := Block[{t$95$1 = N[Sqrt[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision]}, N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 1.5e-133], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_1 := \sqrt{x\_m \cdot 2}\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.5 \cdot 10^{-133}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{y - t} \cdot \frac{t\_1}{z\_m}\\
\end{array}\right)
\end{array}
\end{array}
if z < 1.5000000000000001e-133Initial program 90.1%
distribute-rgt-out--93.0%
Simplified93.0%
if 1.5000000000000001e-133 < z Initial program 88.1%
distribute-rgt-out--88.2%
Simplified88.2%
add-sqr-sqrt51.6%
*-commutative51.6%
times-frac53.9%
Applied egg-rr53.9%
Final simplification80.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -4.5e-72)
(/ (/ x_m y) (* z_m 0.5))
(if (<= y -1.8e-100)
(* x_m (/ -2.0 (* z_m t)))
(if (<= y -8.5e-115)
(* (/ x_m z_m) (/ 2.0 y))
(if (<= y 1.75e-269)
(/ (/ 2.0 z_m) (/ (- t) x_m))
(if (<= y 7.2e-22)
(* -2.0 (/ x_m (* z_m t)))
(/ (/ x_m (* z_m 0.5)) y)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -4.5e-72) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= -1.8e-100) {
tmp = x_m * (-2.0 / (z_m * t));
} else if (y <= -8.5e-115) {
tmp = (x_m / z_m) * (2.0 / y);
} else if (y <= 1.75e-269) {
tmp = (2.0 / z_m) / (-t / x_m);
} else if (y <= 7.2e-22) {
tmp = -2.0 * (x_m / (z_m * t));
} else {
tmp = (x_m / (z_m * 0.5)) / y;
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-4.5d-72)) then
tmp = (x_m / y) / (z_m * 0.5d0)
else if (y <= (-1.8d-100)) then
tmp = x_m * ((-2.0d0) / (z_m * t))
else if (y <= (-8.5d-115)) then
tmp = (x_m / z_m) * (2.0d0 / y)
else if (y <= 1.75d-269) then
tmp = (2.0d0 / z_m) / (-t / x_m)
else if (y <= 7.2d-22) then
tmp = (-2.0d0) * (x_m / (z_m * t))
else
tmp = (x_m / (z_m * 0.5d0)) / y
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -4.5e-72) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= -1.8e-100) {
tmp = x_m * (-2.0 / (z_m * t));
} else if (y <= -8.5e-115) {
tmp = (x_m / z_m) * (2.0 / y);
} else if (y <= 1.75e-269) {
tmp = (2.0 / z_m) / (-t / x_m);
} else if (y <= 7.2e-22) {
tmp = -2.0 * (x_m / (z_m * t));
} else {
tmp = (x_m / (z_m * 0.5)) / y;
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -4.5e-72: tmp = (x_m / y) / (z_m * 0.5) elif y <= -1.8e-100: tmp = x_m * (-2.0 / (z_m * t)) elif y <= -8.5e-115: tmp = (x_m / z_m) * (2.0 / y) elif y <= 1.75e-269: tmp = (2.0 / z_m) / (-t / x_m) elif y <= 7.2e-22: tmp = -2.0 * (x_m / (z_m * t)) else: tmp = (x_m / (z_m * 0.5)) / y return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -4.5e-72) tmp = Float64(Float64(x_m / y) / Float64(z_m * 0.5)); elseif (y <= -1.8e-100) tmp = Float64(x_m * Float64(-2.0 / Float64(z_m * t))); elseif (y <= -8.5e-115) tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); elseif (y <= 1.75e-269) tmp = Float64(Float64(2.0 / z_m) / Float64(Float64(-t) / x_m)); elseif (y <= 7.2e-22) tmp = Float64(-2.0 * Float64(x_m / Float64(z_m * t))); else tmp = Float64(Float64(x_m / Float64(z_m * 0.5)) / y); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -4.5e-72) tmp = (x_m / y) / (z_m * 0.5); elseif (y <= -1.8e-100) tmp = x_m * (-2.0 / (z_m * t)); elseif (y <= -8.5e-115) tmp = (x_m / z_m) * (2.0 / y); elseif (y <= 1.75e-269) tmp = (2.0 / z_m) / (-t / x_m); elseif (y <= 7.2e-22) tmp = -2.0 * (x_m / (z_m * t)); else tmp = (x_m / (z_m * 0.5)) / y; end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -4.5e-72], N[(N[(x$95$m / y), $MachinePrecision] / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.8e-100], N[(x$95$m * N[(-2.0 / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.5e-115], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e-269], N[(N[(2.0 / z$95$m), $MachinePrecision] / N[((-t) / x$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-22], N[(-2.0 * N[(x$95$m / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-72}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z\_m \cdot 0.5}\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-100}:\\
\;\;\;\;x\_m \cdot \frac{-2}{z\_m \cdot t}\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-115}:\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{2}{z\_m}}{\frac{-t}{x\_m}}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-22}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{z\_m \cdot 0.5}}{y}\\
\end{array}\right)
\end{array}
if y < -4.5e-72Initial program 88.0%
distribute-rgt-out--88.1%
Simplified88.1%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
*-commutative73.8%
times-frac78.2%
Applied egg-rr78.2%
clear-num78.2%
un-div-inv78.2%
div-inv78.2%
metadata-eval78.2%
Applied egg-rr78.2%
if -4.5e-72 < y < -1.7999999999999999e-100Initial program 99.4%
distribute-rgt-out--99.4%
Simplified99.4%
Taylor expanded in y around 0 88.2%
associate-*r/88.2%
*-commutative88.2%
*-commutative88.2%
associate-/l*88.5%
Simplified88.5%
if -1.7999999999999999e-100 < y < -8.49999999999999953e-115Initial program 99.5%
distribute-rgt-out--99.5%
Simplified99.5%
Taylor expanded in y around inf 99.5%
*-commutative99.5%
Simplified99.5%
times-frac100.0%
Applied egg-rr100.0%
if -8.49999999999999953e-115 < y < 1.75000000000000009e-269Initial program 83.8%
distribute-rgt-out--89.6%
Simplified89.6%
add-sqr-sqrt47.0%
*-commutative47.0%
times-frac53.4%
Applied egg-rr53.4%
frac-times47.0%
add-sqr-sqrt89.6%
frac-times95.9%
*-commutative95.9%
clear-num96.0%
un-div-inv96.0%
Applied egg-rr96.0%
Taylor expanded in y around 0 90.3%
neg-mul-190.3%
distribute-neg-frac290.3%
Simplified90.3%
if 1.75000000000000009e-269 < y < 7.1999999999999996e-22Initial program 97.5%
distribute-rgt-out--97.5%
Simplified97.5%
Taylor expanded in y around 0 84.6%
*-commutative84.6%
Simplified84.6%
if 7.1999999999999996e-22 < y Initial program 89.1%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around inf 77.6%
*-commutative77.6%
Simplified77.6%
*-commutative77.6%
times-frac75.4%
Applied egg-rr75.4%
associate-*l/78.4%
clear-num78.4%
un-div-inv78.5%
div-inv78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Final simplification82.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (or (<= y -3.15e-71) (not (<= y 1.1e-22)))
(* x_m (/ (/ 2.0 z_m) y))
(* -2.0 (/ x_m (* z_m t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -3.15e-71) || !(y <= 1.1e-22)) {
tmp = x_m * ((2.0 / z_m) / y);
} else {
tmp = -2.0 * (x_m / (z_m * t));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.15d-71)) .or. (.not. (y <= 1.1d-22))) then
tmp = x_m * ((2.0d0 / z_m) / y)
else
tmp = (-2.0d0) * (x_m / (z_m * t))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((y <= -3.15e-71) || !(y <= 1.1e-22)) {
tmp = x_m * ((2.0 / z_m) / y);
} else {
tmp = -2.0 * (x_m / (z_m * t));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (y <= -3.15e-71) or not (y <= 1.1e-22): tmp = x_m * ((2.0 / z_m) / y) else: tmp = -2.0 * (x_m / (z_m * t)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if ((y <= -3.15e-71) || !(y <= 1.1e-22)) tmp = Float64(x_m * Float64(Float64(2.0 / z_m) / y)); else tmp = Float64(-2.0 * Float64(x_m / Float64(z_m * t))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((y <= -3.15e-71) || ~((y <= 1.1e-22))) tmp = x_m * ((2.0 / z_m) / y); else tmp = -2.0 * (x_m / (z_m * t)); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[Or[LessEqual[y, -3.15e-71], N[Not[LessEqual[y, 1.1e-22]], $MachinePrecision]], N[(x$95$m * N[(N[(2.0 / z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(x$95$m / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{-71} \lor \neg \left(y \leq 1.1 \cdot 10^{-22}\right):\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z\_m \cdot t}\\
\end{array}\right)
\end{array}
if y < -3.1500000000000002e-71 or 1.1e-22 < y Initial program 88.6%
distribute-rgt-out--89.9%
Simplified89.9%
add-sqr-sqrt43.9%
*-commutative43.9%
times-frac45.5%
Applied egg-rr45.5%
Taylor expanded in y around inf 75.2%
associate-/l*74.7%
unpow274.7%
rem-square-sqrt75.2%
*-commutative75.2%
associate-/r*75.9%
Simplified75.9%
if -3.1500000000000002e-71 < y < 1.1e-22Initial program 90.7%
distribute-rgt-out--93.7%
Simplified93.7%
Taylor expanded in y around 0 83.0%
*-commutative83.0%
Simplified83.0%
Final simplification78.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -2.7e-72)
(* (/ 2.0 z_m) (/ x_m y))
(if (<= y 1.55e-27)
(* -2.0 (/ x_m (* z_m t)))
(* x_m (/ (/ 2.0 z_m) y)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -2.7e-72) {
tmp = (2.0 / z_m) * (x_m / y);
} else if (y <= 1.55e-27) {
tmp = -2.0 * (x_m / (z_m * t));
} else {
tmp = x_m * ((2.0 / z_m) / y);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-2.7d-72)) then
tmp = (2.0d0 / z_m) * (x_m / y)
else if (y <= 1.55d-27) then
tmp = (-2.0d0) * (x_m / (z_m * t))
else
tmp = x_m * ((2.0d0 / z_m) / y)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -2.7e-72) {
tmp = (2.0 / z_m) * (x_m / y);
} else if (y <= 1.55e-27) {
tmp = -2.0 * (x_m / (z_m * t));
} else {
tmp = x_m * ((2.0 / z_m) / y);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -2.7e-72: tmp = (2.0 / z_m) * (x_m / y) elif y <= 1.55e-27: tmp = -2.0 * (x_m / (z_m * t)) else: tmp = x_m * ((2.0 / z_m) / y) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -2.7e-72) tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / y)); elseif (y <= 1.55e-27) tmp = Float64(-2.0 * Float64(x_m / Float64(z_m * t))); else tmp = Float64(x_m * Float64(Float64(2.0 / z_m) / y)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -2.7e-72) tmp = (2.0 / z_m) * (x_m / y); elseif (y <= 1.55e-27) tmp = -2.0 * (x_m / (z_m * t)); else tmp = x_m * ((2.0 / z_m) / y); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -2.7e-72], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e-27], N[(-2.0 * N[(x$95$m / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(2.0 / z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-72}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-27}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z\_m}}{y}\\
\end{array}\right)
\end{array}
if y < -2.7e-72Initial program 88.0%
distribute-rgt-out--88.1%
Simplified88.1%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
*-commutative73.8%
times-frac78.2%
Applied egg-rr78.2%
if -2.7e-72 < y < 1.5499999999999999e-27Initial program 90.7%
distribute-rgt-out--93.7%
Simplified93.7%
Taylor expanded in y around 0 83.0%
*-commutative83.0%
Simplified83.0%
if 1.5499999999999999e-27 < y Initial program 89.1%
distribute-rgt-out--91.6%
Simplified91.6%
add-sqr-sqrt43.7%
*-commutative43.7%
times-frac44.3%
Applied egg-rr44.3%
Taylor expanded in y around inf 77.0%
associate-/l*77.0%
unpow277.0%
rem-square-sqrt77.5%
*-commutative77.5%
associate-/r*78.3%
Simplified78.3%
Final simplification80.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -6e-71)
(* (/ 2.0 z_m) (/ x_m y))
(if (<= y 1.7e-64)
(* x_m (/ (/ -2.0 z_m) t))
(* (/ x_m z_m) (/ 2.0 y)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -6e-71) {
tmp = (2.0 / z_m) * (x_m / y);
} else if (y <= 1.7e-64) {
tmp = x_m * ((-2.0 / z_m) / t);
} else {
tmp = (x_m / z_m) * (2.0 / y);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-6d-71)) then
tmp = (2.0d0 / z_m) * (x_m / y)
else if (y <= 1.7d-64) then
tmp = x_m * (((-2.0d0) / z_m) / t)
else
tmp = (x_m / z_m) * (2.0d0 / y)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -6e-71) {
tmp = (2.0 / z_m) * (x_m / y);
} else if (y <= 1.7e-64) {
tmp = x_m * ((-2.0 / z_m) / t);
} else {
tmp = (x_m / z_m) * (2.0 / y);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -6e-71: tmp = (2.0 / z_m) * (x_m / y) elif y <= 1.7e-64: tmp = x_m * ((-2.0 / z_m) / t) else: tmp = (x_m / z_m) * (2.0 / y) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -6e-71) tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / y)); elseif (y <= 1.7e-64) tmp = Float64(x_m * Float64(Float64(-2.0 / z_m) / t)); else tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -6e-71) tmp = (2.0 / z_m) * (x_m / y); elseif (y <= 1.7e-64) tmp = x_m * ((-2.0 / z_m) / t); else tmp = (x_m / z_m) * (2.0 / y); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -6e-71], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e-64], N[(x$95$m * N[(N[(-2.0 / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-71}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-64}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{z\_m}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y}\\
\end{array}\right)
\end{array}
if y < -6.0000000000000003e-71Initial program 88.0%
distribute-rgt-out--88.1%
Simplified88.1%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
*-commutative73.8%
times-frac78.2%
Applied egg-rr78.2%
if -6.0000000000000003e-71 < y < 1.70000000000000006e-64Initial program 90.7%
distribute-rgt-out--93.9%
Simplified93.9%
add-sqr-sqrt50.6%
*-commutative50.6%
times-frac53.4%
Applied egg-rr53.4%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
times-frac81.9%
distribute-rgt-neg-in81.9%
unpow281.9%
rem-square-sqrt82.5%
distribute-neg-frac82.5%
metadata-eval82.5%
times-frac84.7%
associate-/l*84.7%
*-commutative84.7%
associate-/r*84.7%
Simplified84.7%
if 1.70000000000000006e-64 < y Initial program 89.2%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 76.2%
*-commutative76.2%
Simplified76.2%
times-frac76.9%
Applied egg-rr76.9%
Final simplification80.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -5.8e-71)
(/ (/ x_m y) (* z_m 0.5))
(if (<= y 1.45e-67)
(* x_m (/ (/ -2.0 z_m) t))
(* (/ x_m z_m) (/ 2.0 y)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -5.8e-71) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= 1.45e-67) {
tmp = x_m * ((-2.0 / z_m) / t);
} else {
tmp = (x_m / z_m) * (2.0 / y);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-5.8d-71)) then
tmp = (x_m / y) / (z_m * 0.5d0)
else if (y <= 1.45d-67) then
tmp = x_m * (((-2.0d0) / z_m) / t)
else
tmp = (x_m / z_m) * (2.0d0 / y)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -5.8e-71) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= 1.45e-67) {
tmp = x_m * ((-2.0 / z_m) / t);
} else {
tmp = (x_m / z_m) * (2.0 / y);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -5.8e-71: tmp = (x_m / y) / (z_m * 0.5) elif y <= 1.45e-67: tmp = x_m * ((-2.0 / z_m) / t) else: tmp = (x_m / z_m) * (2.0 / y) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -5.8e-71) tmp = Float64(Float64(x_m / y) / Float64(z_m * 0.5)); elseif (y <= 1.45e-67) tmp = Float64(x_m * Float64(Float64(-2.0 / z_m) / t)); else tmp = Float64(Float64(x_m / z_m) * Float64(2.0 / y)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -5.8e-71) tmp = (x_m / y) / (z_m * 0.5); elseif (y <= 1.45e-67) tmp = x_m * ((-2.0 / z_m) / t); else tmp = (x_m / z_m) * (2.0 / y); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -5.8e-71], N[(N[(x$95$m / y), $MachinePrecision] / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e-67], N[(x$95$m * N[(N[(-2.0 / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z\_m \cdot 0.5}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-67}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{z\_m}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z\_m} \cdot \frac{2}{y}\\
\end{array}\right)
\end{array}
if y < -5.7999999999999997e-71Initial program 88.0%
distribute-rgt-out--88.1%
Simplified88.1%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
*-commutative73.8%
times-frac78.2%
Applied egg-rr78.2%
clear-num78.2%
un-div-inv78.2%
div-inv78.2%
metadata-eval78.2%
Applied egg-rr78.2%
if -5.7999999999999997e-71 < y < 1.45000000000000002e-67Initial program 90.7%
distribute-rgt-out--93.9%
Simplified93.9%
add-sqr-sqrt50.6%
*-commutative50.6%
times-frac53.4%
Applied egg-rr53.4%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
times-frac81.9%
distribute-rgt-neg-in81.9%
unpow281.9%
rem-square-sqrt82.5%
distribute-neg-frac82.5%
metadata-eval82.5%
times-frac84.7%
associate-/l*84.7%
*-commutative84.7%
associate-/r*84.7%
Simplified84.7%
if 1.45000000000000002e-67 < y Initial program 89.2%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 76.2%
*-commutative76.2%
Simplified76.2%
times-frac76.9%
Applied egg-rr76.9%
Final simplification80.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -7.6e-72)
(/ (/ x_m y) (* z_m 0.5))
(if (<= y 3.8e-64)
(* x_m (/ (/ -2.0 z_m) t))
(/ (/ x_m (* z_m 0.5)) y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -7.6e-72) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= 3.8e-64) {
tmp = x_m * ((-2.0 / z_m) / t);
} else {
tmp = (x_m / (z_m * 0.5)) / y;
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-7.6d-72)) then
tmp = (x_m / y) / (z_m * 0.5d0)
else if (y <= 3.8d-64) then
tmp = x_m * (((-2.0d0) / z_m) / t)
else
tmp = (x_m / (z_m * 0.5d0)) / y
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -7.6e-72) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= 3.8e-64) {
tmp = x_m * ((-2.0 / z_m) / t);
} else {
tmp = (x_m / (z_m * 0.5)) / y;
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -7.6e-72: tmp = (x_m / y) / (z_m * 0.5) elif y <= 3.8e-64: tmp = x_m * ((-2.0 / z_m) / t) else: tmp = (x_m / (z_m * 0.5)) / y return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -7.6e-72) tmp = Float64(Float64(x_m / y) / Float64(z_m * 0.5)); elseif (y <= 3.8e-64) tmp = Float64(x_m * Float64(Float64(-2.0 / z_m) / t)); else tmp = Float64(Float64(x_m / Float64(z_m * 0.5)) / y); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -7.6e-72) tmp = (x_m / y) / (z_m * 0.5); elseif (y <= 3.8e-64) tmp = x_m * ((-2.0 / z_m) / t); else tmp = (x_m / (z_m * 0.5)) / y; end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -7.6e-72], N[(N[(x$95$m / y), $MachinePrecision] / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e-64], N[(x$95$m * N[(N[(-2.0 / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{-72}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z\_m \cdot 0.5}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-64}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{z\_m}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{z\_m \cdot 0.5}}{y}\\
\end{array}\right)
\end{array}
if y < -7.60000000000000004e-72Initial program 88.0%
distribute-rgt-out--88.1%
Simplified88.1%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
*-commutative73.8%
times-frac78.2%
Applied egg-rr78.2%
clear-num78.2%
un-div-inv78.2%
div-inv78.2%
metadata-eval78.2%
Applied egg-rr78.2%
if -7.60000000000000004e-72 < y < 3.8000000000000002e-64Initial program 90.7%
distribute-rgt-out--93.9%
Simplified93.9%
add-sqr-sqrt50.6%
*-commutative50.6%
times-frac53.4%
Applied egg-rr53.4%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
times-frac81.9%
distribute-rgt-neg-in81.9%
unpow281.9%
rem-square-sqrt82.5%
distribute-neg-frac82.5%
metadata-eval82.5%
times-frac84.7%
associate-/l*84.7%
*-commutative84.7%
associate-/r*84.7%
Simplified84.7%
if 3.8000000000000002e-64 < y Initial program 89.2%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 76.2%
*-commutative76.2%
Simplified76.2%
*-commutative76.2%
times-frac74.1%
Applied egg-rr74.1%
associate-*l/76.9%
clear-num76.9%
un-div-inv77.0%
div-inv77.0%
metadata-eval77.0%
Applied egg-rr77.0%
Final simplification80.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= y -3.5e-71)
(/ (/ x_m y) (* z_m 0.5))
(if (<= y 2.9e-16)
(/ (/ (* x_m -2.0) z_m) t)
(/ (/ x_m (* z_m 0.5)) y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -3.5e-71) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= 2.9e-16) {
tmp = ((x_m * -2.0) / z_m) / t;
} else {
tmp = (x_m / (z_m * 0.5)) / y;
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.5d-71)) then
tmp = (x_m / y) / (z_m * 0.5d0)
else if (y <= 2.9d-16) then
tmp = ((x_m * (-2.0d0)) / z_m) / t
else
tmp = (x_m / (z_m * 0.5d0)) / y
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (y <= -3.5e-71) {
tmp = (x_m / y) / (z_m * 0.5);
} else if (y <= 2.9e-16) {
tmp = ((x_m * -2.0) / z_m) / t;
} else {
tmp = (x_m / (z_m * 0.5)) / y;
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if y <= -3.5e-71: tmp = (x_m / y) / (z_m * 0.5) elif y <= 2.9e-16: tmp = ((x_m * -2.0) / z_m) / t else: tmp = (x_m / (z_m * 0.5)) / y return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (y <= -3.5e-71) tmp = Float64(Float64(x_m / y) / Float64(z_m * 0.5)); elseif (y <= 2.9e-16) tmp = Float64(Float64(Float64(x_m * -2.0) / z_m) / t); else tmp = Float64(Float64(x_m / Float64(z_m * 0.5)) / y); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (y <= -3.5e-71) tmp = (x_m / y) / (z_m * 0.5); elseif (y <= 2.9e-16) tmp = ((x_m * -2.0) / z_m) / t; else tmp = (x_m / (z_m * 0.5)) / y; end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[y, -3.5e-71], N[(N[(x$95$m / y), $MachinePrecision] / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e-16], N[(N[(N[(x$95$m * -2.0), $MachinePrecision] / z$95$m), $MachinePrecision] / t), $MachinePrecision], N[(N[(x$95$m / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-71}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z\_m \cdot 0.5}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-16}:\\
\;\;\;\;\frac{\frac{x\_m \cdot -2}{z\_m}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{z\_m \cdot 0.5}}{y}\\
\end{array}\right)
\end{array}
if y < -3.4999999999999999e-71Initial program 88.0%
distribute-rgt-out--88.1%
Simplified88.1%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
*-commutative73.8%
times-frac78.2%
Applied egg-rr78.2%
clear-num78.2%
un-div-inv78.2%
div-inv78.2%
metadata-eval78.2%
Applied egg-rr78.2%
if -3.4999999999999999e-71 < y < 2.8999999999999998e-16Initial program 90.7%
distribute-rgt-out--93.7%
Simplified93.7%
Taylor expanded in y around 0 83.0%
*-commutative83.0%
Simplified83.0%
*-commutative83.0%
associate-*l/83.0%
metadata-eval83.0%
distribute-rgt-neg-in83.0%
associate-/r*83.1%
distribute-rgt-neg-in83.1%
metadata-eval83.1%
Applied egg-rr83.1%
if 2.8999999999999998e-16 < y Initial program 89.1%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around inf 77.6%
*-commutative77.6%
Simplified77.6%
*-commutative77.6%
times-frac75.4%
Applied egg-rr75.4%
associate-*l/78.4%
clear-num78.4%
un-div-inv78.5%
div-inv78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Final simplification80.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= (* x_m 2.0) 1e-51)
(* 2.0 (/ (/ x_m z_m) (- y t)))
(* (/ 2.0 z_m) (/ x_m (- y t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 1e-51) {
tmp = 2.0 * ((x_m / z_m) / (y - t));
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 1d-51) then
tmp = 2.0d0 * ((x_m / z_m) / (y - t))
else
tmp = (2.0d0 / z_m) * (x_m / (y - t))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 1e-51) {
tmp = 2.0 * ((x_m / z_m) / (y - t));
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (x_m * 2.0) <= 1e-51: tmp = 2.0 * ((x_m / z_m) / (y - t)) else: tmp = (2.0 / z_m) * (x_m / (y - t)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 1e-51) tmp = Float64(2.0 * Float64(Float64(x_m / z_m) / Float64(y - t))); else tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / Float64(y - t))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((x_m * 2.0) <= 1e-51) tmp = 2.0 * ((x_m / z_m) / (y - t)); else tmp = (2.0 / z_m) * (x_m / (y - t)); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 1e-51], N[(2.0 * N[(N[(x$95$m / z$95$m), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 10^{-51}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z\_m}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y - t}\\
\end{array}\right)
\end{array}
if (*.f64 x 2) < 1e-51Initial program 89.2%
distribute-rgt-out--90.8%
Simplified90.8%
Taylor expanded in x around 0 90.7%
associate-/r*91.8%
Simplified91.8%
if 1e-51 < (*.f64 x 2) Initial program 90.1%
distribute-rgt-out--93.2%
Simplified93.2%
*-commutative93.2%
times-frac98.1%
Applied egg-rr98.1%
Final simplification93.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= (* x_m 2.0) 5e+17)
(/ (* x_m 2.0) (* z_m (- y t)))
(* (/ 2.0 z_m) (/ x_m (- y t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 5e+17) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 5d+17) then
tmp = (x_m * 2.0d0) / (z_m * (y - t))
else
tmp = (2.0d0 / z_m) * (x_m / (y - t))
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if ((x_m * 2.0) <= 5e+17) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (2.0 / z_m) * (x_m / (y - t));
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if (x_m * 2.0) <= 5e+17: tmp = (x_m * 2.0) / (z_m * (y - t)) else: tmp = (2.0 / z_m) * (x_m / (y - t)) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 5e+17) tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(2.0 / z_m) * Float64(x_m / Float64(y - t))); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if ((x_m * 2.0) <= 5e+17) tmp = (x_m * 2.0) / (z_m * (y - t)); else tmp = (2.0 / z_m) * (x_m / (y - t)); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 5e+17], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{+17}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x\_m}{y - t}\\
\end{array}\right)
\end{array}
if (*.f64 x 2) < 5e17Initial program 89.3%
distribute-rgt-out--91.3%
Simplified91.3%
if 5e17 < (*.f64 x 2) Initial program 89.7%
distribute-rgt-out--91.7%
Simplified91.7%
*-commutative91.7%
times-frac97.8%
Applied egg-rr97.8%
Final simplification92.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 1 z)
(FPCore (z_s x_s x_m y z_m t)
:precision binary64
(*
z_s
(*
x_s
(if (<= z_m 7.6e+42)
(/ (* x_m 2.0) (* z_m (- y t)))
(/ (/ 2.0 z_m) (/ (- y t) x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 7.6e+42) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (2.0 / z_m) / ((y - t) / x_m);
}
return z_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 7.6d+42) then
tmp = (x_m * 2.0d0) / (z_m * (y - t))
else
tmp = (2.0d0 / z_m) / ((y - t) / x_m)
end if
code = z_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 7.6e+42) {
tmp = (x_m * 2.0) / (z_m * (y - t));
} else {
tmp = (2.0 / z_m) / ((y - t) / x_m);
}
return z_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): tmp = 0 if z_m <= 7.6e+42: tmp = (x_m * 2.0) / (z_m * (y - t)) else: tmp = (2.0 / z_m) / ((y - t) / x_m) return z_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0 if (z_m <= 7.6e+42) tmp = Float64(Float64(x_m * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(2.0 / z_m) / Float64(Float64(y - t) / x_m)); end return Float64(z_s * Float64(x_s * tmp)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x_s, x_m, y, z_m, t) tmp = 0.0; if (z_m <= 7.6e+42) tmp = (x_m * 2.0) / (z_m * (y - t)); else tmp = (2.0 / z_m) / ((y - t) / x_m); end tmp_2 = z_s * (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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * If[LessEqual[z$95$m, 7.6e+42], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z$95$m), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 7.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{z\_m}}{\frac{y - t}{x\_m}}\\
\end{array}\right)
\end{array}
if z < 7.5999999999999997e42Initial program 91.0%
distribute-rgt-out--93.5%
Simplified93.5%
if 7.5999999999999997e42 < z Initial program 83.4%
distribute-rgt-out--83.6%
Simplified83.6%
add-sqr-sqrt45.3%
*-commutative45.3%
times-frac47.0%
Applied egg-rr47.0%
frac-times45.3%
add-sqr-sqrt83.6%
frac-times97.7%
*-commutative97.7%
clear-num97.7%
un-div-inv97.9%
Applied egg-rr97.9%
Final simplification94.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) z\_m = (fabs.f64 z) z\_s = (copysign.f64 1 z) (FPCore (z_s x_s x_m y z_m t) :precision binary64 (* z_s (* x_s (* 2.0 (/ (/ x_m z_m) (- y t))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
return z_s * (x_s * (2.0 * ((x_m / z_m) / (y - t))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = z_s * (x_s * (2.0d0 * ((x_m / z_m) / (y - t))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
return z_s * (x_s * (2.0 * ((x_m / z_m) / (y - t))));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): return z_s * (x_s * (2.0 * ((x_m / z_m) / (y - t))))
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) return Float64(z_s * Float64(x_s * Float64(2.0 * Float64(Float64(x_m / z_m) / Float64(y - t))))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x_s, x_m, y, z_m, t) tmp = z_s * (x_s * (2.0 * ((x_m / z_m) / (y - t)))); 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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * N[(2.0 * N[(N[(x$95$m / z$95$m), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \left(2 \cdot \frac{\frac{x\_m}{z\_m}}{y - t}\right)\right)
\end{array}
Initial program 89.4%
distribute-rgt-out--91.4%
Simplified91.4%
Taylor expanded in x around 0 91.4%
associate-/r*91.7%
Simplified91.7%
Final simplification91.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) z\_m = (fabs.f64 z) z\_s = (copysign.f64 1 z) (FPCore (z_s x_s x_m y z_m t) :precision binary64 (* z_s (* x_s (* -2.0 (/ x_m (* z_m t))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
return z_s * (x_s * (-2.0 * (x_m / (z_m * t))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x_s, x_m, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = z_s * (x_s * ((-2.0d0) * (x_m / (z_m * t))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x_s, double x_m, double y, double z_m, double t) {
return z_s * (x_s * (-2.0 * (x_m / (z_m * t))));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x_s, x_m, y, z_m, t): return z_s * (x_s * (-2.0 * (x_m / (z_m * t))))
x\_m = abs(x) x\_s = copysign(1.0, x) z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x_s, x_m, y, z_m, t) return Float64(z_s * Float64(x_s * Float64(-2.0 * Float64(x_m / Float64(z_m * t))))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x_s, x_m, y, z_m, t) tmp = z_s * (x_s * (-2.0 * (x_m / (z_m * t)))); 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]
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x$95$s_, x$95$m_, y_, z$95$m_, t_] := N[(z$95$s * N[(x$95$s * N[(-2.0 * N[(x$95$m / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(x\_s \cdot \left(-2 \cdot \frac{x\_m}{z\_m \cdot t}\right)\right)
\end{array}
Initial program 89.4%
distribute-rgt-out--91.4%
Simplified91.4%
Taylor expanded in y around 0 52.6%
*-commutative52.6%
Simplified52.6%
Final simplification52.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x (* (- y t) z)) 2.0))
(t_2 (/ (* x 2.0) (- (* y z) (* t z)))))
(if (< t_2 -2.559141628295061e-13)
t_1
(if (< t_2 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / ((y - t) * z)) * 2.0d0
t_2 = (x * 2.0d0) / ((y * z) - (t * z))
if (t_2 < (-2.559141628295061d-13)) then
tmp = t_1
else if (t_2 < 1.045027827330126d-269) then
tmp = ((x / z) * 2.0d0) / (y - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / ((y - t) * z)) * 2.0 t_2 = (x * 2.0) / ((y * z) - (t * z)) tmp = 0 if t_2 < -2.559141628295061e-13: tmp = t_1 elif t_2 < 1.045027827330126e-269: tmp = ((x / z) * 2.0) / (y - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(Float64(y - t) * z)) * 2.0) t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) tmp = 0.0 if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = Float64(Float64(Float64(x / z) * 2.0) / Float64(y - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / ((y - t) * z)) * 2.0; t_2 = (x * 2.0) / ((y * z) - (t * z)); tmp = 0.0; if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = ((x / z) * 2.0) / (y - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -2.559141628295061e-13], t$95$1, If[Less[t$95$2, 1.045027827330126e-269], N[(N[(N[(x / z), $MachinePrecision] * 2.0), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\
t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{if}\;t\_2 < -2.559141628295061 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.045027827330126 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024057
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:alt
(if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))