
(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}
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= z_m 20000000000.0)
(/ (* x 2.0) (* z_m (- y t)))
(* 2.0 (/ (/ x z_m) (- y t))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 20000000000.0) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = 2.0 * ((x / z_m) / (y - t));
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 20000000000.0d0) then
tmp = (x * 2.0d0) / (z_m * (y - t))
else
tmp = 2.0d0 * ((x / z_m) / (y - t))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 20000000000.0) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = 2.0 * ((x / z_m) / (y - t));
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if z_m <= 20000000000.0: tmp = (x * 2.0) / (z_m * (y - t)) else: tmp = 2.0 * ((x / z_m) / (y - t)) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (z_m <= 20000000000.0) tmp = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(2.0 * Float64(Float64(x / z_m) / Float64(y - t))); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (z_m <= 20000000000.0) tmp = (x * 2.0) / (z_m * (y - t)); else tmp = 2.0 * ((x / z_m) / (y - t)); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[z$95$m, 20000000000.0], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / z$95$m), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 20000000000:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z\_m}}{y - t}\\
\end{array}
\end{array}
if z < 2e10Initial program 90.9%
distribute-rgt-out--93.9%
Simplified93.9%
if 2e10 < z Initial program 87.5%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in x around 0 92.6%
associate-/r*98.3%
Simplified98.3%
Final simplification94.9%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= t -155.0)
(* (/ x t) (/ -2.0 z_m))
(if (<= t 7.2e-100) (* (/ 2.0 z_m) (/ x y)) (* -2.0 (/ (/ x z_m) t))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -155.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 7.2e-100) {
tmp = (2.0 / z_m) * (x / y);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-155.0d0)) then
tmp = (x / t) * ((-2.0d0) / z_m)
else if (t <= 7.2d-100) then
tmp = (2.0d0 / z_m) * (x / y)
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -155.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 7.2e-100) {
tmp = (2.0 / z_m) * (x / y);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -155.0: tmp = (x / t) * (-2.0 / z_m) elif t <= 7.2e-100: tmp = (2.0 / z_m) * (x / y) else: tmp = -2.0 * ((x / z_m) / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -155.0) tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m)); elseif (t <= 7.2e-100) tmp = Float64(Float64(2.0 / z_m) * Float64(x / y)); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -155.0) tmp = (x / t) * (-2.0 / z_m); elseif (t <= 7.2e-100) tmp = (2.0 / z_m) * (x / y); else tmp = -2.0 * ((x / z_m) / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -155.0], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e-100], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -155:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-100}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if t < -155Initial program 86.3%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in y around 0 70.5%
associate-*r/70.5%
*-commutative70.5%
associate-/r*72.9%
Simplified72.9%
associate-/r*70.5%
times-frac72.9%
Applied egg-rr72.9%
if -155 < t < 7.1999999999999997e-100Initial program 90.3%
distribute-rgt-out--95.7%
Simplified95.7%
Taylor expanded in y around inf 82.9%
*-commutative82.9%
Simplified82.9%
*-commutative82.9%
times-frac78.5%
Applied egg-rr78.5%
if 7.1999999999999997e-100 < t Initial program 93.5%
distribute-rgt-out--94.7%
Simplified94.7%
Taylor expanded in y around 0 75.4%
associate-/l/76.1%
Simplified76.1%
Final simplification76.0%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= t -106.0)
(* (/ x t) (/ -2.0 z_m))
(if (<= t 2.3e-5) (* (/ x z_m) (/ 2.0 y)) (* -2.0 (/ x (* z_m t)))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -106.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 2.3e-5) {
tmp = (x / z_m) * (2.0 / y);
} else {
tmp = -2.0 * (x / (z_m * t));
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-106.0d0)) then
tmp = (x / t) * ((-2.0d0) / z_m)
else if (t <= 2.3d-5) then
tmp = (x / z_m) * (2.0d0 / y)
else
tmp = (-2.0d0) * (x / (z_m * t))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -106.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 2.3e-5) {
tmp = (x / z_m) * (2.0 / y);
} else {
tmp = -2.0 * (x / (z_m * t));
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -106.0: tmp = (x / t) * (-2.0 / z_m) elif t <= 2.3e-5: tmp = (x / z_m) * (2.0 / y) else: tmp = -2.0 * (x / (z_m * t)) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -106.0) tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m)); elseif (t <= 2.3e-5) tmp = Float64(Float64(x / z_m) * Float64(2.0 / y)); else tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -106.0) tmp = (x / t) * (-2.0 / z_m); elseif (t <= 2.3e-5) tmp = (x / z_m) * (2.0 / y); else tmp = -2.0 * (x / (z_m * t)); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -106.0], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e-5], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -106:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\end{array}
\end{array}
if t < -106Initial program 86.3%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in y around 0 70.5%
associate-*r/70.5%
*-commutative70.5%
associate-/r*72.9%
Simplified72.9%
associate-/r*70.5%
times-frac72.9%
Applied egg-rr72.9%
if -106 < t < 2.3e-5Initial program 91.9%
distribute-rgt-out--96.4%
Simplified96.4%
times-frac94.7%
Applied egg-rr94.7%
Taylor expanded in y around inf 78.9%
if 2.3e-5 < t Initial program 91.7%
distribute-rgt-out--93.3%
Simplified93.3%
Taylor expanded in y around 0 78.6%
Final simplification76.9%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= t -41.0)
(* (/ x t) (/ -2.0 z_m))
(if (<= t 4e-96) (* x (/ (/ 2.0 z_m) y)) (* -2.0 (/ (/ x z_m) t))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -41.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 4e-96) {
tmp = x * ((2.0 / z_m) / y);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-41.0d0)) then
tmp = (x / t) * ((-2.0d0) / z_m)
else if (t <= 4d-96) then
tmp = x * ((2.0d0 / z_m) / y)
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -41.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 4e-96) {
tmp = x * ((2.0 / z_m) / y);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -41.0: tmp = (x / t) * (-2.0 / z_m) elif t <= 4e-96: tmp = x * ((2.0 / z_m) / y) else: tmp = -2.0 * ((x / z_m) / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -41.0) tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m)); elseif (t <= 4e-96) tmp = Float64(x * Float64(Float64(2.0 / z_m) / y)); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -41.0) tmp = (x / t) * (-2.0 / z_m); elseif (t <= 4e-96) tmp = x * ((2.0 / z_m) / y); else tmp = -2.0 * ((x / z_m) / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -41.0], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4e-96], N[(x * N[(N[(2.0 / z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -41:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-96}:\\
\;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if t < -41Initial program 86.3%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in y around 0 70.5%
associate-*r/70.5%
*-commutative70.5%
associate-/r*72.9%
Simplified72.9%
associate-/r*70.5%
times-frac72.9%
Applied egg-rr72.9%
if -41 < t < 3.9999999999999996e-96Initial program 90.3%
distribute-rgt-out--95.7%
Simplified95.7%
Taylor expanded in y around inf 82.9%
*-commutative82.9%
Simplified82.9%
associate-/l*82.9%
*-commutative82.9%
associate-/r*82.8%
Applied egg-rr82.8%
if 3.9999999999999996e-96 < t Initial program 93.5%
distribute-rgt-out--94.7%
Simplified94.7%
Taylor expanded in y around 0 75.4%
associate-/l/76.1%
Simplified76.1%
Final simplification77.5%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= t -40.0)
(* (/ x t) (/ -2.0 z_m))
(if (<= t 5e-96) (/ (* x 2.0) (* z_m y)) (* -2.0 (/ (/ x z_m) t))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -40.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 5e-96) {
tmp = (x * 2.0) / (z_m * y);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-40.0d0)) then
tmp = (x / t) * ((-2.0d0) / z_m)
else if (t <= 5d-96) then
tmp = (x * 2.0d0) / (z_m * y)
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -40.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 5e-96) {
tmp = (x * 2.0) / (z_m * y);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -40.0: tmp = (x / t) * (-2.0 / z_m) elif t <= 5e-96: tmp = (x * 2.0) / (z_m * y) else: tmp = -2.0 * ((x / z_m) / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -40.0) tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m)); elseif (t <= 5e-96) tmp = Float64(Float64(x * 2.0) / Float64(z_m * y)); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -40.0) tmp = (x / t) * (-2.0 / z_m); elseif (t <= 5e-96) tmp = (x * 2.0) / (z_m * y); else tmp = -2.0 * ((x / z_m) / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -40.0], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e-96], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -40:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-96}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if t < -40Initial program 86.3%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in y around 0 70.5%
associate-*r/70.5%
*-commutative70.5%
associate-/r*72.9%
Simplified72.9%
associate-/r*70.5%
times-frac72.9%
Applied egg-rr72.9%
if -40 < t < 4.99999999999999995e-96Initial program 90.3%
distribute-rgt-out--95.7%
Simplified95.7%
Taylor expanded in y around inf 82.9%
*-commutative82.9%
Simplified82.9%
if 4.99999999999999995e-96 < t Initial program 93.5%
distribute-rgt-out--94.7%
Simplified94.7%
Taylor expanded in y around 0 75.4%
associate-/l/76.1%
Simplified76.1%
Final simplification77.6%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= t -400.0)
(* (/ x t) (/ -2.0 z_m))
(if (<= t 2.4e-96) (/ (* x 2.0) (* z_m y)) (/ (/ x z_m) (* t -0.5))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -400.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 2.4e-96) {
tmp = (x * 2.0) / (z_m * y);
} else {
tmp = (x / z_m) / (t * -0.5);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-400.0d0)) then
tmp = (x / t) * ((-2.0d0) / z_m)
else if (t <= 2.4d-96) then
tmp = (x * 2.0d0) / (z_m * y)
else
tmp = (x / z_m) / (t * (-0.5d0))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -400.0) {
tmp = (x / t) * (-2.0 / z_m);
} else if (t <= 2.4e-96) {
tmp = (x * 2.0) / (z_m * y);
} else {
tmp = (x / z_m) / (t * -0.5);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -400.0: tmp = (x / t) * (-2.0 / z_m) elif t <= 2.4e-96: tmp = (x * 2.0) / (z_m * y) else: tmp = (x / z_m) / (t * -0.5) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -400.0) tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m)); elseif (t <= 2.4e-96) tmp = Float64(Float64(x * 2.0) / Float64(z_m * y)); else tmp = Float64(Float64(x / z_m) / Float64(t * -0.5)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -400.0) tmp = (x / t) * (-2.0 / z_m); elseif (t <= 2.4e-96) tmp = (x * 2.0) / (z_m * y); else tmp = (x / z_m) / (t * -0.5); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -400.0], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e-96], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] / N[(t * -0.5), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -400:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-96}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z\_m}}{t \cdot -0.5}\\
\end{array}
\end{array}
if t < -400Initial program 86.3%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in y around 0 70.5%
associate-*r/70.5%
*-commutative70.5%
associate-/r*72.9%
Simplified72.9%
associate-/r*70.5%
times-frac72.9%
Applied egg-rr72.9%
if -400 < t < 2.40000000000000019e-96Initial program 90.3%
distribute-rgt-out--95.7%
Simplified95.7%
Taylor expanded in y around inf 82.9%
*-commutative82.9%
Simplified82.9%
if 2.40000000000000019e-96 < t Initial program 93.5%
distribute-rgt-out--94.7%
Simplified94.7%
Taylor expanded in y around 0 75.4%
associate-*r/75.4%
*-commutative75.4%
associate-/r*74.5%
Simplified74.5%
associate-/r*75.4%
times-frac74.5%
Applied egg-rr74.5%
frac-times75.4%
*-commutative75.4%
frac-times76.1%
clear-num76.1%
un-div-inv76.1%
div-inv76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Final simplification77.6%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= t -78.0)
(/ (/ (* x -2.0) t) z_m)
(if (<= t 6.2e-96) (/ (* x 2.0) (* z_m y)) (/ (/ x z_m) (* t -0.5))))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -78.0) {
tmp = ((x * -2.0) / t) / z_m;
} else if (t <= 6.2e-96) {
tmp = (x * 2.0) / (z_m * y);
} else {
tmp = (x / z_m) / (t * -0.5);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-78.0d0)) then
tmp = ((x * (-2.0d0)) / t) / z_m
else if (t <= 6.2d-96) then
tmp = (x * 2.0d0) / (z_m * y)
else
tmp = (x / z_m) / (t * (-0.5d0))
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (t <= -78.0) {
tmp = ((x * -2.0) / t) / z_m;
} else if (t <= 6.2e-96) {
tmp = (x * 2.0) / (z_m * y);
} else {
tmp = (x / z_m) / (t * -0.5);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if t <= -78.0: tmp = ((x * -2.0) / t) / z_m elif t <= 6.2e-96: tmp = (x * 2.0) / (z_m * y) else: tmp = (x / z_m) / (t * -0.5) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (t <= -78.0) tmp = Float64(Float64(Float64(x * -2.0) / t) / z_m); elseif (t <= 6.2e-96) tmp = Float64(Float64(x * 2.0) / Float64(z_m * y)); else tmp = Float64(Float64(x / z_m) / Float64(t * -0.5)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (t <= -78.0) tmp = ((x * -2.0) / t) / z_m; elseif (t <= 6.2e-96) tmp = (x * 2.0) / (z_m * y); else tmp = (x / z_m) / (t * -0.5); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[t, -78.0], N[(N[(N[(x * -2.0), $MachinePrecision] / t), $MachinePrecision] / z$95$m), $MachinePrecision], If[LessEqual[t, 6.2e-96], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] / N[(t * -0.5), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -78:\\
\;\;\;\;\frac{\frac{x \cdot -2}{t}}{z\_m}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-96}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z\_m}}{t \cdot -0.5}\\
\end{array}
\end{array}
if t < -78Initial program 86.3%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in y around 0 70.5%
associate-*r/70.5%
*-commutative70.5%
associate-/r*72.9%
Simplified72.9%
if -78 < t < 6.1999999999999998e-96Initial program 90.3%
distribute-rgt-out--95.7%
Simplified95.7%
Taylor expanded in y around inf 82.9%
*-commutative82.9%
Simplified82.9%
if 6.1999999999999998e-96 < t Initial program 93.5%
distribute-rgt-out--94.7%
Simplified94.7%
Taylor expanded in y around 0 75.4%
associate-*r/75.4%
*-commutative75.4%
associate-/r*74.5%
Simplified74.5%
associate-/r*75.4%
times-frac74.5%
Applied egg-rr74.5%
frac-times75.4%
*-commutative75.4%
frac-times76.1%
clear-num76.1%
un-div-inv76.1%
div-inv76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Final simplification77.6%
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= (* x 2.0) 1e-97)
(* 2.0 (/ (/ x z_m) (- y t)))
(* (/ x (- y t)) (/ 2.0 z_m)))))z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if ((x * 2.0) <= 1e-97) {
tmp = 2.0 * ((x / z_m) / (y - t));
} else {
tmp = (x / (y - t)) * (2.0 / z_m);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x * 2.0d0) <= 1d-97) then
tmp = 2.0d0 * ((x / z_m) / (y - t))
else
tmp = (x / (y - t)) * (2.0d0 / z_m)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if ((x * 2.0) <= 1e-97) {
tmp = 2.0 * ((x / z_m) / (y - t));
} else {
tmp = (x / (y - t)) * (2.0 / z_m);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if (x * 2.0) <= 1e-97: tmp = 2.0 * ((x / z_m) / (y - t)) else: tmp = (x / (y - t)) * (2.0 / z_m) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (Float64(x * 2.0) <= 1e-97) tmp = Float64(2.0 * Float64(Float64(x / z_m) / Float64(y - t))); else tmp = Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z_m)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if ((x * 2.0) <= 1e-97) tmp = 2.0 * ((x / z_m) / (y - t)); else tmp = (x / (y - t)) * (2.0 / z_m); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[N[(x * 2.0), $MachinePrecision], 1e-97], N[(2.0 * N[(N[(x / z$95$m), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq 10^{-97}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{z\_m}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z\_m}\\
\end{array}
\end{array}
if (*.f64 x #s(literal 2 binary64)) < 1.00000000000000004e-97Initial program 93.5%
distribute-rgt-out--95.7%
Simplified95.7%
Taylor expanded in x around 0 95.7%
associate-/r*95.0%
Simplified95.0%
if 1.00000000000000004e-97 < (*.f64 x #s(literal 2 binary64)) Initial program 82.6%
distribute-rgt-out--88.9%
Simplified88.9%
*-commutative88.9%
times-frac97.1%
Applied egg-rr97.1%
Final simplification95.7%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (if (<= z_m 1.1e-19) (* -2.0 (/ x (* z_m t))) (* -2.0 (/ (/ x z_m) t)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.1e-19) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 1.1d-19) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.1e-19) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return z_s * tmp;
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): tmp = 0 if z_m <= 1.1e-19: tmp = -2.0 * (x / (z_m * t)) else: tmp = -2.0 * ((x / z_m) / t) return z_s * tmp
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) tmp = 0.0 if (z_m <= 1.1e-19) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return Float64(z_s * tmp) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp_2 = code(z_s, x, y, z_m, t) tmp = 0.0; if (z_m <= 1.1e-19) tmp = -2.0 * (x / (z_m * t)); else tmp = -2.0 * ((x / z_m) / t); end tmp_2 = z_s * tmp; end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[LessEqual[z$95$m, 1.1e-19], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.1 \cdot 10^{-19}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if z < 1.0999999999999999e-19Initial program 90.6%
distribute-rgt-out--93.7%
Simplified93.7%
Taylor expanded in y around 0 56.2%
if 1.0999999999999999e-19 < z Initial program 88.8%
distribute-rgt-out--93.3%
Simplified93.3%
Taylor expanded in y around 0 53.0%
associate-/l/62.3%
Simplified62.3%
Final simplification57.7%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (* 2.0 (/ (/ x z_m) (- y t)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
return z_s * (2.0 * ((x / z_m) / (y - t)));
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = z_s * (2.0d0 * ((x / z_m) / (y - t)))
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
return z_s * (2.0 * ((x / z_m) / (y - t)));
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): return z_s * (2.0 * ((x / z_m) / (y - t)))
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) return Float64(z_s * Float64(2.0 * Float64(Float64(x / z_m) / Float64(y - t)))) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m, t) tmp = z_s * (2.0 * ((x / z_m) / (y - t))); end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * N[(2.0 * N[(N[(x / z$95$m), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(2 \cdot \frac{\frac{x}{z\_m}}{y - t}\right)
\end{array}
Initial program 90.1%
distribute-rgt-out--93.6%
Simplified93.6%
Taylor expanded in x around 0 93.6%
associate-/r*92.5%
Simplified92.5%
Final simplification92.5%
z\_m = (fabs.f64 z) z\_s = (copysign.f64 #s(literal 1 binary64) z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (* -2.0 (/ x (* z_m t)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
return z_s * (-2.0 * (x / (z_m * t)));
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
real(8), intent (in) :: z_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = z_s * ((-2.0d0) * (x / (z_m * t)))
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
return z_s * (-2.0 * (x / (z_m * t)));
}
z\_m = math.fabs(z) z\_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): return z_s * (-2.0 * (x / (z_m * t)))
z\_m = abs(z) z\_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) return Float64(z_s * Float64(-2.0 * Float64(x / Float64(z_m * t)))) end
z\_m = abs(z); z\_s = sign(z) * abs(1.0); function tmp = code(z_s, x, y, z_m, t) tmp = z_s * (-2.0 * (x / (z_m * t))); end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
z\_s \cdot \left(-2 \cdot \frac{x}{z\_m \cdot t}\right)
\end{array}
Initial program 90.1%
distribute-rgt-out--93.6%
Simplified93.6%
Taylor expanded in y around 0 55.3%
Final simplification55.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x (* (- y t) z)) 2.0))
(t_2 (/ (* x 2.0) (- (* y z) (* t z)))))
(if (< t_2 -2.559141628295061e-13)
t_1
(if (< t_2 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / ((y - t) * z)) * 2.0d0
t_2 = (x * 2.0d0) / ((y * z) - (t * z))
if (t_2 < (-2.559141628295061d-13)) then
tmp = t_1
else if (t_2 < 1.045027827330126d-269) then
tmp = ((x / z) * 2.0d0) / (y - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / ((y - t) * z)) * 2.0 t_2 = (x * 2.0) / ((y * z) - (t * z)) tmp = 0 if t_2 < -2.559141628295061e-13: tmp = t_1 elif t_2 < 1.045027827330126e-269: tmp = ((x / z) * 2.0) / (y - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(Float64(y - t) * z)) * 2.0) t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) tmp = 0.0 if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = Float64(Float64(Float64(x / z) * 2.0) / Float64(y - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / ((y - t) * z)) * 2.0; t_2 = (x * 2.0) / ((y * z) - (t * z)); tmp = 0.0; if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = ((x / z) * 2.0) / (y - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -2.559141628295061e-13], t$95$1, If[Less[t$95$2, 1.045027827330126e-269], N[(N[(N[(x / z), $MachinePrecision] * 2.0), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\
t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{if}\;t\_2 < -2.559141628295061 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.045027827330126 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024066
(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))))