
(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) 5e-62)
(* (/ 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) <= 5e-62) {
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) <= 5d-62) 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) <= 5e-62) {
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) <= 5e-62: 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) <= 5e-62) 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) <= 5e-62) 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], 5e-62], 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 5 \cdot 10^{-62}:\\
\;\;\;\;\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 2) < 5.0000000000000002e-62Initial program 89.1%
distribute-rgt-out--93.5%
times-frac92.7%
Simplified92.7%
if 5.0000000000000002e-62 < (*.f64 x 2) Initial program 90.8%
distribute-rgt-out--92.2%
Simplified92.2%
*-commutative92.2%
times-frac98.3%
Applied egg-rr98.3%
Final simplification94.3%
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 z) (/ x_m y))))
(*
x_s
(if (<= t -2.6e+157)
(* -2.0 (/ x_m (* z t)))
(if (<= t -2.9e+115)
t_1
(if (<= t -7.5e-15)
(* x_m (/ (/ -2.0 t) z))
(if (<= t 4.3e-65) t_1 (* -2.0 (/ (/ x_m t) 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 t_1 = (2.0 / z) * (x_m / y);
double tmp;
if (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = t_1;
} else if (t <= -7.5e-15) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 4.3e-65) {
tmp = t_1;
} else {
tmp = -2.0 * ((x_m / t) / 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) :: t_1
real(8) :: tmp
t_1 = (2.0d0 / z) * (x_m / y)
if (t <= (-2.6d+157)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= (-2.9d+115)) then
tmp = t_1
else if (t <= (-7.5d-15)) then
tmp = x_m * (((-2.0d0) / t) / z)
else if (t <= 4.3d-65) then
tmp = t_1
else
tmp = (-2.0d0) * ((x_m / t) / 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 t_1 = (2.0 / z) * (x_m / y);
double tmp;
if (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = t_1;
} else if (t <= -7.5e-15) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 4.3e-65) {
tmp = t_1;
} else {
tmp = -2.0 * ((x_m / t) / 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): t_1 = (2.0 / z) * (x_m / y) tmp = 0 if t <= -2.6e+157: tmp = -2.0 * (x_m / (z * t)) elif t <= -2.9e+115: tmp = t_1 elif t <= -7.5e-15: tmp = x_m * ((-2.0 / t) / z) elif t <= 4.3e-65: tmp = t_1 else: tmp = -2.0 * ((x_m / t) / z) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(2.0 / z) * Float64(x_m / y)) tmp = 0.0 if (t <= -2.6e+157) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= -2.9e+115) tmp = t_1; elseif (t <= -7.5e-15) tmp = Float64(x_m * Float64(Float64(-2.0 / t) / z)); elseif (t <= 4.3e-65) tmp = t_1; else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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) t_1 = (2.0 / z) * (x_m / y); tmp = 0.0; if (t <= -2.6e+157) tmp = -2.0 * (x_m / (z * t)); elseif (t <= -2.9e+115) tmp = t_1; elseif (t <= -7.5e-15) tmp = x_m * ((-2.0 / t) / z); elseif (t <= 4.3e-65) tmp = t_1; else tmp = -2.0 * ((x_m / t) / 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_] := Block[{t$95$1 = N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -2.6e+157], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.9e+115], t$95$1, If[LessEqual[t, -7.5e-15], N[(x$95$m * N[(N[(-2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.3e-65], t$95$1, N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{2}{z} \cdot \frac{x\_m}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+157}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -7.5 \cdot 10^{-15}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{t}}{z}\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{t}}{z}\\
\end{array}
\end{array}
\end{array}
if t < -2.60000000000000011e157Initial program 90.9%
*-commutative90.9%
associate-*l/90.5%
*-commutative90.5%
distribute-rgt-out--94.0%
associate-/l/94.2%
Simplified94.2%
Taylor expanded in y around 0 94.3%
*-commutative94.3%
Simplified94.3%
if -2.60000000000000011e157 < t < -2.90000000000000005e115 or -7.4999999999999996e-15 < t < 4.30000000000000024e-65Initial program 88.7%
distribute-rgt-out--92.5%
Simplified92.5%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
Simplified74.0%
*-commutative74.0%
times-frac77.9%
Applied egg-rr77.9%
if -2.90000000000000005e115 < t < -7.4999999999999996e-15Initial program 96.0%
*-commutative96.0%
associate-*l/95.8%
*-commutative95.8%
distribute-rgt-out--95.7%
associate-/l/98.0%
Simplified98.0%
Taylor expanded in y around 0 72.1%
if 4.30000000000000024e-65 < t Initial program 88.3%
*-commutative88.3%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--92.8%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around 0 71.8%
associate-/r*74.4%
Simplified74.4%
Final simplification78.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -2.6e+157)
(* -2.0 (/ x_m (* z t)))
(if (<= t -2.9e+115)
(* (/ 2.0 z) (/ x_m y))
(if (<= t -1.1e-14)
(* x_m (/ (/ -2.0 t) z))
(if (<= t 4.2e-65)
(/ 2.0 (* z (/ y x_m)))
(* -2.0 (/ (/ x_m t) 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 (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= -1.1e-14) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 4.2e-65) {
tmp = 2.0 / (z * (y / x_m));
} else {
tmp = -2.0 * ((x_m / t) / 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 (t <= (-2.6d+157)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= (-2.9d+115)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (t <= (-1.1d-14)) then
tmp = x_m * (((-2.0d0) / t) / z)
else if (t <= 4.2d-65) then
tmp = 2.0d0 / (z * (y / x_m))
else
tmp = (-2.0d0) * ((x_m / t) / 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 (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= -1.1e-14) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 4.2e-65) {
tmp = 2.0 / (z * (y / x_m));
} else {
tmp = -2.0 * ((x_m / t) / 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 t <= -2.6e+157: tmp = -2.0 * (x_m / (z * t)) elif t <= -2.9e+115: tmp = (2.0 / z) * (x_m / y) elif t <= -1.1e-14: tmp = x_m * ((-2.0 / t) / z) elif t <= 4.2e-65: tmp = 2.0 / (z * (y / x_m)) else: tmp = -2.0 * ((x_m / t) / 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 (t <= -2.6e+157) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= -2.9e+115) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (t <= -1.1e-14) tmp = Float64(x_m * Float64(Float64(-2.0 / t) / z)); elseif (t <= 4.2e-65) tmp = Float64(2.0 / Float64(z * Float64(y / x_m))); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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 (t <= -2.6e+157) tmp = -2.0 * (x_m / (z * t)); elseif (t <= -2.9e+115) tmp = (2.0 / z) * (x_m / y); elseif (t <= -1.1e-14) tmp = x_m * ((-2.0 / t) / z); elseif (t <= 4.2e-65) tmp = 2.0 / (z * (y / x_m)); else tmp = -2.0 * ((x_m / t) / 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[t, -2.6e+157], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.9e+115], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.1e-14], N[(x$95$m * N[(N[(-2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.2e-65], N[(2.0 / N[(z * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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}\;t \leq -2.6 \cdot 10^{+157}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{+115}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;t \leq -1.1 \cdot 10^{-14}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{t}}{z}\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{2}{z \cdot \frac{y}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{t}}{z}\\
\end{array}
\end{array}
if t < -2.60000000000000011e157Initial program 90.9%
*-commutative90.9%
associate-*l/90.5%
*-commutative90.5%
distribute-rgt-out--94.0%
associate-/l/94.2%
Simplified94.2%
Taylor expanded in y around 0 94.3%
*-commutative94.3%
Simplified94.3%
if -2.60000000000000011e157 < t < -2.90000000000000005e115Initial program 31.3%
distribute-rgt-out--45.6%
Simplified45.6%
Taylor expanded in y around inf 45.6%
*-commutative45.6%
Simplified45.6%
*-commutative45.6%
times-frac86.9%
Applied egg-rr86.9%
if -2.90000000000000005e115 < t < -1.1e-14Initial program 96.0%
*-commutative96.0%
associate-*l/95.8%
*-commutative95.8%
distribute-rgt-out--95.7%
associate-/l/98.0%
Simplified98.0%
Taylor expanded in y around 0 72.1%
if -1.1e-14 < t < 4.20000000000000006e-65Initial program 91.9%
*-commutative91.9%
associate-*l/91.1%
*-commutative91.1%
distribute-rgt-out--94.3%
associate-/l/94.8%
Simplified94.8%
Taylor expanded in y around inf 74.8%
associate-/r*75.3%
Simplified75.3%
associate-/l/74.8%
associate-*r/75.6%
*-commutative75.6%
frac-times77.4%
clear-num77.4%
frac-times77.7%
metadata-eval77.7%
Applied egg-rr77.7%
if 4.20000000000000006e-65 < t Initial program 88.3%
*-commutative88.3%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--92.8%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around 0 71.8%
associate-/r*74.4%
Simplified74.4%
Final simplification78.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 (<= t -2.6e+157)
(* -2.0 (/ x_m (* z t)))
(if (<= t -2.9e+115)
(* (/ 2.0 z) (/ x_m y))
(if (<= t -1.8e-16)
(* x_m (/ (/ -2.0 t) z))
(if (<= t 4e-65) (/ (/ 2.0 z) (/ y x_m)) (* -2.0 (/ (/ x_m t) 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 (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= -1.8e-16) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 4e-65) {
tmp = (2.0 / z) / (y / x_m);
} else {
tmp = -2.0 * ((x_m / t) / 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 (t <= (-2.6d+157)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= (-2.9d+115)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (t <= (-1.8d-16)) then
tmp = x_m * (((-2.0d0) / t) / z)
else if (t <= 4d-65) then
tmp = (2.0d0 / z) / (y / x_m)
else
tmp = (-2.0d0) * ((x_m / t) / 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 (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= -1.8e-16) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 4e-65) {
tmp = (2.0 / z) / (y / x_m);
} else {
tmp = -2.0 * ((x_m / t) / 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 t <= -2.6e+157: tmp = -2.0 * (x_m / (z * t)) elif t <= -2.9e+115: tmp = (2.0 / z) * (x_m / y) elif t <= -1.8e-16: tmp = x_m * ((-2.0 / t) / z) elif t <= 4e-65: tmp = (2.0 / z) / (y / x_m) else: tmp = -2.0 * ((x_m / t) / 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 (t <= -2.6e+157) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= -2.9e+115) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (t <= -1.8e-16) tmp = Float64(x_m * Float64(Float64(-2.0 / t) / z)); elseif (t <= 4e-65) tmp = Float64(Float64(2.0 / z) / Float64(y / x_m)); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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 (t <= -2.6e+157) tmp = -2.0 * (x_m / (z * t)); elseif (t <= -2.9e+115) tmp = (2.0 / z) * (x_m / y); elseif (t <= -1.8e-16) tmp = x_m * ((-2.0 / t) / z); elseif (t <= 4e-65) tmp = (2.0 / z) / (y / x_m); else tmp = -2.0 * ((x_m / t) / 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[t, -2.6e+157], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.9e+115], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.8e-16], N[(x$95$m * N[(N[(-2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4e-65], N[(N[(2.0 / z), $MachinePrecision] / N[(y / x$95$m), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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}\;t \leq -2.6 \cdot 10^{+157}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{+115}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-16}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{t}}{z}\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\frac{2}{z}}{\frac{y}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{t}}{z}\\
\end{array}
\end{array}
if t < -2.60000000000000011e157Initial program 90.9%
*-commutative90.9%
associate-*l/90.5%
*-commutative90.5%
distribute-rgt-out--94.0%
associate-/l/94.2%
Simplified94.2%
Taylor expanded in y around 0 94.3%
*-commutative94.3%
Simplified94.3%
if -2.60000000000000011e157 < t < -2.90000000000000005e115Initial program 31.3%
distribute-rgt-out--45.6%
Simplified45.6%
Taylor expanded in y around inf 45.6%
*-commutative45.6%
Simplified45.6%
*-commutative45.6%
times-frac86.9%
Applied egg-rr86.9%
if -2.90000000000000005e115 < t < -1.79999999999999991e-16Initial program 96.0%
*-commutative96.0%
associate-*l/95.8%
*-commutative95.8%
distribute-rgt-out--95.7%
associate-/l/98.0%
Simplified98.0%
Taylor expanded in y around 0 72.1%
if -1.79999999999999991e-16 < t < 3.99999999999999969e-65Initial program 91.9%
*-commutative91.9%
associate-*l/91.1%
*-commutative91.1%
distribute-rgt-out--94.3%
associate-/l/94.8%
Simplified94.8%
Taylor expanded in y around inf 74.8%
associate-/r*75.3%
Simplified75.3%
associate-/l/74.8%
associate-*r/75.6%
*-commutative75.6%
frac-times77.4%
clear-num77.4%
un-div-inv77.8%
Applied egg-rr77.8%
if 3.99999999999999969e-65 < t Initial program 88.3%
*-commutative88.3%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--92.8%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around 0 71.8%
associate-/r*74.4%
Simplified74.4%
Final simplification78.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 (<= t -2.6e+157)
(* -2.0 (/ x_m (* z t)))
(if (<= t -2.9e+115)
(* (/ 2.0 z) (/ x_m y))
(if (<= t -1.35e-15)
(* x_m (/ (/ -2.0 t) z))
(if (<= t 2.8e-65)
(/ (/ (* x_m 2.0) y) z)
(* -2.0 (/ (/ x_m t) 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 (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= -1.35e-15) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 2.8e-65) {
tmp = ((x_m * 2.0) / y) / z;
} else {
tmp = -2.0 * ((x_m / t) / 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 (t <= (-2.6d+157)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= (-2.9d+115)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (t <= (-1.35d-15)) then
tmp = x_m * (((-2.0d0) / t) / z)
else if (t <= 2.8d-65) then
tmp = ((x_m * 2.0d0) / y) / z
else
tmp = (-2.0d0) * ((x_m / t) / 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 (t <= -2.6e+157) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= -2.9e+115) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= -1.35e-15) {
tmp = x_m * ((-2.0 / t) / z);
} else if (t <= 2.8e-65) {
tmp = ((x_m * 2.0) / y) / z;
} else {
tmp = -2.0 * ((x_m / t) / 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 t <= -2.6e+157: tmp = -2.0 * (x_m / (z * t)) elif t <= -2.9e+115: tmp = (2.0 / z) * (x_m / y) elif t <= -1.35e-15: tmp = x_m * ((-2.0 / t) / z) elif t <= 2.8e-65: tmp = ((x_m * 2.0) / y) / z else: tmp = -2.0 * ((x_m / t) / 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 (t <= -2.6e+157) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= -2.9e+115) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (t <= -1.35e-15) tmp = Float64(x_m * Float64(Float64(-2.0 / t) / z)); elseif (t <= 2.8e-65) tmp = Float64(Float64(Float64(x_m * 2.0) / y) / z); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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 (t <= -2.6e+157) tmp = -2.0 * (x_m / (z * t)); elseif (t <= -2.9e+115) tmp = (2.0 / z) * (x_m / y); elseif (t <= -1.35e-15) tmp = x_m * ((-2.0 / t) / z); elseif (t <= 2.8e-65) tmp = ((x_m * 2.0) / y) / z; else tmp = -2.0 * ((x_m / t) / 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[t, -2.6e+157], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.9e+115], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.35e-15], N[(x$95$m * N[(N[(-2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e-65], N[(N[(N[(x$95$m * 2.0), $MachinePrecision] / y), $MachinePrecision] / z), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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}\;t \leq -2.6 \cdot 10^{+157}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{+115}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;t \leq -1.35 \cdot 10^{-15}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-2}{t}}{z}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-65}:\\
\;\;\;\;\frac{\frac{x\_m \cdot 2}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{t}}{z}\\
\end{array}
\end{array}
if t < -2.60000000000000011e157Initial program 90.9%
*-commutative90.9%
associate-*l/90.5%
*-commutative90.5%
distribute-rgt-out--94.0%
associate-/l/94.2%
Simplified94.2%
Taylor expanded in y around 0 94.3%
*-commutative94.3%
Simplified94.3%
if -2.60000000000000011e157 < t < -2.90000000000000005e115Initial program 31.3%
distribute-rgt-out--45.6%
Simplified45.6%
Taylor expanded in y around inf 45.6%
*-commutative45.6%
Simplified45.6%
*-commutative45.6%
times-frac86.9%
Applied egg-rr86.9%
if -2.90000000000000005e115 < t < -1.35000000000000005e-15Initial program 96.0%
*-commutative96.0%
associate-*l/95.8%
*-commutative95.8%
distribute-rgt-out--95.7%
associate-/l/98.0%
Simplified98.0%
Taylor expanded in y around 0 72.1%
if -1.35000000000000005e-15 < t < 2.8e-65Initial program 91.9%
*-commutative91.9%
associate-*l/91.1%
*-commutative91.1%
distribute-rgt-out--94.3%
associate-/l/94.8%
Simplified94.8%
associate-*r/96.5%
Applied egg-rr96.5%
Taylor expanded in y around inf 78.3%
associate-*r/78.3%
Simplified78.3%
if 2.8e-65 < t Initial program 88.3%
*-commutative88.3%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--92.8%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around 0 71.8%
associate-/r*74.4%
Simplified74.4%
Final simplification78.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -8.5e-67)
(* -2.0 (/ x_m (* z t)))
(if (<= t 3.7e-65) (* x_m (/ (/ 2.0 y) z)) (* -2.0 (/ (/ x_m t) 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 (t <= -8.5e-67) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 3.7e-65) {
tmp = x_m * ((2.0 / y) / z);
} else {
tmp = -2.0 * ((x_m / t) / 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 (t <= (-8.5d-67)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 3.7d-65) then
tmp = x_m * ((2.0d0 / y) / z)
else
tmp = (-2.0d0) * ((x_m / t) / 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 (t <= -8.5e-67) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 3.7e-65) {
tmp = x_m * ((2.0 / y) / z);
} else {
tmp = -2.0 * ((x_m / t) / 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 t <= -8.5e-67: tmp = -2.0 * (x_m / (z * t)) elif t <= 3.7e-65: tmp = x_m * ((2.0 / y) / z) else: tmp = -2.0 * ((x_m / t) / 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 (t <= -8.5e-67) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 3.7e-65) tmp = Float64(x_m * Float64(Float64(2.0 / y) / z)); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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 (t <= -8.5e-67) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 3.7e-65) tmp = x_m * ((2.0 / y) / z); else tmp = -2.0 * ((x_m / t) / 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[t, -8.5e-67], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.7e-65], N[(x$95$m * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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}\;t \leq -8.5 \cdot 10^{-67}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{-65}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{t}}{z}\\
\end{array}
\end{array}
if t < -8.49999999999999993e-67Initial program 86.8%
*-commutative86.8%
associate-*l/86.5%
*-commutative86.5%
distribute-rgt-out--89.1%
associate-/l/90.5%
Simplified90.5%
Taylor expanded in y around 0 71.5%
*-commutative71.5%
Simplified71.5%
if -8.49999999999999993e-67 < t < 3.7e-65Initial program 92.5%
*-commutative92.5%
associate-*l/91.5%
*-commutative91.5%
distribute-rgt-out--95.3%
associate-/l/95.4%
Simplified95.4%
Taylor expanded in y around inf 79.3%
associate-/r*79.4%
Simplified79.4%
if 3.7e-65 < t Initial program 88.3%
*-commutative88.3%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--92.8%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around 0 71.8%
associate-/r*74.4%
Simplified74.4%
Final simplification75.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 (- y t)))) (* x_s (if (<= z 1.6e+61) (* x_m (/ t_1 z)) (* (/ x_m z) t_1)))))
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 / (y - t);
double tmp;
if (z <= 1.6e+61) {
tmp = x_m * (t_1 / z);
} else {
tmp = (x_m / z) * t_1;
}
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 / (y - t)
if (z <= 1.6d+61) then
tmp = x_m * (t_1 / z)
else
tmp = (x_m / z) * t_1
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 / (y - t);
double tmp;
if (z <= 1.6e+61) {
tmp = x_m * (t_1 / z);
} else {
tmp = (x_m / z) * t_1;
}
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 / (y - t) tmp = 0 if z <= 1.6e+61: tmp = x_m * (t_1 / z) else: tmp = (x_m / z) * t_1 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(y - t)) tmp = 0.0 if (z <= 1.6e+61) tmp = Float64(x_m * Float64(t_1 / z)); else tmp = Float64(Float64(x_m / z) * t_1); 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 / (y - t); tmp = 0.0; if (z <= 1.6e+61) tmp = x_m * (t_1 / z); else tmp = (x_m / z) * t_1; 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[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, 1.6e+61], N[(x$95$m * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * t$95$1), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{2}{y - t}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.6 \cdot 10^{+61}:\\
\;\;\;\;x\_m \cdot \frac{t\_1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot t\_1\\
\end{array}
\end{array}
\end{array}
if z < 1.5999999999999999e61Initial program 93.2%
*-commutative93.2%
associate-*l/92.6%
*-commutative92.6%
distribute-rgt-out--95.1%
associate-/l/95.2%
Simplified95.2%
if 1.5999999999999999e61 < z Initial program 74.8%
distribute-rgt-out--82.9%
times-frac95.6%
Simplified95.6%
Final simplification95.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= y 4e-223) (* -2.0 (/ x_m (* z t))) (* -2.0 (/ (/ x_m t) 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 (y <= 4e-223) {
tmp = -2.0 * (x_m / (z * t));
} else {
tmp = -2.0 * ((x_m / t) / 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 (y <= 4d-223) then
tmp = (-2.0d0) * (x_m / (z * t))
else
tmp = (-2.0d0) * ((x_m / t) / 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 (y <= 4e-223) {
tmp = -2.0 * (x_m / (z * t));
} else {
tmp = -2.0 * ((x_m / t) / 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 y <= 4e-223: tmp = -2.0 * (x_m / (z * t)) else: tmp = -2.0 * ((x_m / t) / 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 (y <= 4e-223) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / 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 (y <= 4e-223) tmp = -2.0 * (x_m / (z * t)); else tmp = -2.0 * ((x_m / t) / 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[y, 4e-223], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / 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}\;y \leq 4 \cdot 10^{-223}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{t}}{z}\\
\end{array}
\end{array}
if y < 3.9999999999999999e-223Initial program 90.6%
*-commutative90.6%
associate-*l/89.8%
*-commutative89.8%
distribute-rgt-out--93.3%
associate-/l/94.0%
Simplified94.0%
Taylor expanded in y around 0 55.7%
*-commutative55.7%
Simplified55.7%
if 3.9999999999999999e-223 < y Initial program 88.2%
*-commutative88.2%
associate-*l/88.1%
*-commutative88.1%
distribute-rgt-out--91.9%
associate-/l/92.0%
Simplified92.0%
Taylor expanded in y around 0 44.7%
associate-/r*48.9%
Simplified48.9%
Final simplification52.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ (/ 2.0 z) (- y t)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((2.0 / z) / (y - t)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m * ((2.0d0 / z) / (y - t)))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((2.0 / z) / (y - t)));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * ((2.0 / z) / (y - t)))
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(Float64(2.0 / z) / Float64(y - t)))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * ((2.0 / z) / (y - t))); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \frac{\frac{2}{z}}{y - t}\right)
\end{array}
Initial program 89.6%
*-commutative89.6%
associate-*l/89.1%
*-commutative89.1%
distribute-rgt-out--92.7%
associate-/l/93.2%
Simplified93.2%
associate-*r/94.4%
associate-*l/90.7%
clear-num90.3%
frac-times90.8%
metadata-eval90.8%
Applied egg-rr90.8%
Taylor expanded in z around 0 93.1%
associate-*r/93.2%
associate-*l/92.7%
*-commutative92.7%
associate-/r*92.8%
Simplified92.8%
Final simplification92.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ (/ 2.0 (- y t)) 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) {
return x_s * (x_m * ((2.0 / (y - t)) / z));
}
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 / (y - t)) / z))
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 / (y - t)) / z));
}
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 / (y - t)) / z))
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(Float64(2.0 / Float64(y - t)) / z))) 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 / (y - t)) / z)); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \frac{\frac{2}{y - t}}{z}\right)
\end{array}
Initial program 89.6%
*-commutative89.6%
associate-*l/89.1%
*-commutative89.1%
distribute-rgt-out--92.7%
associate-/l/93.2%
Simplified93.2%
Final simplification93.2%
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 89.6%
*-commutative89.6%
associate-*l/89.1%
*-commutative89.1%
distribute-rgt-out--92.7%
associate-/l/93.2%
Simplified93.2%
Taylor expanded in y around 0 51.1%
*-commutative51.1%
Simplified51.1%
Final simplification51.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 2024031
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(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))))