
(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 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 2e-30)
(/ (* -2.0 (/ x_m z)) (- t y))
(* (/ 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) <= 2e-30) {
tmp = (-2.0 * (x_m / z)) / (t - y);
} 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) <= 2d-30) then
tmp = ((-2.0d0) * (x_m / z)) / (t - y)
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) <= 2e-30) {
tmp = (-2.0 * (x_m / z)) / (t - y);
} 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) <= 2e-30: tmp = (-2.0 * (x_m / z)) / (t - y) 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) <= 2e-30) tmp = Float64(Float64(-2.0 * Float64(x_m / z)) / Float64(t - y)); 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) <= 2e-30) tmp = (-2.0 * (x_m / z)) / (t - y); 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], 2e-30], N[(N[(-2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / N[(t - y), $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 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{-2 \cdot \frac{x\_m}{z}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 2e-30Initial program 91.2%
distribute-rgt-out--92.8%
Simplified92.8%
Taylor expanded in x around 0 92.7%
associate-*r/92.8%
metadata-eval92.8%
distribute-lft-neg-in92.8%
*-commutative92.8%
distribute-neg-frac92.8%
associate-/r*95.8%
*-commutative95.8%
associate-*r/95.8%
distribute-neg-frac295.8%
neg-sub095.8%
sub-neg95.8%
+-commutative95.8%
associate--r+95.8%
neg-sub095.8%
remove-double-neg95.8%
Simplified95.8%
if 2e-30 < (*.f64 x #s(literal 2 binary64)) Initial program 84.3%
distribute-rgt-out--88.8%
Simplified88.8%
*-commutative88.8%
times-frac96.8%
Applied egg-rr96.8%
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 -1.15e-53)
(* (/ 2.0 z) (/ x_m y))
(if (<= y 2.4e-27)
(/ (/ -2.0 t) (/ z x_m))
(/ (* -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 <= -1.15e-53) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 2.4e-27) {
tmp = (-2.0 / t) / (z / x_m);
} 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 <= (-1.15d-53)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (y <= 2.4d-27) then
tmp = ((-2.0d0) / t) / (z / x_m)
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 <= -1.15e-53) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 2.4e-27) {
tmp = (-2.0 / t) / (z / x_m);
} 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 <= -1.15e-53: tmp = (2.0 / z) * (x_m / y) elif y <= 2.4e-27: tmp = (-2.0 / t) / (z / x_m) 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 <= -1.15e-53) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (y <= 2.4e-27) tmp = Float64(Float64(-2.0 / t) / Float64(z / x_m)); else tmp = Float64(Float64(-2.0 * Float64(x_m / z)) / Float64(-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 <= -1.15e-53) tmp = (2.0 / z) * (x_m / y); elseif (y <= 2.4e-27) tmp = (-2.0 / t) / (z / x_m); 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, -1.15e-53], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-27], N[(N[(-2.0 / t), $MachinePrecision] / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-53}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{-2}{t}}{\frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \frac{x\_m}{z}}{-y}\\
\end{array}
\end{array}
if y < -1.1500000000000001e-53Initial program 89.8%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in y around inf 79.9%
associate-/r*81.9%
associate-*r/81.9%
Simplified81.9%
*-commutative81.9%
associate-/l*81.9%
Applied egg-rr81.9%
if -1.1500000000000001e-53 < y < 2.40000000000000002e-27Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
Simplified78.3%
*-commutative78.3%
associate-*l/78.3%
metadata-eval78.3%
distribute-rgt-neg-in78.3%
distribute-frac-neg78.3%
distribute-frac-neg278.3%
distribute-rgt-neg-out78.3%
times-frac81.4%
clear-num81.4%
associate-*l/82.0%
*-un-lft-identity82.0%
neg-mul-182.0%
associate-/r*82.0%
metadata-eval82.0%
Applied egg-rr82.0%
if 2.40000000000000002e-27 < y Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in x around 0 91.3%
associate-*r/91.3%
metadata-eval91.3%
distribute-lft-neg-in91.3%
*-commutative91.3%
distribute-neg-frac91.3%
associate-/r*96.5%
*-commutative96.5%
associate-*r/96.5%
distribute-neg-frac296.5%
neg-sub096.5%
sub-neg96.5%
+-commutative96.5%
associate--r+96.5%
neg-sub096.5%
remove-double-neg96.5%
Simplified96.5%
Taylor expanded in t around 0 82.8%
neg-mul-182.8%
Simplified82.8%
Final simplification82.2%
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 -6.2e-54) (not (<= y 2.2e-31)))
(* 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 ((y <= -6.2e-54) || !(y <= 2.2e-31)) {
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 ((y <= (-6.2d-54)) .or. (.not. (y <= 2.2d-31))) 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 ((y <= -6.2e-54) || !(y <= 2.2e-31)) {
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 (y <= -6.2e-54) or not (y <= 2.2e-31): 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 ((y <= -6.2e-54) || !(y <= 2.2e-31)) 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 ((y <= -6.2e-54) || ~((y <= 2.2e-31))) 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[Or[LessEqual[y, -6.2e-54], N[Not[LessEqual[y, 2.2e-31]], $MachinePrecision]], 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}\;y \leq -6.2 \cdot 10^{-54} \lor \neg \left(y \leq 2.2 \cdot 10^{-31}\right):\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if y < -6.20000000000000008e-54 or 2.2000000000000001e-31 < y Initial program 89.8%
distribute-rgt-out--91.8%
Simplified91.8%
distribute-rgt-out--89.8%
associate-/l*89.1%
*-commutative89.1%
distribute-rgt-out--91.2%
Applied egg-rr91.2%
Taylor expanded in y around inf 79.6%
*-commutative79.6%
associate-/l*79.6%
times-frac80.4%
metadata-eval80.4%
distribute-neg-frac80.4%
/-rgt-identity80.4%
distribute-neg-frac280.4%
metadata-eval80.4%
times-frac81.0%
associate-*l/81.1%
associate-*r/81.1%
times-frac81.1%
metadata-eval81.1%
Simplified81.1%
if -6.20000000000000008e-54 < y < 2.2000000000000001e-31Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
associate-/r*81.5%
Simplified81.5%
Final simplification81.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 -5.5e-54)
(* (/ 2.0 z) (/ x_m y))
(if (<= y 8.2e-27) (/ (/ -2.0 t) (/ z x_m)) (* (/ x_m z) (/ 2.0 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 <= -5.5e-54) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 8.2e-27) {
tmp = (-2.0 / t) / (z / x_m);
} else {
tmp = (x_m / z) * (2.0 / 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 <= (-5.5d-54)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (y <= 8.2d-27) then
tmp = ((-2.0d0) / t) / (z / x_m)
else
tmp = (x_m / z) * (2.0d0 / 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 <= -5.5e-54) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 8.2e-27) {
tmp = (-2.0 / t) / (z / x_m);
} else {
tmp = (x_m / z) * (2.0 / 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 <= -5.5e-54: tmp = (2.0 / z) * (x_m / y) elif y <= 8.2e-27: tmp = (-2.0 / t) / (z / x_m) else: tmp = (x_m / z) * (2.0 / 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 <= -5.5e-54) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (y <= 8.2e-27) tmp = Float64(Float64(-2.0 / t) / Float64(z / x_m)); else tmp = Float64(Float64(x_m / z) * Float64(2.0 / 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 <= -5.5e-54) tmp = (2.0 / z) * (x_m / y); elseif (y <= 8.2e-27) tmp = (-2.0 / t) / (z / x_m); else tmp = (x_m / z) * (2.0 / 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, -5.5e-54], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e-27], N[(N[(-2.0 / t), $MachinePrecision] / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / 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 -5.5 \cdot 10^{-54}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{-2}{t}}{\frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y}\\
\end{array}
\end{array}
if y < -5.50000000000000046e-54Initial program 89.8%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in y around inf 79.9%
associate-/r*81.9%
associate-*r/81.9%
Simplified81.9%
*-commutative81.9%
associate-/l*81.9%
Applied egg-rr81.9%
if -5.50000000000000046e-54 < y < 8.1999999999999997e-27Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
Simplified78.3%
*-commutative78.3%
associate-*l/78.3%
metadata-eval78.3%
distribute-rgt-neg-in78.3%
distribute-frac-neg78.3%
distribute-frac-neg278.3%
distribute-rgt-neg-out78.3%
times-frac81.4%
clear-num81.4%
associate-*l/82.0%
*-un-lft-identity82.0%
neg-mul-182.0%
associate-/r*82.0%
metadata-eval82.0%
Applied egg-rr82.0%
if 8.1999999999999997e-27 < y Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
times-frac96.5%
Applied egg-rr96.5%
Taylor expanded in y around inf 82.8%
Final simplification82.2%
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 -1.25e-53)
(* (/ 2.0 z) (/ x_m y))
(if (<= y 3e-31) (* -2.0 (/ (/ x_m z) t)) (* (/ x_m z) (/ 2.0 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 <= -1.25e-53) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 3e-31) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (x_m / z) * (2.0 / 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 <= (-1.25d-53)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (y <= 3d-31) then
tmp = (-2.0d0) * ((x_m / z) / t)
else
tmp = (x_m / z) * (2.0d0 / 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 <= -1.25e-53) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 3e-31) {
tmp = -2.0 * ((x_m / z) / t);
} else {
tmp = (x_m / z) * (2.0 / 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 <= -1.25e-53: tmp = (2.0 / z) * (x_m / y) elif y <= 3e-31: tmp = -2.0 * ((x_m / z) / t) else: tmp = (x_m / z) * (2.0 / 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 <= -1.25e-53) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (y <= 3e-31) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); else tmp = Float64(Float64(x_m / z) * Float64(2.0 / 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 <= -1.25e-53) tmp = (2.0 / z) * (x_m / y); elseif (y <= 3e-31) tmp = -2.0 * ((x_m / z) / t); else tmp = (x_m / z) * (2.0 / 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, -1.25e-53], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e-31], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / 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 -1.25 \cdot 10^{-53}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-31}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y}\\
\end{array}
\end{array}
if y < -1.25e-53Initial program 89.8%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in y around inf 79.9%
associate-/r*81.9%
associate-*r/81.9%
Simplified81.9%
*-commutative81.9%
associate-/l*81.9%
Applied egg-rr81.9%
if -1.25e-53 < y < 2.99999999999999981e-31Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
associate-/r*81.5%
Simplified81.5%
if 2.99999999999999981e-31 < y Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
times-frac96.5%
Applied egg-rr96.5%
Taylor expanded in y around inf 82.8%
Final simplification82.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
(if (<= y -9.2e-54)
(* (/ 2.0 z) (/ x_m y))
(if (<= y 5.5e-32) (* -2.0 (/ (/ x_m z) 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-54) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 5.5e-32) {
tmp = -2.0 * ((x_m / z) / 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-54)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (y <= 5.5d-32) then
tmp = (-2.0d0) * ((x_m / z) / 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-54) {
tmp = (2.0 / z) * (x_m / y);
} else if (y <= 5.5e-32) {
tmp = -2.0 * ((x_m / z) / 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-54: tmp = (2.0 / z) * (x_m / y) elif y <= 5.5e-32: tmp = -2.0 * ((x_m / z) / 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-54) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (y <= 5.5e-32) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / 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-54) tmp = (2.0 / z) * (x_m / y); elseif (y <= 5.5e-32) tmp = -2.0 * ((x_m / z) / 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-54], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-32], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / 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^{-54}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-32}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\end{array}
\end{array}
if y < -9.1999999999999996e-54Initial program 89.8%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in y around inf 79.9%
associate-/r*81.9%
associate-*r/81.9%
Simplified81.9%
*-commutative81.9%
associate-/l*81.9%
Applied egg-rr81.9%
if -9.1999999999999996e-54 < y < 5.50000000000000024e-32Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
associate-/r*81.5%
Simplified81.5%
if 5.50000000000000024e-32 < y Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
distribute-rgt-out--89.7%
associate-/l*88.0%
*-commutative88.0%
distribute-rgt-out--89.7%
Applied egg-rr89.7%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
associate-/l*79.3%
times-frac78.1%
metadata-eval78.1%
distribute-neg-frac78.1%
/-rgt-identity78.1%
distribute-neg-frac278.1%
metadata-eval78.1%
times-frac82.7%
associate-*l/82.8%
associate-*r/82.8%
times-frac82.8%
metadata-eval82.8%
Simplified82.8%
Final simplification81.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 (<= y -3.1e-54)
(* x_m (/ 2.0 (* z y)))
(if (<= y 4.6e-34) (* -2.0 (/ (/ x_m z) 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 <= -3.1e-54) {
tmp = x_m * (2.0 / (z * y));
} else if (y <= 4.6e-34) {
tmp = -2.0 * ((x_m / z) / 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 <= (-3.1d-54)) then
tmp = x_m * (2.0d0 / (z * y))
else if (y <= 4.6d-34) then
tmp = (-2.0d0) * ((x_m / z) / 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 <= -3.1e-54) {
tmp = x_m * (2.0 / (z * y));
} else if (y <= 4.6e-34) {
tmp = -2.0 * ((x_m / z) / 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 <= -3.1e-54: tmp = x_m * (2.0 / (z * y)) elif y <= 4.6e-34: tmp = -2.0 * ((x_m / z) / 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 <= -3.1e-54) tmp = Float64(x_m * Float64(2.0 / Float64(z * y))); elseif (y <= 4.6e-34) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / 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 <= -3.1e-54) tmp = x_m * (2.0 / (z * y)); elseif (y <= 4.6e-34) tmp = -2.0 * ((x_m / z) / 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, -3.1e-54], N[(x$95$m * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.6e-34], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / 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 -3.1 \cdot 10^{-54}:\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot y}\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-34}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\end{array}
\end{array}
if y < -3.10000000000000004e-54Initial program 89.8%
distribute-rgt-out--92.1%
Simplified92.1%
distribute-rgt-out--89.8%
associate-/l*89.9%
*-commutative89.9%
distribute-rgt-out--92.2%
Applied egg-rr92.2%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
Simplified79.9%
if -3.10000000000000004e-54 < y < 4.60000000000000022e-34Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
associate-/r*81.5%
Simplified81.5%
if 4.60000000000000022e-34 < y Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
distribute-rgt-out--89.7%
associate-/l*88.0%
*-commutative88.0%
distribute-rgt-out--89.7%
Applied egg-rr89.7%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
associate-/l*79.3%
times-frac78.1%
metadata-eval78.1%
distribute-neg-frac78.1%
/-rgt-identity78.1%
distribute-neg-frac278.1%
metadata-eval78.1%
times-frac82.7%
associate-*l/82.8%
associate-*r/82.8%
times-frac82.8%
metadata-eval82.8%
Simplified82.8%
Final simplification81.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 -1.25e-53)
(* x_m (/ (/ 2.0 z) y))
(if (<= y 7.8e-28) (* -2.0 (/ (/ x_m z) 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 <= -1.25e-53) {
tmp = x_m * ((2.0 / z) / y);
} else if (y <= 7.8e-28) {
tmp = -2.0 * ((x_m / z) / 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 <= (-1.25d-53)) then
tmp = x_m * ((2.0d0 / z) / y)
else if (y <= 7.8d-28) then
tmp = (-2.0d0) * ((x_m / z) / 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 <= -1.25e-53) {
tmp = x_m * ((2.0 / z) / y);
} else if (y <= 7.8e-28) {
tmp = -2.0 * ((x_m / z) / 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 <= -1.25e-53: tmp = x_m * ((2.0 / z) / y) elif y <= 7.8e-28: tmp = -2.0 * ((x_m / z) / 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 <= -1.25e-53) tmp = Float64(x_m * Float64(Float64(2.0 / z) / y)); elseif (y <= 7.8e-28) tmp = Float64(-2.0 * Float64(Float64(x_m / z) / 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 <= -1.25e-53) tmp = x_m * ((2.0 / z) / y); elseif (y <= 7.8e-28) tmp = -2.0 * ((x_m / z) / 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, -1.25e-53], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e-28], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / 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 -1.25 \cdot 10^{-53}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-28}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\end{array}
\end{array}
if y < -1.25e-53Initial program 89.8%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in x around 0 92.1%
associate-*r/92.1%
metadata-eval92.1%
distribute-lft-neg-in92.1%
*-commutative92.1%
distribute-neg-frac92.1%
associate-/r*93.3%
*-commutative93.3%
associate-*r/93.3%
distribute-neg-frac293.3%
neg-sub093.3%
sub-neg93.3%
+-commutative93.3%
associate--r+93.3%
neg-sub093.3%
remove-double-neg93.3%
Simplified93.3%
Taylor expanded in t around 0 79.9%
*-commutative79.9%
associate-/r*81.9%
associate-*l/81.9%
associate-*l/81.9%
associate-*r/81.9%
*-rgt-identity81.9%
associate-*r/81.8%
associate-*l*79.9%
associate-*l/79.9%
associate-*r/79.9%
metadata-eval79.9%
Simplified79.9%
if -1.25e-53 < y < 7.79999999999999998e-28Initial program 88.8%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
associate-/r*81.5%
Simplified81.5%
if 7.79999999999999998e-28 < y Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
distribute-rgt-out--89.7%
associate-/l*88.0%
*-commutative88.0%
distribute-rgt-out--89.7%
Applied egg-rr89.7%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
associate-/l*79.3%
times-frac78.1%
metadata-eval78.1%
distribute-neg-frac78.1%
/-rgt-identity78.1%
distribute-neg-frac278.1%
metadata-eval78.1%
times-frac82.7%
associate-*l/82.8%
associate-*r/82.8%
times-frac82.8%
metadata-eval82.8%
Simplified82.8%
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) 2e-30)
(* (/ x_m z) (/ 2.0 (- 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) <= 2e-30) {
tmp = (x_m / z) * (2.0 / (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) <= 2d-30) then
tmp = (x_m / z) * (2.0d0 / (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) <= 2e-30) {
tmp = (x_m / z) * (2.0 / (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) <= 2e-30: tmp = (x_m / z) * (2.0 / (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) <= 2e-30) tmp = Float64(Float64(x_m / z) * Float64(2.0 / 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) <= 2e-30) tmp = (x_m / z) * (2.0 / (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], 2e-30], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / 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 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 2e-30Initial program 91.2%
distribute-rgt-out--92.8%
Simplified92.8%
times-frac95.7%
Applied egg-rr95.7%
if 2e-30 < (*.f64 x #s(literal 2 binary64)) Initial program 84.3%
distribute-rgt-out--88.8%
Simplified88.8%
*-commutative88.8%
times-frac96.8%
Applied egg-rr96.8%
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 5.2e-37)
(* 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 <= 5.2e-37) {
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 <= 5.2d-37) 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 <= 5.2e-37) {
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 <= 5.2e-37: 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 <= 5.2e-37) tmp = Float64(x_m * Float64(2.0 / Float64(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 <= 5.2e-37) 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, 5.2e-37], N[(x$95$m * N[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $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 5.2 \cdot 10^{-37}:\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y - t}\\
\end{array}
\end{array}
if z < 5.19999999999999959e-37Initial program 89.1%
distribute-rgt-out--92.5%
Simplified92.5%
distribute-rgt-out--89.1%
associate-/l*88.6%
*-commutative88.6%
distribute-rgt-out--91.9%
Applied egg-rr91.9%
if 5.19999999999999959e-37 < z Initial program 89.9%
distribute-rgt-out--89.9%
Simplified89.9%
times-frac96.7%
Applied egg-rr96.7%
Final simplification93.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 1e+76) (* -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 <= 1e+76) {
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 <= 1d+76) 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 <= 1e+76) {
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 <= 1e+76: 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 <= 1e+76) 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 <= 1e+76) 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, 1e+76], 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 10^{+76}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if z < 1e76Initial program 90.3%
distribute-rgt-out--93.3%
Simplified93.3%
Taylor expanded in y around 0 53.7%
*-commutative53.7%
Simplified53.7%
if 1e76 < z Initial program 85.6%
distribute-rgt-out--85.6%
Simplified85.6%
Taylor expanded in y around 0 45.6%
*-commutative45.6%
associate-/r*55.6%
Simplified55.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 (* 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(2.0 / Float64(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[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $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{2}{z \cdot \left(y - t\right)}\right)
\end{array}
Initial program 89.4%
distribute-rgt-out--91.7%
Simplified91.7%
distribute-rgt-out--89.4%
associate-/l*89.0%
*-commutative89.0%
distribute-rgt-out--91.3%
Applied egg-rr91.3%
Final simplification91.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 (* -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 89.4%
distribute-rgt-out--91.7%
Simplified91.7%
Taylor expanded in y around 0 52.1%
*-commutative52.1%
Simplified52.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 2024186
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (* x 2) (- (* y z) (* t z))) -2559141628295061/10000000000000000000000000000) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 522513913665063/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2))))
(/ (* x 2.0) (- (* y z) (* t z))))