
(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 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 1000000.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) <= 1000000.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) <= 1000000.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) <= 1000000.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) <= 1000000.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) <= 1000000.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) <= 1000000.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], 1000000.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 1000000:\\
\;\;\;\;\frac{x\_m \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 1e6Initial program 91.4%
distribute-rgt-out--94.6%
Simplified94.6%
if 1e6 < (*.f64 x #s(literal 2 binary64)) Initial program 70.4%
distribute-rgt-out--77.4%
Simplified77.4%
*-commutative77.4%
times-frac94.8%
Applied egg-rr94.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 (<= t -5.6e+122)
(/ (/ (* x_m -2.0) t) z)
(if (<= t -1.4e-187)
(/ (* 2.0 (/ x_m y)) z)
(if (<= t 6.2e-141) (* x_m (/ (/ 2.0 z) y)) (* -2.0 (/ (/ x_m z) t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -5.6e+122) {
tmp = ((x_m * -2.0) / t) / z;
} else if (t <= -1.4e-187) {
tmp = (2.0 * (x_m / y)) / z;
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5.6d+122)) then
tmp = ((x_m * (-2.0d0)) / t) / z
else if (t <= (-1.4d-187)) then
tmp = (2.0d0 * (x_m / y)) / z
else if (t <= 6.2d-141) then
tmp = x_m * ((2.0d0 / z) / y)
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -5.6e+122) {
tmp = ((x_m * -2.0) / t) / z;
} else if (t <= -1.4e-187) {
tmp = (2.0 * (x_m / y)) / z;
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -5.6e+122: tmp = ((x_m * -2.0) / t) / z elif t <= -1.4e-187: tmp = (2.0 * (x_m / y)) / z elif t <= 6.2e-141: tmp = x_m * ((2.0 / z) / y) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -5.6e+122) tmp = Float64(Float64(Float64(x_m * -2.0) / t) / z); elseif (t <= -1.4e-187) tmp = Float64(Float64(2.0 * Float64(x_m / y)) / z); elseif (t <= 6.2e-141) tmp = Float64(x_m * Float64(Float64(2.0 / z) / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (t <= -5.6e+122) tmp = ((x_m * -2.0) / t) / z; elseif (t <= -1.4e-187) tmp = (2.0 * (x_m / y)) / z; elseif (t <= 6.2e-141) tmp = x_m * ((2.0 / z) / y); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -5.6e+122], N[(N[(N[(x$95$m * -2.0), $MachinePrecision] / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, -1.4e-187], N[(N[(2.0 * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 6.2e-141], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+122}:\\
\;\;\;\;\frac{\frac{x\_m \cdot -2}{t}}{z}\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{-187}:\\
\;\;\;\;\frac{2 \cdot \frac{x\_m}{y}}{z}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-141}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -5.5999999999999999e122Initial program 86.1%
distribute-rgt-out--89.7%
Simplified89.7%
Taylor expanded in y around 0 70.8%
*-commutative70.8%
Simplified70.8%
*-commutative70.8%
associate-*l/70.8%
metadata-eval70.8%
distribute-rgt-neg-in70.8%
*-commutative70.8%
associate-/r*77.5%
distribute-rgt-neg-in77.5%
metadata-eval77.5%
Applied egg-rr77.5%
if -5.5999999999999999e122 < t < -1.4e-187Initial program 82.7%
distribute-rgt-out--86.3%
Simplified86.3%
Taylor expanded in y around inf 58.9%
associate-/r*71.9%
associate-*r/71.9%
Simplified71.9%
if -1.4e-187 < t < 6.20000000000000055e-141Initial program 92.6%
distribute-rgt-out--97.4%
Simplified97.4%
distribute-rgt-out--92.6%
associate-/l*92.5%
*-commutative92.5%
distribute-rgt-out--97.4%
Applied egg-rr97.4%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
associate-/r*87.8%
Simplified87.8%
if 6.20000000000000055e-141 < t Initial program 83.7%
distribute-rgt-out--87.3%
Simplified87.3%
Taylor expanded in y around 0 69.1%
*-commutative69.1%
associate-/r*77.3%
Simplified77.3%
Final simplification79.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -5.6e+122)
(/ -2.0 (* t (/ z x_m)))
(if (<= t -1.8e-187)
(/ (* 2.0 (/ x_m y)) z)
(if (<= t 6.2e-141) (* x_m (/ (/ 2.0 z) y)) (* -2.0 (/ (/ x_m z) t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -5.6e+122) {
tmp = -2.0 / (t * (z / x_m));
} else if (t <= -1.8e-187) {
tmp = (2.0 * (x_m / y)) / z;
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5.6d+122)) then
tmp = (-2.0d0) / (t * (z / x_m))
else if (t <= (-1.8d-187)) then
tmp = (2.0d0 * (x_m / y)) / z
else if (t <= 6.2d-141) then
tmp = x_m * ((2.0d0 / z) / y)
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -5.6e+122) {
tmp = -2.0 / (t * (z / x_m));
} else if (t <= -1.8e-187) {
tmp = (2.0 * (x_m / y)) / z;
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -5.6e+122: tmp = -2.0 / (t * (z / x_m)) elif t <= -1.8e-187: tmp = (2.0 * (x_m / y)) / z elif t <= 6.2e-141: tmp = x_m * ((2.0 / z) / y) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -5.6e+122) tmp = Float64(-2.0 / Float64(t * Float64(z / x_m))); elseif (t <= -1.8e-187) tmp = Float64(Float64(2.0 * Float64(x_m / y)) / z); elseif (t <= 6.2e-141) tmp = Float64(x_m * Float64(Float64(2.0 / z) / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (t <= -5.6e+122) tmp = -2.0 / (t * (z / x_m)); elseif (t <= -1.8e-187) tmp = (2.0 * (x_m / y)) / z; elseif (t <= 6.2e-141) tmp = x_m * ((2.0 / z) / y); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -5.6e+122], N[(-2.0 / N[(t * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.8e-187], N[(N[(2.0 * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 6.2e-141], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+122}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z}{x\_m}}\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-187}:\\
\;\;\;\;\frac{2 \cdot \frac{x\_m}{y}}{z}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-141}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -5.5999999999999999e122Initial program 86.1%
distribute-rgt-out--89.7%
Simplified89.7%
Taylor expanded in y around 0 70.8%
*-commutative70.8%
Simplified70.8%
clear-num70.8%
un-div-inv70.8%
*-commutative70.8%
associate-/l*75.4%
Applied egg-rr75.4%
if -5.5999999999999999e122 < t < -1.79999999999999997e-187Initial program 82.7%
distribute-rgt-out--86.3%
Simplified86.3%
Taylor expanded in y around inf 58.9%
associate-/r*71.9%
associate-*r/71.9%
Simplified71.9%
if -1.79999999999999997e-187 < t < 6.20000000000000055e-141Initial program 92.6%
distribute-rgt-out--97.4%
Simplified97.4%
distribute-rgt-out--92.6%
associate-/l*92.5%
*-commutative92.5%
distribute-rgt-out--97.4%
Applied egg-rr97.4%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
associate-/r*87.8%
Simplified87.8%
if 6.20000000000000055e-141 < t Initial program 83.7%
distribute-rgt-out--87.3%
Simplified87.3%
Taylor expanded in y around 0 69.1%
*-commutative69.1%
associate-/r*77.3%
Simplified77.3%
Final simplification79.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 (<= t -9.5e+122)
(/ -2.0 (* t (/ z x_m)))
(if (<= t -1.8e-187)
(* (/ 2.0 z) (/ x_m y))
(if (<= t 6.2e-141) (* x_m (/ (/ 2.0 z) y)) (* -2.0 (/ (/ x_m z) t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -9.5e+122) {
tmp = -2.0 / (t * (z / x_m));
} else if (t <= -1.8e-187) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-9.5d+122)) then
tmp = (-2.0d0) / (t * (z / x_m))
else if (t <= (-1.8d-187)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (t <= 6.2d-141) then
tmp = x_m * ((2.0d0 / z) / y)
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -9.5e+122) {
tmp = -2.0 / (t * (z / x_m));
} else if (t <= -1.8e-187) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -9.5e+122: tmp = -2.0 / (t * (z / x_m)) elif t <= -1.8e-187: tmp = (2.0 / z) * (x_m / y) elif t <= 6.2e-141: tmp = x_m * ((2.0 / z) / y) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -9.5e+122) tmp = Float64(-2.0 / Float64(t * Float64(z / x_m))); elseif (t <= -1.8e-187) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (t <= 6.2e-141) tmp = Float64(x_m * Float64(Float64(2.0 / z) / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (t <= -9.5e+122) tmp = -2.0 / (t * (z / x_m)); elseif (t <= -1.8e-187) tmp = (2.0 / z) * (x_m / y); elseif (t <= 6.2e-141) tmp = x_m * ((2.0 / z) / y); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -9.5e+122], N[(-2.0 / N[(t * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.8e-187], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.2e-141], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z}{x\_m}}\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-187}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-141}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -9.49999999999999986e122Initial program 86.1%
distribute-rgt-out--89.7%
Simplified89.7%
Taylor expanded in y around 0 70.8%
*-commutative70.8%
Simplified70.8%
clear-num70.8%
un-div-inv70.8%
*-commutative70.8%
associate-/l*75.4%
Applied egg-rr75.4%
if -9.49999999999999986e122 < t < -1.79999999999999997e-187Initial program 82.7%
distribute-rgt-out--86.3%
Simplified86.3%
*-commutative86.3%
times-frac97.5%
Applied egg-rr97.5%
Taylor expanded in y around inf 71.8%
if -1.79999999999999997e-187 < t < 6.20000000000000055e-141Initial program 92.6%
distribute-rgt-out--97.4%
Simplified97.4%
distribute-rgt-out--92.6%
associate-/l*92.5%
*-commutative92.5%
distribute-rgt-out--97.4%
Applied egg-rr97.4%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
associate-/r*87.8%
Simplified87.8%
if 6.20000000000000055e-141 < t Initial program 83.7%
distribute-rgt-out--87.3%
Simplified87.3%
Taylor expanded in y around 0 69.1%
*-commutative69.1%
associate-/r*77.3%
Simplified77.3%
Final simplification79.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
(let* ((t_1 (* -2.0 (/ (/ x_m z) t))))
(*
x_s
(if (<= t -5.6e+122)
t_1
(if (<= t -1.7e-187)
(* (/ 2.0 z) (/ x_m y))
(if (<= t 6.2e-141) (* x_m (/ (/ 2.0 z) y)) 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 * ((x_m / z) / t);
double tmp;
if (t <= -5.6e+122) {
tmp = t_1;
} else if (t <= -1.7e-187) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = 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) * ((x_m / z) / t)
if (t <= (-5.6d+122)) then
tmp = t_1
else if (t <= (-1.7d-187)) then
tmp = (2.0d0 / z) * (x_m / y)
else if (t <= 6.2d-141) then
tmp = x_m * ((2.0d0 / z) / y)
else
tmp = 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 * ((x_m / z) / t);
double tmp;
if (t <= -5.6e+122) {
tmp = t_1;
} else if (t <= -1.7e-187) {
tmp = (2.0 / z) * (x_m / y);
} else if (t <= 6.2e-141) {
tmp = x_m * ((2.0 / z) / y);
} else {
tmp = 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 * ((x_m / z) / t) tmp = 0 if t <= -5.6e+122: tmp = t_1 elif t <= -1.7e-187: tmp = (2.0 / z) * (x_m / y) elif t <= 6.2e-141: tmp = x_m * ((2.0 / z) / y) else: tmp = 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(Float64(x_m / z) / t)) tmp = 0.0 if (t <= -5.6e+122) tmp = t_1; elseif (t <= -1.7e-187) tmp = Float64(Float64(2.0 / z) * Float64(x_m / y)); elseif (t <= 6.2e-141) tmp = Float64(x_m * Float64(Float64(2.0 / z) / y)); else tmp = 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 * ((x_m / z) / t); tmp = 0.0; if (t <= -5.6e+122) tmp = t_1; elseif (t <= -1.7e-187) tmp = (2.0 / z) * (x_m / y); elseif (t <= 6.2e-141) tmp = x_m * ((2.0 / z) / y); else tmp = 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[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -5.6e+122], t$95$1, If[LessEqual[t, -1.7e-187], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.2e-141], N[(x$95$m * N[(N[(2.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := -2 \cdot \frac{\frac{x\_m}{z}}{t}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{-187}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-141}:\\
\;\;\;\;x\_m \cdot \frac{\frac{2}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -5.5999999999999999e122 or 6.20000000000000055e-141 < t Initial program 84.3%
distribute-rgt-out--87.9%
Simplified87.9%
Taylor expanded in y around 0 69.5%
*-commutative69.5%
associate-/r*76.5%
Simplified76.5%
if -5.5999999999999999e122 < t < -1.7000000000000001e-187Initial program 82.7%
distribute-rgt-out--86.3%
Simplified86.3%
*-commutative86.3%
times-frac97.5%
Applied egg-rr97.5%
Taylor expanded in y around inf 71.8%
if -1.7000000000000001e-187 < t < 6.20000000000000055e-141Initial program 92.6%
distribute-rgt-out--97.4%
Simplified97.4%
distribute-rgt-out--92.6%
associate-/l*92.5%
*-commutative92.5%
distribute-rgt-out--97.4%
Applied egg-rr97.4%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
associate-/r*87.8%
Simplified87.8%
Final simplification79.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -2e+41)
(* -2.0 (/ x_m (* z t)))
(if (<= t 1.2e-142) (* 2.0 (/ (/ x_m z) y)) (* -2.0 (/ (/ x_m z) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -2e+41) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 1.2e-142) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2d+41)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 1.2d-142) then
tmp = 2.0d0 * ((x_m / z) / y)
else
tmp = (-2.0d0) * ((x_m / z) / t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -2e+41) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 1.2e-142) {
tmp = 2.0 * ((x_m / z) / y);
} else {
tmp = -2.0 * ((x_m / z) / t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -2e+41: tmp = -2.0 * (x_m / (z * t)) elif t <= 1.2e-142: tmp = 2.0 * ((x_m / z) / y) else: tmp = -2.0 * ((x_m / z) / t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -2e+41) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 1.2e-142) tmp = Float64(2.0 * Float64(Float64(x_m / z) / y)); else tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (t <= -2e+41) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 1.2e-142) tmp = 2.0 * ((x_m / z) / y); else tmp = -2.0 * ((x_m / z) / t); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -2e+41], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.2e-142], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+41}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-142}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -2.00000000000000001e41Initial program 86.3%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in y around 0 68.8%
*-commutative68.8%
Simplified68.8%
if -2.00000000000000001e41 < t < 1.19999999999999994e-142Initial program 88.8%
distribute-rgt-out--92.9%
Simplified92.9%
times-frac90.4%
Applied egg-rr90.4%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
associate-/r*80.0%
Simplified80.0%
if 1.19999999999999994e-142 < t Initial program 83.9%
distribute-rgt-out--87.4%
Simplified87.4%
Taylor expanded in y around 0 69.4%
*-commutative69.4%
associate-/r*76.5%
Simplified76.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 1000.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) <= 1000.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) <= 1000.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) <= 1000.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) <= 1000.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) <= 1000.0) tmp = Float64(x_m * Float64(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) <= 1000.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], 1000.0], N[(x$95$m * N[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $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 1000:\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 1e3Initial program 91.4%
distribute-rgt-out--94.5%
Simplified94.5%
distribute-rgt-out--91.4%
associate-/l*91.4%
*-commutative91.4%
distribute-rgt-out--94.5%
Applied egg-rr94.5%
if 1e3 < (*.f64 x #s(literal 2 binary64)) Initial program 70.9%
distribute-rgt-out--77.8%
Simplified77.8%
*-commutative77.8%
times-frac94.9%
Applied egg-rr94.9%
Final simplification94.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z 6e-10)
(* 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 <= 6e-10) {
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 <= 6d-10) 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 <= 6e-10) {
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 <= 6e-10: 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 <= 6e-10) 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 <= 6e-10) 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, 6e-10], 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 6 \cdot 10^{-10}:\\
\;\;\;\;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 < 6e-10Initial program 88.2%
distribute-rgt-out--92.5%
Simplified92.5%
distribute-rgt-out--88.2%
associate-/l*88.2%
*-commutative88.2%
distribute-rgt-out--92.4%
Applied egg-rr92.4%
if 6e-10 < z Initial program 81.8%
distribute-rgt-out--85.1%
Simplified85.1%
times-frac91.8%
Applied egg-rr91.8%
Final simplification92.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 (<= t 1.25e+187)
(* x_m (/ 2.0 (* z (- y 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 (t <= 1.25e+187) {
tmp = x_m * (2.0 / (z * (y - 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 (t <= 1.25d+187) then
tmp = x_m * (2.0d0 / (z * (y - 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 (t <= 1.25e+187) {
tmp = x_m * (2.0 / (z * (y - 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 t <= 1.25e+187: tmp = x_m * (2.0 / (z * (y - 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 (t <= 1.25e+187) tmp = Float64(x_m * Float64(2.0 / Float64(z * Float64(y - 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 (t <= 1.25e+187) tmp = x_m * (2.0 / (z * (y - 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[t, 1.25e+187], N[(x$95$m * N[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $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}\;t \leq 1.25 \cdot 10^{+187}:\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < 1.25e187Initial program 87.7%
distribute-rgt-out--92.2%
Simplified92.2%
distribute-rgt-out--87.7%
associate-/l*87.6%
*-commutative87.6%
distribute-rgt-out--92.2%
Applied egg-rr92.2%
if 1.25e187 < t Initial program 78.7%
distribute-rgt-out--78.9%
Simplified78.9%
Taylor expanded in y around 0 75.7%
*-commutative75.7%
associate-/r*96.5%
Simplified96.5%
Final simplification92.7%
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(Float64(x_m / 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[(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 \left(-2 \cdot \frac{\frac{x\_m}{z}}{t}\right)
\end{array}
Initial program 86.7%
distribute-rgt-out--90.7%
Simplified90.7%
Taylor expanded in y around 0 48.2%
*-commutative48.2%
associate-/r*50.1%
Simplified50.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -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 86.7%
distribute-rgt-out--90.7%
Simplified90.7%
Taylor expanded in y around 0 48.2%
*-commutative48.2%
Simplified48.2%
(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 2024170
(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))))