
(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 12 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 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 5e-86)
(/ (* x_m 2.0) (* z (- y t)))
(* (/ x_m (- y t)) (/ 2.0 z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 5e-86) {
tmp = (x_m * 2.0) / (z * (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 5d-86) then
tmp = (x_m * 2.0d0) / (z * (y - t))
else
tmp = (x_m / (y - t)) * (2.0d0 / z)
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 t) {
double tmp;
if ((x_m * 2.0) <= 5e-86) {
tmp = (x_m * 2.0) / (z * (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (x_m * 2.0) <= 5e-86: tmp = (x_m * 2.0) / (z * (y - t)) else: tmp = (x_m / (y - t)) * (2.0 / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 5e-86) tmp = Float64(Float64(x_m * 2.0) / Float64(z * Float64(y - t))); else tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / z)); 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, t) tmp = 0.0; if ((x_m * 2.0) <= 5e-86) tmp = (x_m * 2.0) / (z * (y - t)); else tmp = (x_m / (y - t)) * (2.0 / z); 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_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 5e-86], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $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 \cdot 2 \leq 5 \cdot 10^{-86}:\\
\;\;\;\;\frac{x\_m \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 4.9999999999999999e-86Initial program 91.9%
distribute-rgt-out--93.1%
Simplified93.1%
if 4.9999999999999999e-86 < (*.f64 x #s(literal 2 binary64)) Initial program 86.3%
distribute-rgt-out--87.6%
Simplified87.6%
*-commutative87.6%
times-frac97.4%
Applied egg-rr97.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ -2.0 z) (/ x_m t))))
(*
x_s
(if (<= t -1.08e+20)
t_1
(if (<= t 4e-185)
(* 2.0 (/ (/ x_m z) y))
(if (<= t 8.5e-168)
t_1
(if (<= t 13500000.0)
(/ (* x_m 2.0) (* z y))
(/ -2.0 (* z (/ t 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 t) {
double t_1 = (-2.0 / z) * (x_m / t);
double tmp;
if (t <= -1.08e+20) {
tmp = t_1;
} else if (t <= 4e-185) {
tmp = 2.0 * ((x_m / z) / y);
} else if (t <= 8.5e-168) {
tmp = t_1;
} else if (t <= 13500000.0) {
tmp = (x_m * 2.0) / (z * y);
} else {
tmp = -2.0 / (z * (t / 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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((-2.0d0) / z) * (x_m / t)
if (t <= (-1.08d+20)) then
tmp = t_1
else if (t <= 4d-185) then
tmp = 2.0d0 * ((x_m / z) / y)
else if (t <= 8.5d-168) then
tmp = t_1
else if (t <= 13500000.0d0) then
tmp = (x_m * 2.0d0) / (z * y)
else
tmp = (-2.0d0) / (z * (t / 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 t) {
double t_1 = (-2.0 / z) * (x_m / t);
double tmp;
if (t <= -1.08e+20) {
tmp = t_1;
} else if (t <= 4e-185) {
tmp = 2.0 * ((x_m / z) / y);
} else if (t <= 8.5e-168) {
tmp = t_1;
} else if (t <= 13500000.0) {
tmp = (x_m * 2.0) / (z * y);
} else {
tmp = -2.0 / (z * (t / 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, t): t_1 = (-2.0 / z) * (x_m / t) tmp = 0 if t <= -1.08e+20: tmp = t_1 elif t <= 4e-185: tmp = 2.0 * ((x_m / z) / y) elif t <= 8.5e-168: tmp = t_1 elif t <= 13500000.0: tmp = (x_m * 2.0) / (z * y) else: tmp = -2.0 / (z * (t / x_m)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(-2.0 / z) * Float64(x_m / t)) tmp = 0.0 if (t <= -1.08e+20) tmp = t_1; elseif (t <= 4e-185) tmp = Float64(2.0 * Float64(Float64(x_m / z) / y)); elseif (t <= 8.5e-168) tmp = t_1; elseif (t <= 13500000.0) tmp = Float64(Float64(x_m * 2.0) / Float64(z * y)); else tmp = Float64(-2.0 / Float64(z * Float64(t / 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, t) t_1 = (-2.0 / z) * (x_m / t); tmp = 0.0; if (t <= -1.08e+20) tmp = t_1; elseif (t <= 4e-185) tmp = 2.0 * ((x_m / z) / y); elseif (t <= 8.5e-168) tmp = t_1; elseif (t <= 13500000.0) tmp = (x_m * 2.0) / (z * y); else tmp = -2.0 / (z * (t / 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_, t_] := Block[{t$95$1 = N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -1.08e+20], t$95$1, If[LessEqual[t, 4e-185], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-168], t$95$1, If[LessEqual[t, 13500000.0], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(z * N[(t / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{-2}{z} \cdot \frac{x\_m}{t}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.08 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-185}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 13500000:\\
\;\;\;\;\frac{x\_m \cdot 2}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x\_m}}\\
\end{array}
\end{array}
\end{array}
if t < -1.08e20 or 4e-185 < t < 8.4999999999999994e-168Initial program 89.9%
distribute-rgt-out--89.9%
Simplified89.9%
Taylor expanded in y around 0 79.9%
associate-*r*79.9%
neg-mul-179.9%
*-commutative79.9%
Simplified79.9%
distribute-rgt-neg-out79.9%
distribute-frac-neg279.9%
distribute-frac-neg79.9%
*-commutative79.9%
distribute-lft-neg-in79.9%
metadata-eval79.9%
times-frac82.0%
Applied egg-rr82.0%
if -1.08e20 < t < 4e-185Initial program 93.0%
distribute-rgt-out--94.1%
Simplified94.1%
Taylor expanded in y around inf 76.9%
distribute-lft-out76.9%
associate-/l*76.9%
times-frac80.1%
distribute-rgt1-in83.6%
Simplified83.6%
Taylor expanded in t around 0 84.6%
if 8.4999999999999994e-168 < t < 1.35e7Initial program 98.0%
distribute-rgt-out--98.0%
Simplified98.0%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
Simplified87.1%
if 1.35e7 < t Initial program 83.8%
distribute-rgt-out--86.6%
Simplified86.6%
Taylor expanded in y around 0 74.8%
associate-*r*74.8%
neg-mul-174.8%
*-commutative74.8%
Simplified74.8%
distribute-rgt-neg-out74.8%
distribute-frac-neg274.8%
distribute-frac-neg74.8%
*-commutative74.8%
distribute-lft-neg-in74.8%
metadata-eval74.8%
times-frac79.7%
Applied egg-rr79.7%
*-commutative79.7%
clear-num80.7%
frac-times80.6%
metadata-eval80.6%
Applied egg-rr80.6%
Final simplification83.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* 2.0 (/ (/ x_m z) y))) (t_2 (* (/ -2.0 z) (/ x_m t))))
(*
x_s
(if (<= t -2.4e+18)
t_2
(if (<= t 4e-185)
t_1
(if (<= t 8.5e-168)
t_2
(if (<= t 80000000.0) t_1 (/ -2.0 (* z (/ t 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 t) {
double t_1 = 2.0 * ((x_m / z) / y);
double t_2 = (-2.0 / z) * (x_m / t);
double tmp;
if (t <= -2.4e+18) {
tmp = t_2;
} else if (t <= 4e-185) {
tmp = t_1;
} else if (t <= 8.5e-168) {
tmp = t_2;
} else if (t <= 80000000.0) {
tmp = t_1;
} else {
tmp = -2.0 / (z * (t / 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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
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 = 2.0d0 * ((x_m / z) / y)
t_2 = ((-2.0d0) / z) * (x_m / t)
if (t <= (-2.4d+18)) then
tmp = t_2
else if (t <= 4d-185) then
tmp = t_1
else if (t <= 8.5d-168) then
tmp = t_2
else if (t <= 80000000.0d0) then
tmp = t_1
else
tmp = (-2.0d0) / (z * (t / 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 t) {
double t_1 = 2.0 * ((x_m / z) / y);
double t_2 = (-2.0 / z) * (x_m / t);
double tmp;
if (t <= -2.4e+18) {
tmp = t_2;
} else if (t <= 4e-185) {
tmp = t_1;
} else if (t <= 8.5e-168) {
tmp = t_2;
} else if (t <= 80000000.0) {
tmp = t_1;
} else {
tmp = -2.0 / (z * (t / 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, t): t_1 = 2.0 * ((x_m / z) / y) t_2 = (-2.0 / z) * (x_m / t) tmp = 0 if t <= -2.4e+18: tmp = t_2 elif t <= 4e-185: tmp = t_1 elif t <= 8.5e-168: tmp = t_2 elif t <= 80000000.0: tmp = t_1 else: tmp = -2.0 / (z * (t / x_m)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(2.0 * Float64(Float64(x_m / z) / y)) t_2 = Float64(Float64(-2.0 / z) * Float64(x_m / t)) tmp = 0.0 if (t <= -2.4e+18) tmp = t_2; elseif (t <= 4e-185) tmp = t_1; elseif (t <= 8.5e-168) tmp = t_2; elseif (t <= 80000000.0) tmp = t_1; else tmp = Float64(-2.0 / Float64(z * Float64(t / 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, t) t_1 = 2.0 * ((x_m / z) / y); t_2 = (-2.0 / z) * (x_m / t); tmp = 0.0; if (t <= -2.4e+18) tmp = t_2; elseif (t <= 4e-185) tmp = t_1; elseif (t <= 8.5e-168) tmp = t_2; elseif (t <= 80000000.0) tmp = t_1; else tmp = -2.0 / (z * (t / 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_, t_] := Block[{t$95$1 = N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -2.4e+18], t$95$2, If[LessEqual[t, 4e-185], t$95$1, If[LessEqual[t, 8.5e-168], t$95$2, If[LessEqual[t, 80000000.0], t$95$1, N[(-2.0 / N[(z * N[(t / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := 2 \cdot \frac{\frac{x\_m}{z}}{y}\\
t_2 := \frac{-2}{z} \cdot \frac{x\_m}{t}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-185}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-168}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 80000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{z \cdot \frac{t}{x\_m}}\\
\end{array}
\end{array}
\end{array}
if t < -2.4e18 or 4e-185 < t < 8.4999999999999994e-168Initial program 89.9%
distribute-rgt-out--89.9%
Simplified89.9%
Taylor expanded in y around 0 79.9%
associate-*r*79.9%
neg-mul-179.9%
*-commutative79.9%
Simplified79.9%
distribute-rgt-neg-out79.9%
distribute-frac-neg279.9%
distribute-frac-neg79.9%
*-commutative79.9%
distribute-lft-neg-in79.9%
metadata-eval79.9%
times-frac82.0%
Applied egg-rr82.0%
if -2.4e18 < t < 4e-185 or 8.4999999999999994e-168 < t < 8e7Initial program 94.3%
distribute-rgt-out--95.1%
Simplified95.1%
Taylor expanded in y around inf 74.5%
distribute-lft-out74.5%
associate-/l*74.5%
times-frac76.7%
distribute-rgt1-in79.5%
Simplified79.5%
Taylor expanded in t around 0 82.0%
if 8e7 < t Initial program 83.8%
distribute-rgt-out--86.6%
Simplified86.6%
Taylor expanded in y around 0 74.8%
associate-*r*74.8%
neg-mul-174.8%
*-commutative74.8%
Simplified74.8%
distribute-rgt-neg-out74.8%
distribute-frac-neg274.8%
distribute-frac-neg74.8%
*-commutative74.8%
distribute-lft-neg-in74.8%
metadata-eval74.8%
times-frac79.7%
Applied egg-rr79.7%
*-commutative79.7%
clear-num80.7%
frac-times80.6%
metadata-eval80.6%
Applied egg-rr80.6%
Final simplification81.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -3.6e+27) (not (<= y 3.6e+29)))
(* 2.0 (/ (/ x_m z) y))
(* (/ -2.0 z) (/ x_m t)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -3.6e+27) || !(y <= 3.6e+29)) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = (-2.0 / z) * (x_m / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.6d+27)) .or. (.not. (y <= 3.6d+29))) then
tmp = 2.0d0 * ((x_m / z) / y)
else
tmp = ((-2.0d0) / z) * (x_m / t)
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 t) {
double tmp;
if ((y <= -3.6e+27) || !(y <= 3.6e+29)) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = (-2.0 / z) * (x_m / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -3.6e+27) or not (y <= 3.6e+29): tmp = 2.0 * ((x_m / z) / y) else: tmp = (-2.0 / z) * (x_m / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -3.6e+27) || !(y <= 3.6e+29)) tmp = Float64(2.0 * Float64(Float64(x_m / z) / y)); else tmp = Float64(Float64(-2.0 / z) * Float64(x_m / t)); 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, t) tmp = 0.0; if ((y <= -3.6e+27) || ~((y <= 3.6e+29))) tmp = 2.0 * ((x_m / z) / y); else tmp = (-2.0 / z) * (x_m / t); 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_, t_] := N[(x$95$s * If[Or[LessEqual[y, -3.6e+27], N[Not[LessEqual[y, 3.6e+29]], $MachinePrecision]], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $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}\;y \leq -3.6 \cdot 10^{+27} \lor \neg \left(y \leq 3.6 \cdot 10^{+29}\right):\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x\_m}{t}\\
\end{array}
\end{array}
if y < -3.59999999999999983e27 or 3.59999999999999976e29 < y Initial program 87.4%
distribute-rgt-out--89.1%
Simplified89.1%
Taylor expanded in y around inf 74.9%
distribute-lft-out74.9%
associate-/l*74.8%
times-frac77.2%
distribute-rgt1-in78.2%
Simplified78.2%
Taylor expanded in t around 0 79.2%
if -3.59999999999999983e27 < y < 3.59999999999999976e29Initial program 92.6%
distribute-rgt-out--93.3%
Simplified93.3%
Taylor expanded in y around 0 73.4%
associate-*r*73.4%
neg-mul-173.4%
*-commutative73.4%
Simplified73.4%
distribute-rgt-neg-out73.4%
distribute-frac-neg273.4%
distribute-frac-neg73.4%
*-commutative73.4%
distribute-lft-neg-in73.4%
metadata-eval73.4%
times-frac77.5%
Applied egg-rr77.5%
Final simplification78.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -9.2e+27)
(* (/ x_m z) (/ 2.0 y))
(if (<= y 2.2e+27) (* (/ -2.0 z) (/ x_m t)) (* 2.0 (/ (/ 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 t) {
double tmp;
if (y <= -9.2e+27) {
tmp = (x_m / z) * (2.0 / y);
} else if (y <= 2.2e+27) {
tmp = (-2.0 / z) * (x_m / t);
} else {
tmp = 2.0 * ((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, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-9.2d+27)) then
tmp = (x_m / z) * (2.0d0 / y)
else if (y <= 2.2d+27) then
tmp = ((-2.0d0) / z) * (x_m / t)
else
tmp = 2.0d0 * ((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 t) {
double tmp;
if (y <= -9.2e+27) {
tmp = (x_m / z) * (2.0 / y);
} else if (y <= 2.2e+27) {
tmp = (-2.0 / z) * (x_m / t);
} else {
tmp = 2.0 * ((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, t): tmp = 0 if y <= -9.2e+27: tmp = (x_m / z) * (2.0 / y) elif y <= 2.2e+27: tmp = (-2.0 / z) * (x_m / t) else: tmp = 2.0 * ((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, t) tmp = 0.0 if (y <= -9.2e+27) tmp = Float64(Float64(x_m / z) * Float64(2.0 / y)); elseif (y <= 2.2e+27) tmp = Float64(Float64(-2.0 / z) * Float64(x_m / t)); else tmp = Float64(2.0 * Float64(Float64(x_m / 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, t) tmp = 0.0; if (y <= -9.2e+27) tmp = (x_m / z) * (2.0 / y); elseif (y <= 2.2e+27) tmp = (-2.0 / z) * (x_m / t); else tmp = 2.0 * ((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_, t_] := N[(x$95$s * If[LessEqual[y, -9.2e+27], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+27], N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / 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}\;y \leq -9.2 \cdot 10^{+27}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+27}:\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\end{array}
\end{array}
if y < -9.2000000000000002e27Initial program 91.7%
distribute-rgt-out--91.7%
Simplified91.7%
Taylor expanded in y around inf 81.1%
associate-*r/81.1%
*-commutative81.1%
*-commutative81.1%
times-frac76.5%
Simplified76.5%
if -9.2000000000000002e27 < y < 2.1999999999999999e27Initial program 92.6%
distribute-rgt-out--93.3%
Simplified93.3%
Taylor expanded in y around 0 73.4%
associate-*r*73.4%
neg-mul-173.4%
*-commutative73.4%
Simplified73.4%
distribute-rgt-neg-out73.4%
distribute-frac-neg273.4%
distribute-frac-neg73.4%
*-commutative73.4%
distribute-lft-neg-in73.4%
metadata-eval73.4%
times-frac77.5%
Applied egg-rr77.5%
if 2.1999999999999999e27 < y Initial program 83.2%
distribute-rgt-out--86.7%
Simplified86.7%
Taylor expanded in y around inf 75.2%
distribute-lft-out75.2%
associate-/l*75.2%
times-frac78.6%
distribute-rgt1-in80.1%
Simplified80.1%
Taylor expanded in t around 0 81.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -4.8e+18)
(* x_m (/ -2.0 (* z t)))
(if (<= t 24000000.0) (* 2.0 (/ (/ x_m z) y)) (* -2.0 (/ (/ x_m z) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -4.8e+18) {
tmp = x_m * (-2.0 / (z * t));
} else if (t <= 24000000.0) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-4.8d+18)) then
tmp = x_m * ((-2.0d0) / (z * t))
else if (t <= 24000000.0d0) then
tmp = 2.0d0 * ((x_m / z) / y)
else
tmp = (-2.0d0) * ((x_m / z) / t)
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 t) {
double tmp;
if (t <= -4.8e+18) {
tmp = x_m * (-2.0 / (z * t));
} else if (t <= 24000000.0) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -4.8e+18: tmp = x_m * (-2.0 / (z * t)) elif t <= 24000000.0: tmp = 2.0 * ((x_m / z) / y) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -4.8e+18) tmp = Float64(x_m * Float64(-2.0 / Float64(z * t))); elseif (t <= 24000000.0) tmp = Float64(2.0 * Float64(Float64(x_m / z) / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); 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, t) tmp = 0.0; if (t <= -4.8e+18) tmp = x_m * (-2.0 / (z * t)); elseif (t <= 24000000.0) tmp = 2.0 * ((x_m / z) / y); else tmp = -2.0 * ((x_m / z) / t); 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_, t_] := N[(x$95$s * If[LessEqual[t, -4.8e+18], N[(x$95$m * N[(-2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 24000000.0], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $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}\;t \leq -4.8 \cdot 10^{+18}:\\
\;\;\;\;x\_m \cdot \frac{-2}{z \cdot t}\\
\mathbf{elif}\;t \leq 24000000:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -4.8e18Initial program 90.6%
distribute-rgt-out--90.6%
Simplified90.6%
*-un-lft-identity90.6%
*-commutative90.6%
times-frac90.5%
associate-/l*90.5%
Applied egg-rr90.5%
Taylor expanded in y around 0 79.3%
*-commutative79.3%
associate-*l/79.4%
associate-/l*79.4%
Simplified79.4%
if -4.8e18 < t < 2.4e7Initial program 93.8%
distribute-rgt-out--94.6%
Simplified94.6%
Taylor expanded in y around inf 71.0%
distribute-lft-out71.0%
associate-/l*71.0%
times-frac73.1%
distribute-rgt1-in75.7%
Simplified75.7%
Taylor expanded in t around 0 79.0%
if 2.4e7 < t Initial program 83.8%
distribute-rgt-out--86.6%
Simplified86.6%
Taylor expanded in y around 0 74.8%
*-commutative74.8%
associate-/r*77.5%
Simplified77.5%
Final simplification78.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -1.08e+20)
(* -2.0 (/ x_m (* z t)))
(if (<= t 370000000.0) (* 2.0 (/ (/ x_m z) y)) (* -2.0 (/ (/ x_m z) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -1.08e+20) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 370000000.0) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.08d+20)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 370000000.0d0) then
tmp = 2.0d0 * ((x_m / z) / y)
else
tmp = (-2.0d0) * ((x_m / z) / t)
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 t) {
double tmp;
if (t <= -1.08e+20) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 370000000.0) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -1.08e+20: tmp = -2.0 * (x_m / (z * t)) elif t <= 370000000.0: tmp = 2.0 * ((x_m / z) / y) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -1.08e+20) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 370000000.0) tmp = Float64(2.0 * Float64(Float64(x_m / z) / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); 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, t) tmp = 0.0; if (t <= -1.08e+20) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 370000000.0) tmp = 2.0 * ((x_m / z) / y); else tmp = -2.0 * ((x_m / z) / t); 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_, t_] := N[(x$95$s * If[LessEqual[t, -1.08e+20], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 370000000.0], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $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}\;t \leq -1.08 \cdot 10^{+20}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 370000000:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -1.08e20Initial program 90.6%
distribute-rgt-out--90.6%
Simplified90.6%
Taylor expanded in y around 0 79.3%
*-commutative79.3%
Simplified79.3%
if -1.08e20 < t < 3.7e8Initial program 93.8%
distribute-rgt-out--94.6%
Simplified94.6%
Taylor expanded in y around inf 71.0%
distribute-lft-out71.0%
associate-/l*71.0%
times-frac73.1%
distribute-rgt1-in75.7%
Simplified75.7%
Taylor expanded in t around 0 79.0%
if 3.7e8 < t Initial program 83.8%
distribute-rgt-out--86.6%
Simplified86.6%
Taylor expanded in y around 0 74.8%
*-commutative74.8%
associate-/r*77.5%
Simplified77.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 1e-79)
(* x_m (/ (/ 2.0 z) (- y t)))
(* (/ x_m (- y t)) (/ 2.0 z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 1e-79) {
tmp = x_m * ((2.0 / z) / (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 1d-79) then
tmp = x_m * ((2.0d0 / z) / (y - t))
else
tmp = (x_m / (y - t)) * (2.0d0 / z)
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 t) {
double tmp;
if ((x_m * 2.0) <= 1e-79) {
tmp = x_m * ((2.0 / z) / (y - t));
} else {
tmp = (x_m / (y - t)) * (2.0 / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (x_m * 2.0) <= 1e-79: tmp = x_m * ((2.0 / z) / (y - t)) else: tmp = (x_m / (y - t)) * (2.0 / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 1e-79) tmp = Float64(x_m * Float64(Float64(2.0 / z) / Float64(y - t))); else tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / z)); 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, t) tmp = 0.0; if ((x_m * 2.0) <= 1e-79) tmp = x_m * ((2.0 / z) / (y - t)); else tmp = (x_m / (y - t)) * (2.0 / z); 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_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 1e-79], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $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 \cdot 2 \leq 10^{-79}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 1e-79Initial program 92.0%
distribute-rgt-out--93.2%
Simplified93.2%
*-un-lft-identity93.2%
*-commutative93.2%
times-frac91.2%
associate-/l*91.3%
Applied egg-rr91.3%
associate-*l/91.2%
*-un-lft-identity91.2%
frac-2neg91.2%
clear-num91.2%
un-div-inv91.3%
div-inv91.3%
metadata-eval91.3%
sub-neg91.3%
distribute-neg-in91.3%
add-sqr-sqrt40.0%
sqrt-unprod68.2%
sqr-neg68.2%
sqrt-unprod34.8%
add-sqr-sqrt61.8%
add-sqr-sqrt27.0%
sqrt-unprod70.8%
sqr-neg70.8%
sqrt-unprod51.1%
add-sqr-sqrt91.3%
Applied egg-rr91.3%
distribute-frac-neg91.3%
distribute-neg-frac291.3%
distribute-neg-in91.3%
remove-double-neg91.3%
sub-neg91.3%
Simplified91.3%
div-inv91.2%
associate-/l*92.8%
*-commutative92.8%
associate-/r*92.8%
metadata-eval92.8%
Applied egg-rr92.8%
if 1e-79 < (*.f64 x #s(literal 2 binary64)) Initial program 86.0%
distribute-rgt-out--87.4%
Simplified87.4%
*-commutative87.4%
times-frac97.3%
Applied egg-rr97.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z 7.5e-21)
(* x_m (/ (/ 2.0 z) (- y t)))
(* (/ x_m z) (/ 2.0 (- y t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 7.5e-21) {
tmp = x_m * ((2.0 / z) / (y - t));
} else {
tmp = (x_m / z) * (2.0 / (y - t));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 7.5d-21) then
tmp = x_m * ((2.0d0 / z) / (y - t))
else
tmp = (x_m / z) * (2.0d0 / (y - t))
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 t) {
double tmp;
if (z <= 7.5e-21) {
tmp = x_m * ((2.0 / z) / (y - t));
} else {
tmp = (x_m / z) * (2.0 / (y - t));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= 7.5e-21: tmp = x_m * ((2.0 / z) / (y - t)) else: tmp = (x_m / z) * (2.0 / (y - t)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= 7.5e-21) tmp = Float64(x_m * Float64(Float64(2.0 / z) / Float64(y - t))); else tmp = Float64(Float64(x_m / z) * Float64(2.0 / Float64(y - t))); 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, t) tmp = 0.0; if (z <= 7.5e-21) tmp = x_m * ((2.0 / z) / (y - t)); else tmp = (x_m / z) * (2.0 / (y - t)); 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_, t_] := N[(x$95$s * If[LessEqual[z, 7.5e-21], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / N[(y - t), $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}\;z \leq 7.5 \cdot 10^{-21}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y - t}\\
\end{array}
\end{array}
if z < 7.50000000000000072e-21Initial program 90.0%
distribute-rgt-out--91.6%
Simplified91.6%
*-un-lft-identity91.6%
*-commutative91.6%
times-frac89.9%
associate-/l*90.0%
Applied egg-rr90.0%
associate-*l/89.9%
*-un-lft-identity89.9%
frac-2neg89.9%
clear-num89.9%
un-div-inv90.1%
div-inv90.1%
metadata-eval90.1%
sub-neg90.1%
distribute-neg-in90.1%
add-sqr-sqrt41.1%
sqrt-unprod66.7%
sqr-neg66.7%
sqrt-unprod30.5%
add-sqr-sqrt58.1%
add-sqr-sqrt27.6%
sqrt-unprod67.7%
sqr-neg67.7%
sqrt-unprod48.9%
add-sqr-sqrt90.1%
Applied egg-rr90.1%
distribute-frac-neg90.1%
distribute-neg-frac290.1%
distribute-neg-in90.1%
remove-double-neg90.1%
sub-neg90.1%
Simplified90.1%
div-inv89.9%
associate-/l*91.3%
*-commutative91.3%
associate-/r*91.3%
metadata-eval91.3%
Applied egg-rr91.3%
if 7.50000000000000072e-21 < z Initial program 90.1%
distribute-rgt-out--90.3%
Simplified90.3%
times-frac98.1%
Applied egg-rr98.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z 2000000000.0) (* -2.0 (/ x_m (* z t))) (* -2.0 (/ (/ x_m z) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 2000000000.0) {
tmp = -2.0 * (x_m / (z * t));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 2000000000.0d0) then
tmp = (-2.0d0) * (x_m / (z * t))
else
tmp = (-2.0d0) * ((x_m / z) / t)
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 t) {
double tmp;
if (z <= 2000000000.0) {
tmp = -2.0 * (x_m / (z * t));
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= 2000000000.0: tmp = -2.0 * (x_m / (z * t)) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= 2000000000.0) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); 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, t) tmp = 0.0; if (z <= 2000000000.0) tmp = -2.0 * (x_m / (z * t)); else tmp = -2.0 * ((x_m / z) / t); 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_, t_] := N[(x$95$s * If[LessEqual[z, 2000000000.0], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $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 2000000000:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if z < 2e9Initial program 90.2%
distribute-rgt-out--91.8%
Simplified91.8%
Taylor expanded in y around 0 53.7%
*-commutative53.7%
Simplified53.7%
if 2e9 < z Initial program 89.2%
distribute-rgt-out--89.4%
Simplified89.4%
Taylor expanded in y around 0 41.2%
*-commutative41.2%
associate-/r*50.9%
Simplified50.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ (/ 2.0 z) (- y t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((2.0 / z) / (y - t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m * ((2.0d0 / z) / (y - t)))
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 t) {
return x_s * (x_m * ((2.0 / z) / (y - t)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * ((2.0 / z) / (y - t)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(Float64(2.0 / z) / Float64(y - t)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * ((2.0 / z) / (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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \frac{\frac{2}{z}}{y - t}\right)
\end{array}
Initial program 90.0%
distribute-rgt-out--91.3%
Simplified91.3%
*-un-lft-identity91.3%
*-commutative91.3%
times-frac91.8%
associate-/l*91.8%
Applied egg-rr91.8%
associate-*l/91.8%
*-un-lft-identity91.8%
frac-2neg91.8%
clear-num91.8%
un-div-inv91.9%
div-inv91.9%
metadata-eval91.9%
sub-neg91.9%
distribute-neg-in91.9%
add-sqr-sqrt40.3%
sqrt-unprod68.9%
sqr-neg68.9%
sqrt-unprod33.3%
add-sqr-sqrt61.7%
add-sqr-sqrt28.4%
sqrt-unprod71.1%
sqr-neg71.1%
sqrt-unprod51.4%
add-sqr-sqrt91.9%
Applied egg-rr91.9%
distribute-frac-neg91.9%
distribute-neg-frac291.9%
distribute-neg-in91.9%
remove-double-neg91.9%
sub-neg91.9%
Simplified91.9%
div-inv91.8%
associate-/l*91.0%
*-commutative91.0%
associate-/r*91.0%
metadata-eval91.0%
Applied egg-rr91.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -2.0 (/ x_m (* z t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * ((-2.0d0) * (x_m / (z * t)))
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 t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (-2.0 * (x_m / (z * t)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(-2.0 * Float64(x_m / Float64(z * t)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (-2.0 * (x_m / (z * 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(-2 \cdot \frac{x\_m}{z \cdot t}\right)
\end{array}
Initial program 90.0%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in y around 0 51.1%
*-commutative51.1%
Simplified51.1%
(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 2024110
(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))))