
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 10000000000000.0)
(/ (* 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) <= 10000000000000.0) {
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) <= 10000000000000.0d0) 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) <= 10000000000000.0) {
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) <= 10000000000000.0: 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) <= 10000000000000.0) 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) <= 10000000000000.0) 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], 10000000000000.0], 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 10000000000000:\\
\;\;\;\;\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 2) < 1e13Initial program 91.5%
distribute-rgt-out--94.7%
Simplified94.7%
if 1e13 < (*.f64 x 2) Initial program 80.0%
distribute-rgt-out--81.5%
Simplified81.5%
*-commutative81.5%
times-frac98.1%
Applied egg-rr98.1%
Final simplification95.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* -2.0 (/ x_m (* z t)))) (t_2 (* 2.0 (/ x_m (* z y)))))
(*
x_s
(if (<= y -9e+43)
t_2
(if (<= y -850.0)
t_1
(if (<= y -3.85e-90)
t_2
(if (<= y 190.0) t_1 (* (/ 2.0 z) (/ x_m y)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = -2.0 * (x_m / (z * t));
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -9e+43) {
tmp = t_2;
} else if (y <= -850.0) {
tmp = t_1;
} else if (y <= -3.85e-90) {
tmp = t_2;
} else if (y <= 190.0) {
tmp = t_1;
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, 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 * t))
t_2 = 2.0d0 * (x_m / (z * y))
if (y <= (-9d+43)) then
tmp = t_2
else if (y <= (-850.0d0)) then
tmp = t_1
else if (y <= (-3.85d-90)) then
tmp = t_2
else if (y <= 190.0d0) then
tmp = t_1
else
tmp = (2.0d0 / z) * (x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = -2.0 * (x_m / (z * t));
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -9e+43) {
tmp = t_2;
} else if (y <= -850.0) {
tmp = t_1;
} else if (y <= -3.85e-90) {
tmp = t_2;
} else if (y <= 190.0) {
tmp = t_1;
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = -2.0 * (x_m / (z * t)) t_2 = 2.0 * (x_m / (z * y)) tmp = 0 if y <= -9e+43: tmp = t_2 elif y <= -850.0: tmp = t_1 elif y <= -3.85e-90: tmp = t_2 elif y <= 190.0: tmp = t_1 else: tmp = (2.0 / z) * (x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(-2.0 * Float64(x_m / Float64(z * t))) t_2 = Float64(2.0 * Float64(x_m / Float64(z * y))) tmp = 0.0 if (y <= -9e+43) tmp = t_2; elseif (y <= -850.0) tmp = t_1; elseif (y <= -3.85e-90) tmp = t_2; elseif (y <= 190.0) tmp = t_1; else tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = -2.0 * (x_m / (z * t)); t_2 = 2.0 * (x_m / (z * y)); tmp = 0.0; if (y <= -9e+43) tmp = t_2; elseif (y <= -850.0) tmp = t_1; elseif (y <= -3.85e-90) tmp = t_2; elseif (y <= 190.0) tmp = t_1; else tmp = (2.0 / z) * (x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -9e+43], t$95$2, If[LessEqual[y, -850.0], t$95$1, If[LessEqual[y, -3.85e-90], t$95$2, If[LessEqual[y, 190.0], t$95$1, N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $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{x\_m}{z \cdot t}\\
t_2 := 2 \cdot \frac{x\_m}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+43}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -850:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.85 \cdot 10^{-90}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 190:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\end{array}
\end{array}
\end{array}
if y < -9e43 or -850 < y < -3.84999999999999986e-90Initial program 90.8%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -9e43 < y < -850 or -3.84999999999999986e-90 < y < 190Initial program 87.4%
distribute-rgt-out--89.0%
Simplified89.0%
Taylor expanded in y around 0 76.6%
*-commutative76.6%
Simplified76.6%
if 190 < y Initial program 88.3%
distribute-rgt-out--91.5%
Simplified91.5%
*-commutative91.5%
times-frac94.0%
Applied egg-rr94.0%
Taylor expanded in y around inf 80.9%
Final simplification80.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ x_m z) (/ -2.0 t))) (t_2 (* 2.0 (/ x_m (* z y)))))
(*
x_s
(if (<= y -1.15e+41)
t_2
(if (<= y -1200.0)
t_1
(if (<= y -2.4e-91)
t_2
(if (<= y 28.5) t_1 (* (/ 2.0 z) (/ x_m y)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -1.15e+41) {
tmp = t_2;
} else if (y <= -1200.0) {
tmp = t_1;
} else if (y <= -2.4e-91) {
tmp = t_2;
} else if (y <= 28.5) {
tmp = t_1;
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, 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 = (x_m / z) * ((-2.0d0) / t)
t_2 = 2.0d0 * (x_m / (z * y))
if (y <= (-1.15d+41)) then
tmp = t_2
else if (y <= (-1200.0d0)) then
tmp = t_1
else if (y <= (-2.4d-91)) then
tmp = t_2
else if (y <= 28.5d0) then
tmp = t_1
else
tmp = (2.0d0 / z) * (x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -1.15e+41) {
tmp = t_2;
} else if (y <= -1200.0) {
tmp = t_1;
} else if (y <= -2.4e-91) {
tmp = t_2;
} else if (y <= 28.5) {
tmp = t_1;
} else {
tmp = (2.0 / z) * (x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = (x_m / z) * (-2.0 / t) t_2 = 2.0 * (x_m / (z * y)) tmp = 0 if y <= -1.15e+41: tmp = t_2 elif y <= -1200.0: tmp = t_1 elif y <= -2.4e-91: tmp = t_2 elif y <= 28.5: tmp = t_1 else: tmp = (2.0 / z) * (x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(x_m / z) * Float64(-2.0 / t)) t_2 = Float64(2.0 * Float64(x_m / Float64(z * y))) tmp = 0.0 if (y <= -1.15e+41) tmp = t_2; elseif (y <= -1200.0) tmp = t_1; elseif (y <= -2.4e-91) tmp = t_2; elseif (y <= 28.5) tmp = t_1; else tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = (x_m / z) * (-2.0 / t); t_2 = 2.0 * (x_m / (z * y)); tmp = 0.0; if (y <= -1.15e+41) tmp = t_2; elseif (y <= -1200.0) tmp = t_1; elseif (y <= -2.4e-91) tmp = t_2; elseif (y <= 28.5) tmp = t_1; else tmp = (2.0 / z) * (x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -1.15e+41], t$95$2, If[LessEqual[y, -1200.0], t$95$1, If[LessEqual[y, -2.4e-91], t$95$2, If[LessEqual[y, 28.5], t$95$1, N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $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{x\_m}{z} \cdot \frac{-2}{t}\\
t_2 := 2 \cdot \frac{x\_m}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+41}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1200:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-91}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 28.5:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\end{array}
\end{array}
\end{array}
if y < -1.1499999999999999e41 or -1200 < y < -2.40000000000000011e-91Initial program 90.8%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -1.1499999999999999e41 < y < -1200 or -2.40000000000000011e-91 < y < 28.5Initial program 87.4%
distribute-rgt-out--89.0%
Simplified89.0%
times-frac89.2%
Applied egg-rr89.2%
Taylor expanded in y around 0 77.5%
if 28.5 < y Initial program 88.3%
distribute-rgt-out--91.5%
Simplified91.5%
*-commutative91.5%
times-frac94.0%
Applied egg-rr94.0%
Taylor expanded in y around inf 80.9%
Final simplification80.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ x_m z) (/ -2.0 t))) (t_2 (* 2.0 (/ x_m (* z y)))))
(*
x_s
(if (<= y -1.25e+42)
t_2
(if (<= y -950.0)
t_1
(if (<= y -3.1e-90)
t_2
(if (<= y 9.0) t_1 (* (/ 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 t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -1.25e+42) {
tmp = t_2;
} else if (y <= -950.0) {
tmp = t_1;
} else if (y <= -3.1e-90) {
tmp = t_2;
} else if (y <= 9.0) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x_m / z) * ((-2.0d0) / t)
t_2 = 2.0d0 * (x_m / (z * y))
if (y <= (-1.25d+42)) then
tmp = t_2
else if (y <= (-950.0d0)) then
tmp = t_1
else if (y <= (-3.1d-90)) then
tmp = t_2
else if (y <= 9.0d0) then
tmp = t_1
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 t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -1.25e+42) {
tmp = t_2;
} else if (y <= -950.0) {
tmp = t_1;
} else if (y <= -3.1e-90) {
tmp = t_2;
} else if (y <= 9.0) {
tmp = t_1;
} 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): t_1 = (x_m / z) * (-2.0 / t) t_2 = 2.0 * (x_m / (z * y)) tmp = 0 if y <= -1.25e+42: tmp = t_2 elif y <= -950.0: tmp = t_1 elif y <= -3.1e-90: tmp = t_2 elif y <= 9.0: tmp = t_1 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) t_1 = Float64(Float64(x_m / z) * Float64(-2.0 / t)) t_2 = Float64(2.0 * Float64(x_m / Float64(z * y))) tmp = 0.0 if (y <= -1.25e+42) tmp = t_2; elseif (y <= -950.0) tmp = t_1; elseif (y <= -3.1e-90) tmp = t_2; elseif (y <= 9.0) tmp = t_1; 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) t_1 = (x_m / z) * (-2.0 / t); t_2 = 2.0 * (x_m / (z * y)); tmp = 0.0; if (y <= -1.25e+42) tmp = t_2; elseif (y <= -950.0) tmp = t_1; elseif (y <= -3.1e-90) tmp = t_2; elseif (y <= 9.0) tmp = t_1; 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_] := Block[{t$95$1 = N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -1.25e+42], t$95$2, If[LessEqual[y, -950.0], t$95$1, If[LessEqual[y, -3.1e-90], t$95$2, If[LessEqual[y, 9.0], t$95$1, 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)
\\
\begin{array}{l}
t_1 := \frac{x\_m}{z} \cdot \frac{-2}{t}\\
t_2 := 2 \cdot \frac{x\_m}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+42}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -950:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-90}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 9:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y}\\
\end{array}
\end{array}
\end{array}
if y < -1.25000000000000002e42 or -950 < y < -3.1000000000000001e-90Initial program 90.8%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -1.25000000000000002e42 < y < -950 or -3.1000000000000001e-90 < y < 9Initial program 87.4%
distribute-rgt-out--89.0%
Simplified89.0%
times-frac89.2%
Applied egg-rr89.2%
Taylor expanded in y around 0 77.5%
if 9 < y Initial program 88.3%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 80.6%
associate-*r/80.6%
*-commutative80.6%
*-commutative80.6%
times-frac83.2%
Simplified83.2%
Final simplification81.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ x_m z) (/ -2.0 t))) (t_2 (* 2.0 (/ x_m (* z y)))))
(*
x_s
(if (<= y -2e+44)
t_2
(if (<= y -950.0)
t_1
(if (<= y -3.85e-90)
t_2
(if (<= y 0.082) t_1 (/ (* x_m (/ 2.0 z)) y))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -2e+44) {
tmp = t_2;
} else if (y <= -950.0) {
tmp = t_1;
} else if (y <= -3.85e-90) {
tmp = t_2;
} else if (y <= 0.082) {
tmp = t_1;
} else {
tmp = (x_m * (2.0 / z)) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, 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 = (x_m / z) * ((-2.0d0) / t)
t_2 = 2.0d0 * (x_m / (z * y))
if (y <= (-2d+44)) then
tmp = t_2
else if (y <= (-950.0d0)) then
tmp = t_1
else if (y <= (-3.85d-90)) then
tmp = t_2
else if (y <= 0.082d0) then
tmp = t_1
else
tmp = (x_m * (2.0d0 / z)) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -2e+44) {
tmp = t_2;
} else if (y <= -950.0) {
tmp = t_1;
} else if (y <= -3.85e-90) {
tmp = t_2;
} else if (y <= 0.082) {
tmp = t_1;
} else {
tmp = (x_m * (2.0 / z)) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = (x_m / z) * (-2.0 / t) t_2 = 2.0 * (x_m / (z * y)) tmp = 0 if y <= -2e+44: tmp = t_2 elif y <= -950.0: tmp = t_1 elif y <= -3.85e-90: tmp = t_2 elif y <= 0.082: tmp = t_1 else: tmp = (x_m * (2.0 / z)) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(x_m / z) * Float64(-2.0 / t)) t_2 = Float64(2.0 * Float64(x_m / Float64(z * y))) tmp = 0.0 if (y <= -2e+44) tmp = t_2; elseif (y <= -950.0) tmp = t_1; elseif (y <= -3.85e-90) tmp = t_2; elseif (y <= 0.082) tmp = t_1; else tmp = Float64(Float64(x_m * Float64(2.0 / 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) t_1 = (x_m / z) * (-2.0 / t); t_2 = 2.0 * (x_m / (z * y)); tmp = 0.0; if (y <= -2e+44) tmp = t_2; elseif (y <= -950.0) tmp = t_1; elseif (y <= -3.85e-90) tmp = t_2; elseif (y <= 0.082) tmp = t_1; else tmp = (x_m * (2.0 / z)) / y; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2e+44], t$95$2, If[LessEqual[y, -950.0], t$95$1, If[LessEqual[y, -3.85e-90], t$95$2, If[LessEqual[y, 0.082], t$95$1, N[(N[(x$95$m * N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{x\_m}{z} \cdot \frac{-2}{t}\\
t_2 := 2 \cdot \frac{x\_m}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+44}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -950:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.85 \cdot 10^{-90}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 0.082:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \frac{2}{z}}{y}\\
\end{array}
\end{array}
\end{array}
if y < -2.0000000000000002e44 or -950 < y < -3.84999999999999986e-90Initial program 90.8%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -2.0000000000000002e44 < y < -950 or -3.84999999999999986e-90 < y < 0.0820000000000000034Initial program 87.4%
distribute-rgt-out--89.0%
Simplified89.0%
times-frac89.2%
Applied egg-rr89.2%
Taylor expanded in y around 0 77.5%
if 0.0820000000000000034 < y Initial program 88.3%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 80.6%
associate-*r/80.6%
*-commutative80.6%
*-commutative80.6%
times-frac83.2%
Simplified83.2%
frac-times80.6%
associate-/r*83.2%
associate-*r/83.2%
Applied egg-rr83.2%
Final simplification81.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ x_m z) (/ -2.0 t))) (t_2 (* 2.0 (/ x_m (* z y)))))
(*
x_s
(if (<= y -2.2e+40)
t_2
(if (<= y -980.0)
t_1
(if (<= y -3.85e-90)
t_2
(if (<= y 90.0) t_1 (/ (/ 2.0 y) (/ z x_m)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -2.2e+40) {
tmp = t_2;
} else if (y <= -980.0) {
tmp = t_1;
} else if (y <= -3.85e-90) {
tmp = t_2;
} else if (y <= 90.0) {
tmp = t_1;
} else {
tmp = (2.0 / y) / (z / 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 = (x_m / z) * ((-2.0d0) / t)
t_2 = 2.0d0 * (x_m / (z * y))
if (y <= (-2.2d+40)) then
tmp = t_2
else if (y <= (-980.0d0)) then
tmp = t_1
else if (y <= (-3.85d-90)) then
tmp = t_2
else if (y <= 90.0d0) then
tmp = t_1
else
tmp = (2.0d0 / y) / (z / 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 = (x_m / z) * (-2.0 / t);
double t_2 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -2.2e+40) {
tmp = t_2;
} else if (y <= -980.0) {
tmp = t_1;
} else if (y <= -3.85e-90) {
tmp = t_2;
} else if (y <= 90.0) {
tmp = t_1;
} else {
tmp = (2.0 / y) / (z / 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 = (x_m / z) * (-2.0 / t) t_2 = 2.0 * (x_m / (z * y)) tmp = 0 if y <= -2.2e+40: tmp = t_2 elif y <= -980.0: tmp = t_1 elif y <= -3.85e-90: tmp = t_2 elif y <= 90.0: tmp = t_1 else: tmp = (2.0 / y) / (z / 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(x_m / z) * Float64(-2.0 / t)) t_2 = Float64(2.0 * Float64(x_m / Float64(z * y))) tmp = 0.0 if (y <= -2.2e+40) tmp = t_2; elseif (y <= -980.0) tmp = t_1; elseif (y <= -3.85e-90) tmp = t_2; elseif (y <= 90.0) tmp = t_1; else tmp = Float64(Float64(2.0 / y) / Float64(z / 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 = (x_m / z) * (-2.0 / t); t_2 = 2.0 * (x_m / (z * y)); tmp = 0.0; if (y <= -2.2e+40) tmp = t_2; elseif (y <= -980.0) tmp = t_1; elseif (y <= -3.85e-90) tmp = t_2; elseif (y <= 90.0) tmp = t_1; else tmp = (2.0 / y) / (z / 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[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.2e+40], t$95$2, If[LessEqual[y, -980.0], t$95$1, If[LessEqual[y, -3.85e-90], t$95$2, If[LessEqual[y, 90.0], t$95$1, N[(N[(2.0 / y), $MachinePrecision] / N[(z / x$95$m), $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{x\_m}{z} \cdot \frac{-2}{t}\\
t_2 := 2 \cdot \frac{x\_m}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+40}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -980:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.85 \cdot 10^{-90}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 90:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{y}}{\frac{z}{x\_m}}\\
\end{array}
\end{array}
\end{array}
if y < -2.1999999999999999e40 or -980 < y < -3.84999999999999986e-90Initial program 90.8%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -2.1999999999999999e40 < y < -980 or -3.84999999999999986e-90 < y < 90Initial program 87.4%
distribute-rgt-out--89.0%
Simplified89.0%
times-frac89.2%
Applied egg-rr89.2%
Taylor expanded in y around 0 77.5%
if 90 < y Initial program 88.3%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 80.6%
associate-*r/80.6%
*-commutative80.6%
*-commutative80.6%
times-frac83.2%
Simplified83.2%
*-commutative83.2%
clear-num83.2%
un-div-inv84.5%
Applied egg-rr84.5%
Final simplification81.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* 2.0 (/ x_m (* z y)))))
(*
x_s
(if (<= y -3.1e+43)
t_1
(if (<= y -980.0)
(* (/ x_m z) (/ -2.0 t))
(if (<= y -2.25e-91)
t_1
(if (<= y 0.365)
(/ (/ (* x_m -2.0) t) z)
(/ (/ 2.0 y) (/ z x_m)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 2.0 * (x_m / (z * y));
double tmp;
if (y <= -3.1e+43) {
tmp = t_1;
} else if (y <= -980.0) {
tmp = (x_m / z) * (-2.0 / t);
} else if (y <= -2.25e-91) {
tmp = t_1;
} else if (y <= 0.365) {
tmp = ((x_m * -2.0) / t) / z;
} else {
tmp = (2.0 / y) / (z / 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 * (x_m / (z * y))
if (y <= (-3.1d+43)) then
tmp = t_1
else if (y <= (-980.0d0)) then
tmp = (x_m / z) * ((-2.0d0) / t)
else if (y <= (-2.25d-91)) then
tmp = t_1
else if (y <= 0.365d0) then
tmp = ((x_m * (-2.0d0)) / t) / z
else
tmp = (2.0d0 / y) / (z / 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 tmp;
if (y <= -3.1e+43) {
tmp = t_1;
} else if (y <= -980.0) {
tmp = (x_m / z) * (-2.0 / t);
} else if (y <= -2.25e-91) {
tmp = t_1;
} else if (y <= 0.365) {
tmp = ((x_m * -2.0) / t) / z;
} else {
tmp = (2.0 / y) / (z / 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)) tmp = 0 if y <= -3.1e+43: tmp = t_1 elif y <= -980.0: tmp = (x_m / z) * (-2.0 / t) elif y <= -2.25e-91: tmp = t_1 elif y <= 0.365: tmp = ((x_m * -2.0) / t) / z else: tmp = (2.0 / y) / (z / 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(x_m / Float64(z * y))) tmp = 0.0 if (y <= -3.1e+43) tmp = t_1; elseif (y <= -980.0) tmp = Float64(Float64(x_m / z) * Float64(-2.0 / t)); elseif (y <= -2.25e-91) tmp = t_1; elseif (y <= 0.365) tmp = Float64(Float64(Float64(x_m * -2.0) / t) / z); else tmp = Float64(Float64(2.0 / y) / Float64(z / 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)); tmp = 0.0; if (y <= -3.1e+43) tmp = t_1; elseif (y <= -980.0) tmp = (x_m / z) * (-2.0 / t); elseif (y <= -2.25e-91) tmp = t_1; elseif (y <= 0.365) tmp = ((x_m * -2.0) / t) / z; else tmp = (2.0 / y) / (z / 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[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -3.1e+43], t$95$1, If[LessEqual[y, -980.0], N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.25e-91], t$95$1, If[LessEqual[y, 0.365], N[(N[(N[(x$95$m * -2.0), $MachinePrecision] / t), $MachinePrecision] / z), $MachinePrecision], N[(N[(2.0 / y), $MachinePrecision] / N[(z / x$95$m), $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{x\_m}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -980:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{-2}{t}\\
\mathbf{elif}\;y \leq -2.25 \cdot 10^{-91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.365:\\
\;\;\;\;\frac{\frac{x\_m \cdot -2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{y}}{\frac{z}{x\_m}}\\
\end{array}
\end{array}
\end{array}
if y < -3.1000000000000002e43 or -980 < y < -2.24999999999999988e-91Initial program 90.8%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -3.1000000000000002e43 < y < -980Initial program 89.0%
distribute-rgt-out--89.0%
Simplified89.0%
times-frac100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 89.6%
if -2.24999999999999988e-91 < y < 0.36499999999999999Initial program 87.2%
distribute-rgt-out--89.0%
Simplified89.0%
Taylor expanded in y around 0 76.5%
*-commutative76.5%
Simplified76.5%
*-commutative76.5%
associate-*l/76.5%
*-commutative76.5%
associate-/r*78.0%
Applied egg-rr78.0%
if 0.36499999999999999 < y Initial program 88.3%
distribute-rgt-out--91.5%
Simplified91.5%
Taylor expanded in y around inf 80.6%
associate-*r/80.6%
*-commutative80.6%
*-commutative80.6%
times-frac83.2%
Simplified83.2%
*-commutative83.2%
clear-num83.2%
un-div-inv84.5%
Applied egg-rr84.5%
Final simplification82.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= t -2.1e+70) (not (<= t 4e-27)))
(* -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 ((t <= -2.1e+70) || !(t <= 4e-27)) {
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 ((t <= (-2.1d+70)) .or. (.not. (t <= 4d-27))) 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 ((t <= -2.1e+70) || !(t <= 4e-27)) {
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 (t <= -2.1e+70) or not (t <= 4e-27): 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 ((t <= -2.1e+70) || !(t <= 4e-27)) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); else tmp = Float64(2.0 * Float64(x_m / Float64(z * y))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((t <= -2.1e+70) || ~((t <= 4e-27))) 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[Or[LessEqual[t, -2.1e+70], N[Not[LessEqual[t, 4e-27]], $MachinePrecision]], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(x$95$m / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+70} \lor \neg \left(t \leq 4 \cdot 10^{-27}\right):\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{x\_m}{z \cdot y}\\
\end{array}
\end{array}
if t < -2.10000000000000008e70 or 4.0000000000000002e-27 < t Initial program 85.8%
distribute-rgt-out--90.2%
Simplified90.2%
Taylor expanded in y around 0 80.5%
*-commutative80.5%
Simplified80.5%
if -2.10000000000000008e70 < t < 4.0000000000000002e-27Initial program 90.8%
distribute-rgt-out--92.2%
Simplified92.2%
Taylor expanded in y around inf 74.9%
*-commutative74.9%
Simplified74.9%
Final simplification77.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= x_m 2e+41)
(* 2.0 (/ (/ x_m 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 <= 2e+41) {
tmp = 2.0 * ((x_m / 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 <= 2d+41) then
tmp = 2.0d0 * ((x_m / 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 <= 2e+41) {
tmp = 2.0 * ((x_m / 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 <= 2e+41: tmp = 2.0 * ((x_m / 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 (x_m <= 2e+41) tmp = Float64(2.0 * Float64(Float64(x_m / 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 <= 2e+41) tmp = 2.0 * ((x_m / 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[x$95$m, 2e+41], N[(2.0 * N[(N[(x$95$m / 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 \leq 2 \cdot 10^{+41}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if x < 2.00000000000000001e41Initial program 91.5%
distribute-rgt-out--94.5%
Simplified94.5%
Taylor expanded in x around 0 94.5%
associate-/r*92.7%
Simplified92.7%
if 2.00000000000000001e41 < x Initial program 78.3%
distribute-rgt-out--80.1%
Simplified80.1%
*-commutative80.1%
times-frac97.8%
Applied egg-rr97.8%
Final simplification93.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* 2.0 (/ (/ x_m 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 * (2.0 * ((x_m / 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 * (2.0d0 * ((x_m / 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 * (2.0 * ((x_m / 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 * (2.0 * ((x_m / 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(2.0 * Float64(Float64(x_m / 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 * (2.0 * ((x_m / 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[(2.0 * N[(N[(x$95$m / 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(2 \cdot \frac{\frac{x\_m}{z}}{y - t}\right)
\end{array}
Initial program 88.5%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in x around 0 91.3%
associate-/r*91.0%
Simplified91.0%
Final simplification91.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 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 88.5%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in y around 0 52.3%
*-commutative52.3%
Simplified52.3%
Final simplification52.3%
(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 2024053
(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))))