
(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 12 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 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(let* ((t_1 (/ (* x 2.0) (* z_m (- y t))))
(t_2 (/ (* x 2.0) (- (* y z_m) (* z_m t)))))
(*
z_s
(if (<= t_2 -1e-294)
t_1
(if (<= t_2 1e-293)
(/ (/ x z_m) (* (- y t) 0.5))
(if (<= t_2 4e+212) t_1 (/ (* x (/ 2.0 (- y t))) 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 t_1 = (x * 2.0) / (z_m * (y - t));
double t_2 = (x * 2.0) / ((y * z_m) - (z_m * t));
double tmp;
if (t_2 <= -1e-294) {
tmp = t_1;
} else if (t_2 <= 1e-293) {
tmp = (x / z_m) / ((y - t) * 0.5);
} else if (t_2 <= 4e+212) {
tmp = t_1;
} else {
tmp = (x * (2.0 / (y - t))) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 2.0d0) / (z_m * (y - t))
t_2 = (x * 2.0d0) / ((y * z_m) - (z_m * t))
if (t_2 <= (-1d-294)) then
tmp = t_1
else if (t_2 <= 1d-293) then
tmp = (x / z_m) / ((y - t) * 0.5d0)
else if (t_2 <= 4d+212) then
tmp = t_1
else
tmp = (x * (2.0d0 / (y - t))) / 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 t_1 = (x * 2.0) / (z_m * (y - t));
double t_2 = (x * 2.0) / ((y * z_m) - (z_m * t));
double tmp;
if (t_2 <= -1e-294) {
tmp = t_1;
} else if (t_2 <= 1e-293) {
tmp = (x / z_m) / ((y - t) * 0.5);
} else if (t_2 <= 4e+212) {
tmp = t_1;
} else {
tmp = (x * (2.0 / (y - t))) / 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): t_1 = (x * 2.0) / (z_m * (y - t)) t_2 = (x * 2.0) / ((y * z_m) - (z_m * t)) tmp = 0 if t_2 <= -1e-294: tmp = t_1 elif t_2 <= 1e-293: tmp = (x / z_m) / ((y - t) * 0.5) elif t_2 <= 4e+212: tmp = t_1 else: tmp = (x * (2.0 / (y - t))) / 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) t_1 = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t))) t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z_m) - Float64(z_m * t))) tmp = 0.0 if (t_2 <= -1e-294) tmp = t_1; elseif (t_2 <= 1e-293) tmp = Float64(Float64(x / z_m) / Float64(Float64(y - t) * 0.5)); elseif (t_2 <= 4e+212) tmp = t_1; else tmp = Float64(Float64(x * Float64(2.0 / Float64(y - t))) / 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) t_1 = (x * 2.0) / (z_m * (y - t)); t_2 = (x * 2.0) / ((y * z_m) - (z_m * t)); tmp = 0.0; if (t_2 <= -1e-294) tmp = t_1; elseif (t_2 <= 1e-293) tmp = (x / z_m) / ((y - t) * 0.5); elseif (t_2 <= 4e+212) tmp = t_1; else tmp = (x * (2.0 / (y - t))) / 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_] := Block[{t$95$1 = N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z$95$m), $MachinePrecision] - N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[t$95$2, -1e-294], t$95$1, If[LessEqual[t$95$2, 1e-293], N[(N[(x / z$95$m), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+212], t$95$1, N[(N[(x * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_1 := \frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\
t_2 := \frac{x \cdot 2}{y \cdot z\_m - z\_m \cdot t}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-294}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-293}:\\
\;\;\;\;\frac{\frac{x}{z\_m}}{\left(y - t\right) \cdot 0.5}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+212}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{2}{y - t}}{z\_m}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < -1.00000000000000002e-294 or 1.0000000000000001e-293 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < 3.9999999999999996e212Initial program 97.1%
distribute-rgt-out--97.8%
Simplified97.8%
if -1.00000000000000002e-294 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < 1.0000000000000001e-293Initial program 80.2%
*-commutative80.2%
associate-*l/80.2%
*-commutative80.2%
distribute-rgt-out--80.2%
associate-/l/82.4%
Simplified82.4%
associate-*r/96.6%
associate-*l/99.9%
clear-num99.9%
un-div-inv99.9%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if 3.9999999999999996e212 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 58.0%
*-commutative58.0%
associate-*l/57.9%
*-commutative57.9%
distribute-rgt-out--75.5%
associate-/l/75.4%
Simplified75.4%
associate-*r/99.7%
Applied egg-rr99.7%
Final simplification98.7%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(let* ((t_1 (* x (/ (/ 2.0 y) z_m))))
(*
z_s
(if (<= y -3.8e-9)
t_1
(if (<= y 4.4e-283)
(* -2.0 (/ (/ x t) z_m))
(if (<= y 7.2e-85) (* -2.0 (/ x (* z_m t))) t_1))))))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 t_1 = x * ((2.0 / y) / z_m);
double tmp;
if (y <= -3.8e-9) {
tmp = t_1;
} else if (y <= 4.4e-283) {
tmp = -2.0 * ((x / t) / z_m);
} else if (y <= 7.2e-85) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * ((2.0d0 / y) / z_m)
if (y <= (-3.8d-9)) then
tmp = t_1
else if (y <= 4.4d-283) then
tmp = (-2.0d0) * ((x / t) / z_m)
else if (y <= 7.2d-85) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = t_1
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 t_1 = x * ((2.0 / y) / z_m);
double tmp;
if (y <= -3.8e-9) {
tmp = t_1;
} else if (y <= 4.4e-283) {
tmp = -2.0 * ((x / t) / z_m);
} else if (y <= 7.2e-85) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = t_1;
}
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): t_1 = x * ((2.0 / y) / z_m) tmp = 0 if y <= -3.8e-9: tmp = t_1 elif y <= 4.4e-283: tmp = -2.0 * ((x / t) / z_m) elif y <= 7.2e-85: tmp = -2.0 * (x / (z_m * t)) else: tmp = t_1 return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) t_1 = Float64(x * Float64(Float64(2.0 / y) / z_m)) tmp = 0.0 if (y <= -3.8e-9) tmp = t_1; elseif (y <= 4.4e-283) tmp = Float64(-2.0 * Float64(Float64(x / t) / z_m)); elseif (y <= 7.2e-85) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = t_1; 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) t_1 = x * ((2.0 / y) / z_m); tmp = 0.0; if (y <= -3.8e-9) tmp = t_1; elseif (y <= 4.4e-283) tmp = -2.0 * ((x / t) / z_m); elseif (y <= 7.2e-85) tmp = -2.0 * (x / (z_m * t)); else tmp = t_1; 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_] := Block[{t$95$1 = N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[y, -3.8e-9], t$95$1, If[LessEqual[y, 4.4e-283], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-85], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_1 := x \cdot \frac{\frac{2}{y}}{z\_m}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-283}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z\_m}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-85}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -3.80000000000000011e-9 or 7.1999999999999996e-85 < y Initial program 84.6%
*-commutative84.6%
associate-*l/84.5%
*-commutative84.5%
distribute-rgt-out--88.3%
associate-/l/88.9%
Simplified88.9%
Taylor expanded in y around inf 71.9%
associate-/r*72.3%
Simplified72.3%
if -3.80000000000000011e-9 < y < 4.3999999999999996e-283Initial program 85.2%
*-commutative85.2%
associate-*l/84.8%
*-commutative84.8%
distribute-rgt-out--86.4%
associate-/l/87.6%
Simplified87.6%
Taylor expanded in y around 0 73.2%
associate-/r*83.3%
Simplified83.3%
if 4.3999999999999996e-283 < y < 7.1999999999999996e-85Initial program 97.6%
*-commutative97.6%
associate-*l/97.6%
*-commutative97.6%
distribute-rgt-out--97.6%
associate-/l/97.4%
Simplified97.4%
Taylor expanded in y around 0 85.2%
Final simplification77.5%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(let* ((t_1 (* x (/ (/ 2.0 y) z_m))))
(*
z_s
(if (<= y -1.26e-8)
t_1
(if (<= y -5.8e-205)
(* (/ x z_m) (/ -2.0 t))
(if (<= y 7.2e-85) (* -2.0 (/ x (* z_m t))) t_1))))))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 t_1 = x * ((2.0 / y) / z_m);
double tmp;
if (y <= -1.26e-8) {
tmp = t_1;
} else if (y <= -5.8e-205) {
tmp = (x / z_m) * (-2.0 / t);
} else if (y <= 7.2e-85) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * ((2.0d0 / y) / z_m)
if (y <= (-1.26d-8)) then
tmp = t_1
else if (y <= (-5.8d-205)) then
tmp = (x / z_m) * ((-2.0d0) / t)
else if (y <= 7.2d-85) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = t_1
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 t_1 = x * ((2.0 / y) / z_m);
double tmp;
if (y <= -1.26e-8) {
tmp = t_1;
} else if (y <= -5.8e-205) {
tmp = (x / z_m) * (-2.0 / t);
} else if (y <= 7.2e-85) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = t_1;
}
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): t_1 = x * ((2.0 / y) / z_m) tmp = 0 if y <= -1.26e-8: tmp = t_1 elif y <= -5.8e-205: tmp = (x / z_m) * (-2.0 / t) elif y <= 7.2e-85: tmp = -2.0 * (x / (z_m * t)) else: tmp = t_1 return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) t_1 = Float64(x * Float64(Float64(2.0 / y) / z_m)) tmp = 0.0 if (y <= -1.26e-8) tmp = t_1; elseif (y <= -5.8e-205) tmp = Float64(Float64(x / z_m) * Float64(-2.0 / t)); elseif (y <= 7.2e-85) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = t_1; 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) t_1 = x * ((2.0 / y) / z_m); tmp = 0.0; if (y <= -1.26e-8) tmp = t_1; elseif (y <= -5.8e-205) tmp = (x / z_m) * (-2.0 / t); elseif (y <= 7.2e-85) tmp = -2.0 * (x / (z_m * t)); else tmp = t_1; 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_] := Block[{t$95$1 = N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[y, -1.26e-8], t$95$1, If[LessEqual[y, -5.8e-205], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-85], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_1 := x \cdot \frac{\frac{2}{y}}{z\_m}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.26 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-205}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{-2}{t}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-85}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -1.26e-8 or 7.1999999999999996e-85 < y Initial program 84.6%
*-commutative84.6%
associate-*l/84.5%
*-commutative84.5%
distribute-rgt-out--88.3%
associate-/l/88.9%
Simplified88.9%
Taylor expanded in y around inf 71.9%
associate-/r*72.3%
Simplified72.3%
if -1.26e-8 < y < -5.80000000000000036e-205Initial program 80.7%
distribute-rgt-out--81.0%
times-frac99.6%
Simplified99.6%
Taylor expanded in y around 0 83.2%
if -5.80000000000000036e-205 < y < 7.1999999999999996e-85Initial program 93.2%
*-commutative93.2%
associate-*l/92.9%
*-commutative92.9%
distribute-rgt-out--94.1%
associate-/l/94.0%
Simplified94.0%
Taylor expanded in y around 0 84.6%
Final simplification77.6%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= y -4.2e-12)
(* x (/ (/ 2.0 y) z_m))
(if (<= y -1.5e-203)
(* (/ x z_m) (/ -2.0 t))
(if (<= y 1.05e-117)
(* -2.0 (/ x (* z_m t)))
(* (/ x z_m) (/ 2.0 y)))))))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 (y <= -4.2e-12) {
tmp = x * ((2.0 / y) / z_m);
} else if (y <= -1.5e-203) {
tmp = (x / z_m) * (-2.0 / t);
} else if (y <= 1.05e-117) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = (x / z_m) * (2.0 / y);
}
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 (y <= (-4.2d-12)) then
tmp = x * ((2.0d0 / y) / z_m)
else if (y <= (-1.5d-203)) then
tmp = (x / z_m) * ((-2.0d0) / t)
else if (y <= 1.05d-117) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = (x / z_m) * (2.0d0 / y)
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 (y <= -4.2e-12) {
tmp = x * ((2.0 / y) / z_m);
} else if (y <= -1.5e-203) {
tmp = (x / z_m) * (-2.0 / t);
} else if (y <= 1.05e-117) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = (x / z_m) * (2.0 / y);
}
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 y <= -4.2e-12: tmp = x * ((2.0 / y) / z_m) elif y <= -1.5e-203: tmp = (x / z_m) * (-2.0 / t) elif y <= 1.05e-117: tmp = -2.0 * (x / (z_m * t)) else: tmp = (x / z_m) * (2.0 / y) 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 (y <= -4.2e-12) tmp = Float64(x * Float64(Float64(2.0 / y) / z_m)); elseif (y <= -1.5e-203) tmp = Float64(Float64(x / z_m) * Float64(-2.0 / t)); elseif (y <= 1.05e-117) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = Float64(Float64(x / z_m) * Float64(2.0 / y)); 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 (y <= -4.2e-12) tmp = x * ((2.0 / y) / z_m); elseif (y <= -1.5e-203) tmp = (x / z_m) * (-2.0 / t); elseif (y <= 1.05e-117) tmp = -2.0 * (x / (z_m * t)); else tmp = (x / z_m) * (2.0 / y); 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[y, -4.2e-12], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.5e-203], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e-117], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $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}\;y \leq -4.2 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z\_m}\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-203}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{-2}{t}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\
\end{array}
\end{array}
if y < -4.19999999999999988e-12Initial program 90.1%
*-commutative90.1%
associate-*l/90.0%
*-commutative90.0%
distribute-rgt-out--90.0%
associate-/l/90.1%
Simplified90.1%
Taylor expanded in y around inf 74.2%
associate-/r*74.3%
Simplified74.3%
if -4.19999999999999988e-12 < y < -1.5000000000000001e-203Initial program 80.7%
distribute-rgt-out--81.0%
times-frac99.6%
Simplified99.6%
Taylor expanded in y around 0 83.2%
if -1.5000000000000001e-203 < y < 1.05e-117Initial program 93.1%
*-commutative93.1%
associate-*l/92.8%
*-commutative92.8%
distribute-rgt-out--94.0%
associate-/l/93.9%
Simplified93.9%
Taylor expanded in y around 0 84.4%
if 1.05e-117 < y Initial program 79.9%
distribute-rgt-out--87.0%
times-frac94.7%
Simplified94.7%
Taylor expanded in y around inf 71.4%
Final simplification77.8%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= y -1.35e-8)
(* x (/ (/ 2.0 y) z_m))
(if (<= y -3.7e-208)
(/ (/ x z_m) (* t -0.5))
(if (<= y 1.1e-116) (* -2.0 (/ x (* z_m t))) (* (/ x z_m) (/ 2.0 y)))))))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 (y <= -1.35e-8) {
tmp = x * ((2.0 / y) / z_m);
} else if (y <= -3.7e-208) {
tmp = (x / z_m) / (t * -0.5);
} else if (y <= 1.1e-116) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = (x / z_m) * (2.0 / y);
}
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 (y <= (-1.35d-8)) then
tmp = x * ((2.0d0 / y) / z_m)
else if (y <= (-3.7d-208)) then
tmp = (x / z_m) / (t * (-0.5d0))
else if (y <= 1.1d-116) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = (x / z_m) * (2.0d0 / y)
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 (y <= -1.35e-8) {
tmp = x * ((2.0 / y) / z_m);
} else if (y <= -3.7e-208) {
tmp = (x / z_m) / (t * -0.5);
} else if (y <= 1.1e-116) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = (x / z_m) * (2.0 / y);
}
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 y <= -1.35e-8: tmp = x * ((2.0 / y) / z_m) elif y <= -3.7e-208: tmp = (x / z_m) / (t * -0.5) elif y <= 1.1e-116: tmp = -2.0 * (x / (z_m * t)) else: tmp = (x / z_m) * (2.0 / y) 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 (y <= -1.35e-8) tmp = Float64(x * Float64(Float64(2.0 / y) / z_m)); elseif (y <= -3.7e-208) tmp = Float64(Float64(x / z_m) / Float64(t * -0.5)); elseif (y <= 1.1e-116) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = Float64(Float64(x / z_m) * Float64(2.0 / y)); 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 (y <= -1.35e-8) tmp = x * ((2.0 / y) / z_m); elseif (y <= -3.7e-208) tmp = (x / z_m) / (t * -0.5); elseif (y <= 1.1e-116) tmp = -2.0 * (x / (z_m * t)); else tmp = (x / z_m) * (2.0 / y); 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[y, -1.35e-8], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.7e-208], N[(N[(x / z$95$m), $MachinePrecision] / N[(t * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-116], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $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}\;y \leq -1.35 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z\_m}\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-208}:\\
\;\;\;\;\frac{\frac{x}{z\_m}}{t \cdot -0.5}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-116}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\
\end{array}
\end{array}
if y < -1.35000000000000001e-8Initial program 90.1%
*-commutative90.1%
associate-*l/90.0%
*-commutative90.0%
distribute-rgt-out--90.0%
associate-/l/90.1%
Simplified90.1%
Taylor expanded in y around inf 74.2%
associate-/r*74.3%
Simplified74.3%
if -1.35000000000000001e-8 < y < -3.7000000000000002e-208Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
distribute-rgt-out--80.8%
associate-/l/83.8%
Simplified83.8%
Taylor expanded in y around 0 58.5%
associate-*r/58.5%
frac-times83.2%
*-commutative83.2%
clear-num83.2%
un-div-inv83.2%
div-inv83.2%
metadata-eval83.2%
Applied egg-rr83.2%
if -3.7000000000000002e-208 < y < 1.10000000000000005e-116Initial program 93.1%
*-commutative93.1%
associate-*l/92.8%
*-commutative92.8%
distribute-rgt-out--94.0%
associate-/l/93.9%
Simplified93.9%
Taylor expanded in y around 0 84.4%
if 1.10000000000000005e-116 < y Initial program 79.9%
distribute-rgt-out--87.0%
times-frac94.7%
Simplified94.7%
Taylor expanded in y around inf 71.4%
Final simplification77.8%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= y -1.25e-10)
(/ (/ x (* z_m 0.5)) y)
(if (<= y -5.5e-207)
(/ (/ x z_m) (* t -0.5))
(if (<= y 1.1e-116) (* -2.0 (/ x (* z_m t))) (* (/ x z_m) (/ 2.0 y)))))))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 (y <= -1.25e-10) {
tmp = (x / (z_m * 0.5)) / y;
} else if (y <= -5.5e-207) {
tmp = (x / z_m) / (t * -0.5);
} else if (y <= 1.1e-116) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = (x / z_m) * (2.0 / y);
}
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 (y <= (-1.25d-10)) then
tmp = (x / (z_m * 0.5d0)) / y
else if (y <= (-5.5d-207)) then
tmp = (x / z_m) / (t * (-0.5d0))
else if (y <= 1.1d-116) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = (x / z_m) * (2.0d0 / y)
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 (y <= -1.25e-10) {
tmp = (x / (z_m * 0.5)) / y;
} else if (y <= -5.5e-207) {
tmp = (x / z_m) / (t * -0.5);
} else if (y <= 1.1e-116) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = (x / z_m) * (2.0 / y);
}
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 y <= -1.25e-10: tmp = (x / (z_m * 0.5)) / y elif y <= -5.5e-207: tmp = (x / z_m) / (t * -0.5) elif y <= 1.1e-116: tmp = -2.0 * (x / (z_m * t)) else: tmp = (x / z_m) * (2.0 / y) 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 (y <= -1.25e-10) tmp = Float64(Float64(x / Float64(z_m * 0.5)) / y); elseif (y <= -5.5e-207) tmp = Float64(Float64(x / z_m) / Float64(t * -0.5)); elseif (y <= 1.1e-116) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = Float64(Float64(x / z_m) * Float64(2.0 / y)); 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 (y <= -1.25e-10) tmp = (x / (z_m * 0.5)) / y; elseif (y <= -5.5e-207) tmp = (x / z_m) / (t * -0.5); elseif (y <= 1.1e-116) tmp = -2.0 * (x / (z_m * t)); else tmp = (x / z_m) * (2.0 / y); 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[y, -1.25e-10], N[(N[(x / N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, -5.5e-207], N[(N[(x / z$95$m), $MachinePrecision] / N[(t * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-116], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $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}\;y \leq -1.25 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{x}{z\_m \cdot 0.5}}{y}\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-207}:\\
\;\;\;\;\frac{\frac{x}{z\_m}}{t \cdot -0.5}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-116}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\
\end{array}
\end{array}
if y < -1.25000000000000008e-10Initial program 90.1%
*-commutative90.1%
associate-*l/90.0%
*-commutative90.0%
distribute-rgt-out--90.0%
associate-/l/90.1%
Simplified90.1%
Taylor expanded in y around inf 74.2%
associate-/r*74.3%
Simplified74.3%
associate-*r/67.6%
associate-*r/67.7%
associate-/r*74.3%
frac-times67.6%
associate-*l/74.3%
clear-num74.3%
un-div-inv74.4%
div-inv74.4%
metadata-eval74.4%
Applied egg-rr74.4%
if -1.25000000000000008e-10 < y < -5.4999999999999997e-207Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
distribute-rgt-out--80.8%
associate-/l/83.8%
Simplified83.8%
Taylor expanded in y around 0 58.5%
associate-*r/58.5%
frac-times83.2%
*-commutative83.2%
clear-num83.2%
un-div-inv83.2%
div-inv83.2%
metadata-eval83.2%
Applied egg-rr83.2%
if -5.4999999999999997e-207 < y < 1.10000000000000005e-116Initial program 93.1%
*-commutative93.1%
associate-*l/92.8%
*-commutative92.8%
distribute-rgt-out--94.0%
associate-/l/93.9%
Simplified93.9%
Taylor expanded in y around 0 84.4%
if 1.10000000000000005e-116 < y Initial program 79.9%
distribute-rgt-out--87.0%
times-frac94.7%
Simplified94.7%
Taylor expanded in y around inf 71.4%
Final simplification77.9%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= (* x 2.0) 2e+80)
(/ (* x 2.0) (* z_m (- y t)))
(/ (* x (/ 2.0 (- y t))) 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) <= 2e+80) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = (x * (2.0 / (y - t))) / 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) <= 2d+80) then
tmp = (x * 2.0d0) / (z_m * (y - t))
else
tmp = (x * (2.0d0 / (y - t))) / 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) <= 2e+80) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = (x * (2.0 / (y - t))) / 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) <= 2e+80: tmp = (x * 2.0) / (z_m * (y - t)) else: tmp = (x * (2.0 / (y - t))) / 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) <= 2e+80) tmp = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(x * Float64(2.0 / Float64(y - t))) / 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) <= 2e+80) tmp = (x * 2.0) / (z_m * (y - t)); else tmp = (x * (2.0 / (y - t))) / 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], 2e+80], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $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 2 \cdot 10^{+80}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{2}{y - t}}{z\_m}\\
\end{array}
\end{array}
if (*.f64 x 2) < 2e80Initial program 89.3%
distribute-rgt-out--92.0%
Simplified92.0%
if 2e80 < (*.f64 x 2) Initial program 78.1%
*-commutative78.1%
associate-*l/78.0%
*-commutative78.0%
distribute-rgt-out--80.1%
associate-/l/80.9%
Simplified80.9%
associate-*r/92.5%
Applied egg-rr92.5%
Final simplification92.1%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m t) :precision binary64 (let* ((t_1 (/ 2.0 (- y t)))) (* z_s (if (<= z_m 5e-6) (* x (/ t_1 z_m)) (* (/ x z_m) t_1)))))
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 t_1 = 2.0 / (y - t);
double tmp;
if (z_m <= 5e-6) {
tmp = x * (t_1 / z_m);
} else {
tmp = (x / z_m) * t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = 2.0d0 / (y - t)
if (z_m <= 5d-6) then
tmp = x * (t_1 / z_m)
else
tmp = (x / z_m) * t_1
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 t_1 = 2.0 / (y - t);
double tmp;
if (z_m <= 5e-6) {
tmp = x * (t_1 / z_m);
} else {
tmp = (x / z_m) * t_1;
}
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): t_1 = 2.0 / (y - t) tmp = 0 if z_m <= 5e-6: tmp = x * (t_1 / z_m) else: tmp = (x / z_m) * t_1 return z_s * tmp
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) t_1 = Float64(2.0 / Float64(y - t)) tmp = 0.0 if (z_m <= 5e-6) tmp = Float64(x * Float64(t_1 / z_m)); else tmp = Float64(Float64(x / z_m) * t_1); 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) t_1 = 2.0 / (y - t); tmp = 0.0; if (z_m <= 5e-6) tmp = x * (t_1 / z_m); else tmp = (x / z_m) * t_1; 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_] := Block[{t$95$1 = N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 5e-6], N[(x * N[(t$95$1 / z$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
\begin{array}{l}
t_1 := \frac{2}{y - t}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 5 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \frac{t\_1}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot t\_1\\
\end{array}
\end{array}
\end{array}
if z < 5.00000000000000041e-6Initial program 90.9%
*-commutative90.9%
associate-*l/90.7%
*-commutative90.7%
distribute-rgt-out--92.4%
associate-/l/92.6%
Simplified92.6%
if 5.00000000000000041e-6 < z Initial program 74.5%
distribute-rgt-out--79.8%
times-frac95.0%
Simplified95.0%
Final simplification93.2%
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= z_m 52000.0)
(/ (* x 2.0) (* z_m (- y t)))
(* (/ x z_m) (/ 2.0 (- 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 <= 52000.0) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = (x / z_m) * (2.0 / (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 <= 52000.0d0) then
tmp = (x * 2.0d0) / (z_m * (y - t))
else
tmp = (x / z_m) * (2.0d0 / (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 <= 52000.0) {
tmp = (x * 2.0) / (z_m * (y - t));
} else {
tmp = (x / z_m) * (2.0 / (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 <= 52000.0: tmp = (x * 2.0) / (z_m * (y - t)) else: tmp = (x / z_m) * (2.0 / (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 <= 52000.0) tmp = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t))); else tmp = Float64(Float64(x / z_m) * Float64(2.0 / 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 <= 52000.0) tmp = (x * 2.0) / (z_m * (y - t)); else tmp = (x / z_m) * (2.0 / (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, 52000.0], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / 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 52000:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y - t}\\
\end{array}
\end{array}
if z < 52000Initial program 91.0%
distribute-rgt-out--92.6%
Simplified92.6%
if 52000 < z Initial program 74.1%
distribute-rgt-out--79.5%
times-frac95.0%
Simplified95.0%
Final simplification93.2%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (* x (/ (/ 2.0 (- y t)) 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) {
return z_s * (x * ((2.0 / (y - t)) / z_m));
}
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 * (x * ((2.0d0 / (y - t)) / z_m))
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 * (x * ((2.0 / (y - t)) / z_m));
}
z_m = math.fabs(z) z_s = math.copysign(1.0, z) def code(z_s, x, y, z_m, t): return z_s * (x * ((2.0 / (y - t)) / z_m))
z_m = abs(z) z_s = copysign(1.0, z) function code(z_s, x, y, z_m, t) return Float64(z_s * Float64(x * Float64(Float64(2.0 / Float64(y - t)) / z_m))) 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 * (x * ((2.0 / (y - t)) / z_m)); 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[(x * N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / 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 \left(x \cdot \frac{\frac{2}{y - t}}{z\_m}\right)
\end{array}
Initial program 87.0%
*-commutative87.0%
associate-*l/86.8%
*-commutative86.8%
distribute-rgt-out--89.4%
associate-/l/90.0%
Simplified90.0%
Final simplification90.0%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 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 87.0%
*-commutative87.0%
associate-*l/86.8%
*-commutative86.8%
distribute-rgt-out--89.4%
associate-/l/90.0%
Simplified90.0%
Taylor expanded in y around 0 54.8%
Final simplification54.8%
z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) (FPCore (z_s x y z_m t) :precision binary64 (* z_s (* -2.0 (/ (/ x t) 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) {
return z_s * (-2.0 * ((x / t) / z_m));
}
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 / t) / z_m))
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 / t) / z_m));
}
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 / t) / z_m))
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 / t) / z_m))) 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 / t) / z_m)); 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 / t), $MachinePrecision] / 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 \left(-2 \cdot \frac{\frac{x}{t}}{z\_m}\right)
\end{array}
Initial program 87.0%
*-commutative87.0%
associate-*l/86.8%
*-commutative86.8%
distribute-rgt-out--89.4%
associate-/l/90.0%
Simplified90.0%
Taylor expanded in y around 0 54.8%
associate-/r*57.9%
Simplified57.9%
Final simplification57.9%
(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 2024036
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))