
(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 9 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) 4e+96)
(/ (* 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 * 2.0) <= 4e+96) {
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 * 2.0d0) <= 4d+96) 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 * 2.0) <= 4e+96) {
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 * 2.0) <= 4e+96: 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 (Float64(x_m * 2.0) <= 4e+96) tmp = Float64(Float64(2.0 * 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 * 2.0) <= 4e+96) 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[N[(x$95$m * 2.0), $MachinePrecision], 4e+96], N[(N[(2.0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / N[(y - t), $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 4 \cdot 10^{+96}:\\
\;\;\;\;\frac{2 \cdot \frac{x\_m}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 4.0000000000000002e96Initial program 91.2%
distribute-rgt-out--91.7%
Simplified91.7%
Taylor expanded in x around 0 91.7%
associate-/r*95.4%
associate-*r/95.4%
Simplified95.4%
if 4.0000000000000002e96 < (*.f64 x #s(literal 2 binary64)) Initial program 76.1%
distribute-rgt-out--76.2%
Simplified76.2%
*-commutative76.2%
times-frac95.3%
Applied egg-rr95.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 -8.5e+118)
(* (/ -2.0 z) (/ x_m t))
(if (<= t -3.15e+49)
(/ 2.0 (* y (/ z x_m)))
(if (<= t -4.2e-19)
(* -2.0 (/ x_m (* z t)))
(if (<= t 2.15e+42)
(/ (/ x_m y) (* z 0.5))
(* -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 <= -8.5e+118) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= -3.15e+49) {
tmp = 2.0 / (y * (z / x_m));
} else if (t <= -4.2e-19) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 2.15e+42) {
tmp = (x_m / y) / (z * 0.5);
} 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 <= (-8.5d+118)) then
tmp = ((-2.0d0) / z) * (x_m / t)
else if (t <= (-3.15d+49)) then
tmp = 2.0d0 / (y * (z / x_m))
else if (t <= (-4.2d-19)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 2.15d+42) then
tmp = (x_m / y) / (z * 0.5d0)
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 <= -8.5e+118) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= -3.15e+49) {
tmp = 2.0 / (y * (z / x_m));
} else if (t <= -4.2e-19) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 2.15e+42) {
tmp = (x_m / y) / (z * 0.5);
} 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 <= -8.5e+118: tmp = (-2.0 / z) * (x_m / t) elif t <= -3.15e+49: tmp = 2.0 / (y * (z / x_m)) elif t <= -4.2e-19: tmp = -2.0 * (x_m / (z * t)) elif t <= 2.15e+42: tmp = (x_m / y) / (z * 0.5) 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 <= -8.5e+118) tmp = Float64(Float64(-2.0 / z) * Float64(x_m / t)); elseif (t <= -3.15e+49) tmp = Float64(2.0 / Float64(y * Float64(z / x_m))); elseif (t <= -4.2e-19) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 2.15e+42) tmp = Float64(Float64(x_m / y) / Float64(z * 0.5)); 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 <= -8.5e+118) tmp = (-2.0 / z) * (x_m / t); elseif (t <= -3.15e+49) tmp = 2.0 / (y * (z / x_m)); elseif (t <= -4.2e-19) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 2.15e+42) tmp = (x_m / y) / (z * 0.5); 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, -8.5e+118], N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.15e+49], N[(2.0 / N[(y * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.2e-19], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e+42], N[(N[(x$95$m / y), $MachinePrecision] / N[(z * 0.5), $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 -8.5 \cdot 10^{+118}:\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x\_m}{t}\\
\mathbf{elif}\;t \leq -3.15 \cdot 10^{+49}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z}{x\_m}}\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-19}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{z \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -8.50000000000000033e118Initial program 83.7%
distribute-rgt-out--83.7%
Simplified83.7%
*-commutative83.7%
times-frac91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 75.1%
associate-/l/79.7%
associate-*r/79.7%
*-commutative79.7%
metadata-eval79.7%
distribute-rgt-neg-in79.7%
associate-*l/79.7%
associate-*r/79.6%
distribute-rgt-neg-in79.6%
distribute-neg-frac79.6%
metadata-eval79.6%
Simplified79.6%
*-commutative79.6%
associate-/l*87.9%
Applied egg-rr87.9%
if -8.50000000000000033e118 < t < -3.15000000000000003e49Initial program 93.9%
distribute-rgt-out--99.8%
Simplified99.8%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 75.7%
clear-num75.7%
frac-times79.3%
metadata-eval79.3%
Applied egg-rr79.3%
if -3.15000000000000003e49 < t < -4.1999999999999998e-19Initial program 99.8%
distribute-rgt-out--99.8%
Simplified99.8%
Taylor expanded in y around 0 92.9%
*-commutative92.9%
Simplified92.9%
if -4.1999999999999998e-19 < t < 2.1499999999999999e42Initial program 91.3%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in y around inf 75.1%
associate-*r/75.1%
*-commutative75.1%
times-frac78.0%
Simplified78.0%
*-commutative78.0%
clear-num78.0%
un-div-inv78.0%
div-inv78.0%
metadata-eval78.0%
Applied egg-rr78.0%
if 2.1499999999999999e42 < t Initial program 80.5%
distribute-rgt-out--80.7%
Simplified80.7%
Taylor expanded in y around 0 73.3%
*-commutative73.3%
associate-/r*85.3%
Simplified85.3%
Final simplification81.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 -8.5e+118)
(* (/ -2.0 z) (/ x_m t))
(if (<= t -1.62e+50)
(/ 2.0 (* y (/ z x_m)))
(if (<= t -4.1e-19)
(* -2.0 (/ x_m (* z t)))
(if (<= t 3.3e+42)
(* (/ 2.0 z) (/ x_m 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 <= -8.5e+118) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= -1.62e+50) {
tmp = 2.0 / (y * (z / x_m));
} else if (t <= -4.1e-19) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 3.3e+42) {
tmp = (2.0 / z) * (x_m / 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 <= (-8.5d+118)) then
tmp = ((-2.0d0) / z) * (x_m / t)
else if (t <= (-1.62d+50)) then
tmp = 2.0d0 / (y * (z / x_m))
else if (t <= (-4.1d-19)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 3.3d+42) then
tmp = (2.0d0 / z) * (x_m / 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 <= -8.5e+118) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= -1.62e+50) {
tmp = 2.0 / (y * (z / x_m));
} else if (t <= -4.1e-19) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 3.3e+42) {
tmp = (2.0 / z) * (x_m / 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 <= -8.5e+118: tmp = (-2.0 / z) * (x_m / t) elif t <= -1.62e+50: tmp = 2.0 / (y * (z / x_m)) elif t <= -4.1e-19: tmp = -2.0 * (x_m / (z * t)) elif t <= 3.3e+42: tmp = (2.0 / z) * (x_m / 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 <= -8.5e+118) tmp = Float64(Float64(-2.0 / z) * Float64(x_m / t)); elseif (t <= -1.62e+50) tmp = Float64(2.0 / Float64(y * Float64(z / x_m))); elseif (t <= -4.1e-19) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 3.3e+42) tmp = Float64(Float64(2.0 / z) * Float64(x_m / 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 <= -8.5e+118) tmp = (-2.0 / z) * (x_m / t); elseif (t <= -1.62e+50) tmp = 2.0 / (y * (z / x_m)); elseif (t <= -4.1e-19) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 3.3e+42) tmp = (2.0 / z) * (x_m / 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, -8.5e+118], N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.62e+50], N[(2.0 / N[(y * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.1e-19], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.3e+42], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / 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 -8.5 \cdot 10^{+118}:\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x\_m}{t}\\
\mathbf{elif}\;t \leq -1.62 \cdot 10^{+50}:\\
\;\;\;\;\frac{2}{y \cdot \frac{z}{x\_m}}\\
\mathbf{elif}\;t \leq -4.1 \cdot 10^{-19}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+42}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -8.50000000000000033e118Initial program 83.7%
distribute-rgt-out--83.7%
Simplified83.7%
*-commutative83.7%
times-frac91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 75.1%
associate-/l/79.7%
associate-*r/79.7%
*-commutative79.7%
metadata-eval79.7%
distribute-rgt-neg-in79.7%
associate-*l/79.7%
associate-*r/79.6%
distribute-rgt-neg-in79.6%
distribute-neg-frac79.6%
metadata-eval79.6%
Simplified79.6%
*-commutative79.6%
associate-/l*87.9%
Applied egg-rr87.9%
if -8.50000000000000033e118 < t < -1.61999999999999996e50Initial program 93.9%
distribute-rgt-out--99.8%
Simplified99.8%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 75.7%
clear-num75.7%
frac-times79.3%
metadata-eval79.3%
Applied egg-rr79.3%
if -1.61999999999999996e50 < t < -4.09999999999999985e-19Initial program 99.8%
distribute-rgt-out--99.8%
Simplified99.8%
Taylor expanded in y around 0 92.9%
*-commutative92.9%
Simplified92.9%
if -4.09999999999999985e-19 < t < 3.2999999999999999e42Initial program 91.3%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in y around inf 75.1%
associate-*r/75.1%
*-commutative75.1%
times-frac78.0%
Simplified78.0%
if 3.2999999999999999e42 < t Initial program 80.5%
distribute-rgt-out--80.7%
Simplified80.7%
Taylor expanded in y around 0 73.3%
*-commutative73.3%
associate-/r*85.3%
Simplified85.3%
Final simplification81.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 -8.5e+118)
(* (/ -2.0 z) (/ x_m t))
(if (<= t -1.7e+48)
(* (/ x_m z) (/ 2.0 y))
(if (<= t -6.3e-21)
(* -2.0 (/ x_m (* z t)))
(if (<= t 2.8e+42)
(* (/ 2.0 z) (/ x_m 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 <= -8.5e+118) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= -1.7e+48) {
tmp = (x_m / z) * (2.0 / y);
} else if (t <= -6.3e-21) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 2.8e+42) {
tmp = (2.0 / z) * (x_m / 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 <= (-8.5d+118)) then
tmp = ((-2.0d0) / z) * (x_m / t)
else if (t <= (-1.7d+48)) then
tmp = (x_m / z) * (2.0d0 / y)
else if (t <= (-6.3d-21)) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 2.8d+42) then
tmp = (2.0d0 / z) * (x_m / 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 <= -8.5e+118) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= -1.7e+48) {
tmp = (x_m / z) * (2.0 / y);
} else if (t <= -6.3e-21) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 2.8e+42) {
tmp = (2.0 / z) * (x_m / 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 <= -8.5e+118: tmp = (-2.0 / z) * (x_m / t) elif t <= -1.7e+48: tmp = (x_m / z) * (2.0 / y) elif t <= -6.3e-21: tmp = -2.0 * (x_m / (z * t)) elif t <= 2.8e+42: tmp = (2.0 / z) * (x_m / 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 <= -8.5e+118) tmp = Float64(Float64(-2.0 / z) * Float64(x_m / t)); elseif (t <= -1.7e+48) tmp = Float64(Float64(x_m / z) * Float64(2.0 / y)); elseif (t <= -6.3e-21) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 2.8e+42) tmp = Float64(Float64(2.0 / z) * Float64(x_m / 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 <= -8.5e+118) tmp = (-2.0 / z) * (x_m / t); elseif (t <= -1.7e+48) tmp = (x_m / z) * (2.0 / y); elseif (t <= -6.3e-21) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 2.8e+42) tmp = (2.0 / z) * (x_m / 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, -8.5e+118], N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.7e+48], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6.3e-21], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+42], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / 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 -8.5 \cdot 10^{+118}:\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x\_m}{t}\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{+48}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y}\\
\mathbf{elif}\;t \leq -6.3 \cdot 10^{-21}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+42}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
if t < -8.50000000000000033e118Initial program 83.7%
distribute-rgt-out--83.7%
Simplified83.7%
*-commutative83.7%
times-frac91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 75.1%
associate-/l/79.7%
associate-*r/79.7%
*-commutative79.7%
metadata-eval79.7%
distribute-rgt-neg-in79.7%
associate-*l/79.7%
associate-*r/79.6%
distribute-rgt-neg-in79.6%
distribute-neg-frac79.6%
metadata-eval79.6%
Simplified79.6%
*-commutative79.6%
associate-/l*87.9%
Applied egg-rr87.9%
if -8.50000000000000033e118 < t < -1.7000000000000002e48Initial program 93.9%
distribute-rgt-out--99.8%
Simplified99.8%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 75.7%
if -1.7000000000000002e48 < t < -6.3e-21Initial program 99.8%
distribute-rgt-out--99.8%
Simplified99.8%
Taylor expanded in y around 0 92.9%
*-commutative92.9%
Simplified92.9%
if -6.3e-21 < t < 2.7999999999999999e42Initial program 91.3%
distribute-rgt-out--91.3%
Simplified91.3%
Taylor expanded in y around inf 75.1%
associate-*r/75.1%
*-commutative75.1%
times-frac78.0%
Simplified78.0%
if 2.7999999999999999e42 < t Initial program 80.5%
distribute-rgt-out--80.7%
Simplified80.7%
Taylor expanded in y around 0 73.3%
*-commutative73.3%
associate-/r*85.3%
Simplified85.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 z) (/ x_m y))))
(*
x_s
(if (<= t -1.1e-19)
(* (/ -2.0 z) (/ x_m t))
(if (<= t 9.5e-34)
t_1
(if (<= t 8.8e+21)
(* -2.0 (/ x_m (* z t)))
(if (<= t 1.5e+46) t_1 (* -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 t_1 = (2.0 / z) * (x_m / y);
double tmp;
if (t <= -1.1e-19) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= 9.5e-34) {
tmp = t_1;
} else if (t <= 8.8e+21) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 1.5e+46) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (2.0d0 / z) * (x_m / y)
if (t <= (-1.1d-19)) then
tmp = ((-2.0d0) / z) * (x_m / t)
else if (t <= 9.5d-34) then
tmp = t_1
else if (t <= 8.8d+21) then
tmp = (-2.0d0) * (x_m / (z * t))
else if (t <= 1.5d+46) then
tmp = t_1
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 t_1 = (2.0 / z) * (x_m / y);
double tmp;
if (t <= -1.1e-19) {
tmp = (-2.0 / z) * (x_m / t);
} else if (t <= 9.5e-34) {
tmp = t_1;
} else if (t <= 8.8e+21) {
tmp = -2.0 * (x_m / (z * t));
} else if (t <= 1.5e+46) {
tmp = t_1;
} 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): t_1 = (2.0 / z) * (x_m / y) tmp = 0 if t <= -1.1e-19: tmp = (-2.0 / z) * (x_m / t) elif t <= 9.5e-34: tmp = t_1 elif t <= 8.8e+21: tmp = -2.0 * (x_m / (z * t)) elif t <= 1.5e+46: tmp = t_1 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) t_1 = Float64(Float64(2.0 / z) * Float64(x_m / y)) tmp = 0.0 if (t <= -1.1e-19) tmp = Float64(Float64(-2.0 / z) * Float64(x_m / t)); elseif (t <= 9.5e-34) tmp = t_1; elseif (t <= 8.8e+21) tmp = Float64(-2.0 * Float64(x_m / Float64(z * t))); elseif (t <= 1.5e+46) tmp = t_1; 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) t_1 = (2.0 / z) * (x_m / y); tmp = 0.0; if (t <= -1.1e-19) tmp = (-2.0 / z) * (x_m / t); elseif (t <= 9.5e-34) tmp = t_1; elseif (t <= 8.8e+21) tmp = -2.0 * (x_m / (z * t)); elseif (t <= 1.5e+46) tmp = t_1; 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_] := Block[{t$95$1 = N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -1.1e-19], N[(N[(-2.0 / z), $MachinePrecision] * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e-34], t$95$1, If[LessEqual[t, 8.8e+21], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.5e+46], t$95$1, 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)
\\
\begin{array}{l}
t_1 := \frac{2}{z} \cdot \frac{x\_m}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-19}:\\
\;\;\;\;\frac{-2}{z} \cdot \frac{x\_m}{t}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{+21}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\
\end{array}
\end{array}
\end{array}
if t < -1.0999999999999999e-19Initial program 89.7%
distribute-rgt-out--91.3%
Simplified91.3%
*-commutative91.3%
times-frac94.0%
Applied egg-rr94.0%
Taylor expanded in y around 0 72.2%
associate-/l/74.6%
associate-*r/74.6%
*-commutative74.6%
metadata-eval74.6%
distribute-rgt-neg-in74.6%
associate-*l/74.6%
associate-*r/74.6%
distribute-rgt-neg-in74.6%
distribute-neg-frac74.6%
metadata-eval74.6%
Simplified74.6%
*-commutative74.6%
associate-/l*79.0%
Applied egg-rr79.0%
if -1.0999999999999999e-19 < t < 9.49999999999999985e-34 or 8.8e21 < t < 1.50000000000000012e46Initial program 90.4%
distribute-rgt-out--90.4%
Simplified90.4%
Taylor expanded in y around inf 77.4%
associate-*r/77.4%
*-commutative77.4%
times-frac80.7%
Simplified80.7%
if 9.49999999999999985e-34 < t < 8.8e21Initial program 99.7%
distribute-rgt-out--99.7%
Simplified99.7%
Taylor expanded in y around 0 83.9%
*-commutative83.9%
Simplified83.9%
if 1.50000000000000012e46 < t Initial program 80.5%
distribute-rgt-out--80.7%
Simplified80.7%
Taylor expanded in y around 0 73.3%
*-commutative73.3%
associate-/r*85.3%
Simplified85.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 (<= (* x_m 2.0) 1e+90)
(* (/ 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) <= 1e+90) {
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) <= 1d+90) 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) <= 1e+90) {
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) <= 1e+90: 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) <= 1e+90) 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) <= 1e+90) 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], 1e+90], 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 10^{+90}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 9.99999999999999966e89Initial program 91.2%
distribute-rgt-out--91.7%
Simplified91.7%
times-frac95.4%
Applied egg-rr95.4%
if 9.99999999999999966e89 < (*.f64 x #s(literal 2 binary64)) Initial program 76.1%
distribute-rgt-out--76.2%
Simplified76.2%
*-commutative76.2%
times-frac95.3%
Applied egg-rr95.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 (* (/ 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) {
return x_s * ((x_m / z) * (2.0 / (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 / z) * (2.0d0 / (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 / z) * (2.0 / (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 / z) * (2.0 / (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(Float64(x_m / z) * Float64(2.0 / 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 / z) * (2.0 / (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[(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 \left(\frac{x\_m}{z} \cdot \frac{2}{y - t}\right)
\end{array}
Initial program 88.6%
distribute-rgt-out--89.0%
Simplified89.0%
times-frac94.2%
Applied egg-rr94.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -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 88.6%
distribute-rgt-out--89.0%
Simplified89.0%
Taylor expanded in y around 0 51.8%
*-commutative51.8%
associate-/r*58.3%
Simplified58.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -2.0 (/ x_m (* z t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * ((-2.0d0) * (x_m / (z * t)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (-2.0 * (x_m / (z * t)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(-2.0 * Float64(x_m / Float64(z * t)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (-2.0 * (x_m / (z * t))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(-2 \cdot \frac{x\_m}{z \cdot t}\right)
\end{array}
Initial program 88.6%
distribute-rgt-out--89.0%
Simplified89.0%
Taylor expanded in y around 0 51.8%
*-commutative51.8%
Simplified51.8%
(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 2024091
(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))))