
(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 1 z)
(FPCore (z_s x y z_m t)
:precision binary64
(*
z_s
(if (<= (- (* y z_m) (* z_m t)) 0.0)
(/ (/ 2.0 (- y t)) (/ z_m x))
(/ (* 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 (((y * z_m) - (z_m * t)) <= 0.0) {
tmp = (2.0 / (y - t)) / (z_m / x);
} 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 (((y * z_m) - (z_m * t)) <= 0.0d0) then
tmp = (2.0d0 / (y - t)) / (z_m / x)
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 (((y * z_m) - (z_m * t)) <= 0.0) {
tmp = (2.0 / (y - t)) / (z_m / x);
} 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 ((y * z_m) - (z_m * t)) <= 0.0: tmp = (2.0 / (y - t)) / (z_m / x) 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 (Float64(Float64(y * z_m) - Float64(z_m * t)) <= 0.0) tmp = Float64(Float64(2.0 / Float64(y - t)) / Float64(z_m / x)); else tmp = Float64(Float64(2.0 * x) / Float64(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 (((y * z_m) - (z_m * t)) <= 0.0) tmp = (2.0 / (y - t)) / (z_m / x); 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[N[(N[(y * z$95$m), $MachinePrecision] - N[(z$95$m * t), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * x), $MachinePrecision] / N[(z$95$m * 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}\;y \cdot z_m - z_m \cdot t \leq 0:\\
\;\;\;\;\frac{\frac{2}{y - t}}{\frac{z_m}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{z_m \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if (-.f64 (*.f64 y z) (*.f64 t z)) < 0.0Initial program 89.4%
*-commutative89.4%
associate-*l/89.4%
*-commutative89.4%
distribute-rgt-out--90.8%
associate-/l/91.1%
Simplified91.1%
associate-*r/89.9%
associate-*l/95.6%
*-commutative95.6%
clear-num95.6%
un-div-inv95.7%
Applied egg-rr95.7%
if 0.0 < (-.f64 (*.f64 y z) (*.f64 t z)) Initial program 87.6%
distribute-rgt-out--95.6%
Simplified95.6%
Final simplification95.6%
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 z_m) (/ 2.0 y))))
(*
z_s
(if (<= y -2000000.0)
t_1
(if (<= y -1.45e-31)
(* -2.0 (/ x (* z_m t)))
(if (<= y -2.8e-92)
t_1
(if (<= y 1.4e-88)
(* -2.0 (/ (/ x t) z_m))
(* x (/ (/ 2.0 y) 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 / z_m) * (2.0 / y);
double tmp;
if (y <= -2000000.0) {
tmp = t_1;
} else if (y <= -1.45e-31) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -2.8e-92) {
tmp = t_1;
} else if (y <= 1.4e-88) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = x * ((2.0 / y) / 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) :: tmp
t_1 = (x / z_m) * (2.0d0 / y)
if (y <= (-2000000.0d0)) then
tmp = t_1
else if (y <= (-1.45d-31)) then
tmp = (-2.0d0) * (x / (z_m * t))
else if (y <= (-2.8d-92)) then
tmp = t_1
else if (y <= 1.4d-88) then
tmp = (-2.0d0) * ((x / t) / z_m)
else
tmp = x * ((2.0d0 / y) / 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 / z_m) * (2.0 / y);
double tmp;
if (y <= -2000000.0) {
tmp = t_1;
} else if (y <= -1.45e-31) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -2.8e-92) {
tmp = t_1;
} else if (y <= 1.4e-88) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = x * ((2.0 / y) / 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 / z_m) * (2.0 / y) tmp = 0 if y <= -2000000.0: tmp = t_1 elif y <= -1.45e-31: tmp = -2.0 * (x / (z_m * t)) elif y <= -2.8e-92: tmp = t_1 elif y <= 1.4e-88: tmp = -2.0 * ((x / t) / z_m) else: tmp = x * ((2.0 / y) / 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 / z_m) * Float64(2.0 / y)) tmp = 0.0 if (y <= -2000000.0) tmp = t_1; elseif (y <= -1.45e-31) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); elseif (y <= -2.8e-92) tmp = t_1; elseif (y <= 1.4e-88) tmp = Float64(-2.0 * Float64(Float64(x / t) / z_m)); else tmp = Float64(x * Float64(Float64(2.0 / y) / 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 / z_m) * (2.0 / y); tmp = 0.0; if (y <= -2000000.0) tmp = t_1; elseif (y <= -1.45e-31) tmp = -2.0 * (x / (z_m * t)); elseif (y <= -2.8e-92) tmp = t_1; elseif (y <= 1.4e-88) tmp = -2.0 * ((x / t) / z_m); else tmp = x * ((2.0 / y) / 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 / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[y, -2000000.0], t$95$1, If[LessEqual[y, -1.45e-31], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.8e-92], t$95$1, If[LessEqual[y, 1.4e-88], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $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}{z_m} \cdot \frac{2}{y}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-31}:\\
\;\;\;\;-2 \cdot \frac{x}{z_m \cdot t}\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{-92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-88}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z_m}\\
\end{array}
\end{array}
\end{array}
if y < -2e6 or -1.45e-31 < y < -2.8e-92Initial program 83.6%
distribute-rgt-out--89.1%
times-frac97.2%
Simplified97.2%
Taylor expanded in y around inf 80.2%
if -2e6 < y < -1.45e-31Initial program 99.9%
*-commutative99.9%
associate-*l/99.3%
*-commutative99.3%
distribute-rgt-out--99.3%
associate-/l/99.4%
Simplified99.4%
Taylor expanded in y around 0 82.1%
*-commutative82.1%
Simplified82.1%
if -2.8e-92 < y < 1.39999999999999988e-88Initial program 88.7%
*-commutative88.7%
associate-*l/88.8%
*-commutative88.8%
distribute-rgt-out--91.1%
associate-/l/91.0%
Simplified91.0%
Taylor expanded in y around 0 77.7%
associate-/r*83.0%
Simplified83.0%
if 1.39999999999999988e-88 < y Initial program 91.5%
*-commutative91.5%
associate-*l/91.5%
*-commutative91.5%
distribute-rgt-out--97.4%
associate-/l/97.9%
Simplified97.9%
Taylor expanded in y around inf 71.7%
associate-/r*71.7%
Simplified71.7%
Final simplification78.4%
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 z_m) (/ 2.0 y))))
(*
z_s
(if (<= y -2200000.0)
t_1
(if (<= y -1.5e-31)
(* -2.0 (/ x (* z_m t)))
(if (<= y -4.8e-92)
t_1
(if (<= y 1.4e-88)
(* -2.0 (/ (/ x t) z_m))
(/ 2.0 (/ (* y z_m) x)))))))))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 / z_m) * (2.0 / y);
double tmp;
if (y <= -2200000.0) {
tmp = t_1;
} else if (y <= -1.5e-31) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -4.8e-92) {
tmp = t_1;
} else if (y <= 1.4e-88) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = 2.0 / ((y * z_m) / x);
}
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 / z_m) * (2.0d0 / y)
if (y <= (-2200000.0d0)) then
tmp = t_1
else if (y <= (-1.5d-31)) then
tmp = (-2.0d0) * (x / (z_m * t))
else if (y <= (-4.8d-92)) then
tmp = t_1
else if (y <= 1.4d-88) then
tmp = (-2.0d0) * ((x / t) / z_m)
else
tmp = 2.0d0 / ((y * z_m) / x)
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 / z_m) * (2.0 / y);
double tmp;
if (y <= -2200000.0) {
tmp = t_1;
} else if (y <= -1.5e-31) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -4.8e-92) {
tmp = t_1;
} else if (y <= 1.4e-88) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = 2.0 / ((y * z_m) / x);
}
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 / z_m) * (2.0 / y) tmp = 0 if y <= -2200000.0: tmp = t_1 elif y <= -1.5e-31: tmp = -2.0 * (x / (z_m * t)) elif y <= -4.8e-92: tmp = t_1 elif y <= 1.4e-88: tmp = -2.0 * ((x / t) / z_m) else: tmp = 2.0 / ((y * z_m) / x) 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 / z_m) * Float64(2.0 / y)) tmp = 0.0 if (y <= -2200000.0) tmp = t_1; elseif (y <= -1.5e-31) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); elseif (y <= -4.8e-92) tmp = t_1; elseif (y <= 1.4e-88) tmp = Float64(-2.0 * Float64(Float64(x / t) / z_m)); else tmp = Float64(2.0 / Float64(Float64(y * z_m) / x)); 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 / z_m) * (2.0 / y); tmp = 0.0; if (y <= -2200000.0) tmp = t_1; elseif (y <= -1.5e-31) tmp = -2.0 * (x / (z_m * t)); elseif (y <= -4.8e-92) tmp = t_1; elseif (y <= 1.4e-88) tmp = -2.0 * ((x / t) / z_m); else tmp = 2.0 / ((y * z_m) / x); 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 / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[y, -2200000.0], t$95$1, If[LessEqual[y, -1.5e-31], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.8e-92], t$95$1, If[LessEqual[y, 1.4e-88], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(y * z$95$m), $MachinePrecision] / x), $MachinePrecision]), $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}{z_m} \cdot \frac{2}{y}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2200000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-31}:\\
\;\;\;\;-2 \cdot \frac{x}{z_m \cdot t}\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-88}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{y \cdot z_m}{x}}\\
\end{array}
\end{array}
\end{array}
if y < -2.2e6 or -1.49999999999999991e-31 < y < -4.8000000000000002e-92Initial program 83.6%
distribute-rgt-out--89.1%
times-frac97.2%
Simplified97.2%
Taylor expanded in y around inf 80.2%
if -2.2e6 < y < -1.49999999999999991e-31Initial program 99.9%
*-commutative99.9%
associate-*l/99.3%
*-commutative99.3%
distribute-rgt-out--99.3%
associate-/l/99.4%
Simplified99.4%
Taylor expanded in y around 0 82.1%
*-commutative82.1%
Simplified82.1%
if -4.8000000000000002e-92 < y < 1.39999999999999988e-88Initial program 88.7%
*-commutative88.7%
associate-*l/88.8%
*-commutative88.8%
distribute-rgt-out--91.1%
associate-/l/91.0%
Simplified91.0%
Taylor expanded in y around 0 77.7%
associate-/r*83.0%
Simplified83.0%
if 1.39999999999999988e-88 < y Initial program 91.5%
distribute-rgt-out--97.4%
times-frac92.9%
Simplified92.9%
Taylor expanded in y around inf 69.9%
clear-num69.8%
frac-times70.6%
metadata-eval70.6%
Applied egg-rr70.6%
Taylor expanded in z around 0 72.9%
Final simplification78.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 -7000.0)
(/ (/ 2.0 y) (/ z_m x))
(if (<= y -1e-32)
(* -2.0 (/ x (* z_m t)))
(if (<= y -5.2e-92)
(* (/ x z_m) (/ 2.0 y))
(if (<= y 1.75e-92)
(* -2.0 (/ (/ x t) z_m))
(/ 2.0 (/ (* y z_m) x))))))))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 <= -7000.0) {
tmp = (2.0 / y) / (z_m / x);
} else if (y <= -1e-32) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -5.2e-92) {
tmp = (x / z_m) * (2.0 / y);
} else if (y <= 1.75e-92) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = 2.0 / ((y * z_m) / x);
}
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 <= (-7000.0d0)) then
tmp = (2.0d0 / y) / (z_m / x)
else if (y <= (-1d-32)) then
tmp = (-2.0d0) * (x / (z_m * t))
else if (y <= (-5.2d-92)) then
tmp = (x / z_m) * (2.0d0 / y)
else if (y <= 1.75d-92) then
tmp = (-2.0d0) * ((x / t) / z_m)
else
tmp = 2.0d0 / ((y * z_m) / x)
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 <= -7000.0) {
tmp = (2.0 / y) / (z_m / x);
} else if (y <= -1e-32) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -5.2e-92) {
tmp = (x / z_m) * (2.0 / y);
} else if (y <= 1.75e-92) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = 2.0 / ((y * z_m) / x);
}
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 <= -7000.0: tmp = (2.0 / y) / (z_m / x) elif y <= -1e-32: tmp = -2.0 * (x / (z_m * t)) elif y <= -5.2e-92: tmp = (x / z_m) * (2.0 / y) elif y <= 1.75e-92: tmp = -2.0 * ((x / t) / z_m) else: tmp = 2.0 / ((y * z_m) / x) 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 <= -7000.0) tmp = Float64(Float64(2.0 / y) / Float64(z_m / x)); elseif (y <= -1e-32) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); elseif (y <= -5.2e-92) tmp = Float64(Float64(x / z_m) * Float64(2.0 / y)); elseif (y <= 1.75e-92) tmp = Float64(-2.0 * Float64(Float64(x / t) / z_m)); else tmp = Float64(2.0 / Float64(Float64(y * z_m) / x)); 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 <= -7000.0) tmp = (2.0 / y) / (z_m / x); elseif (y <= -1e-32) tmp = -2.0 * (x / (z_m * t)); elseif (y <= -5.2e-92) tmp = (x / z_m) * (2.0 / y); elseif (y <= 1.75e-92) tmp = -2.0 * ((x / t) / z_m); else tmp = 2.0 / ((y * z_m) / x); 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, -7000.0], N[(N[(2.0 / y), $MachinePrecision] / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1e-32], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.2e-92], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e-92], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(y * z$95$m), $MachinePrecision] / x), $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 -7000:\\
\;\;\;\;\frac{\frac{2}{y}}{\frac{z_m}{x}}\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-32}:\\
\;\;\;\;-2 \cdot \frac{x}{z_m \cdot t}\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{-92}:\\
\;\;\;\;\frac{x}{z_m} \cdot \frac{2}{y}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-92}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{y \cdot z_m}{x}}\\
\end{array}
\end{array}
if y < -7e3Initial program 80.8%
distribute-rgt-out--87.3%
times-frac96.8%
Simplified96.8%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
clear-num79.8%
un-div-inv79.9%
Applied egg-rr79.9%
if -7e3 < y < -1.00000000000000006e-32Initial program 99.8%
*-commutative99.8%
associate-*l/99.3%
*-commutative99.3%
distribute-rgt-out--99.3%
associate-/l/99.5%
Simplified99.5%
Taylor expanded in y around 0 88.7%
*-commutative88.7%
Simplified88.7%
if -1.00000000000000006e-32 < y < -5.2e-92Initial program 99.6%
distribute-rgt-out--99.6%
times-frac99.6%
Simplified99.6%
Taylor expanded in y around inf 77.2%
if -5.2e-92 < y < 1.75e-92Initial program 88.7%
*-commutative88.7%
associate-*l/88.8%
*-commutative88.8%
distribute-rgt-out--91.1%
associate-/l/91.0%
Simplified91.0%
Taylor expanded in y around 0 77.7%
associate-/r*83.0%
Simplified83.0%
if 1.75e-92 < y Initial program 91.5%
distribute-rgt-out--97.4%
times-frac92.9%
Simplified92.9%
Taylor expanded in y around inf 69.9%
clear-num69.8%
frac-times70.6%
metadata-eval70.6%
Applied egg-rr70.6%
Taylor expanded in z around 0 72.9%
Final simplification78.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 -0.85)
(/ (/ 2.0 y) (/ z_m x))
(if (<= y -8.2e-33)
(* -2.0 (/ x (* z_m t)))
(if (<= y -2.95e-92)
(/ (/ (* 2.0 x) z_m) y)
(if (<= y 1.4e-88)
(* -2.0 (/ (/ x t) z_m))
(/ 2.0 (/ (* y z_m) x))))))))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 <= -0.85) {
tmp = (2.0 / y) / (z_m / x);
} else if (y <= -8.2e-33) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -2.95e-92) {
tmp = ((2.0 * x) / z_m) / y;
} else if (y <= 1.4e-88) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = 2.0 / ((y * z_m) / x);
}
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 <= (-0.85d0)) then
tmp = (2.0d0 / y) / (z_m / x)
else if (y <= (-8.2d-33)) then
tmp = (-2.0d0) * (x / (z_m * t))
else if (y <= (-2.95d-92)) then
tmp = ((2.0d0 * x) / z_m) / y
else if (y <= 1.4d-88) then
tmp = (-2.0d0) * ((x / t) / z_m)
else
tmp = 2.0d0 / ((y * z_m) / x)
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 <= -0.85) {
tmp = (2.0 / y) / (z_m / x);
} else if (y <= -8.2e-33) {
tmp = -2.0 * (x / (z_m * t));
} else if (y <= -2.95e-92) {
tmp = ((2.0 * x) / z_m) / y;
} else if (y <= 1.4e-88) {
tmp = -2.0 * ((x / t) / z_m);
} else {
tmp = 2.0 / ((y * z_m) / x);
}
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 <= -0.85: tmp = (2.0 / y) / (z_m / x) elif y <= -8.2e-33: tmp = -2.0 * (x / (z_m * t)) elif y <= -2.95e-92: tmp = ((2.0 * x) / z_m) / y elif y <= 1.4e-88: tmp = -2.0 * ((x / t) / z_m) else: tmp = 2.0 / ((y * z_m) / x) 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 <= -0.85) tmp = Float64(Float64(2.0 / y) / Float64(z_m / x)); elseif (y <= -8.2e-33) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); elseif (y <= -2.95e-92) tmp = Float64(Float64(Float64(2.0 * x) / z_m) / y); elseif (y <= 1.4e-88) tmp = Float64(-2.0 * Float64(Float64(x / t) / z_m)); else tmp = Float64(2.0 / Float64(Float64(y * z_m) / x)); 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 <= -0.85) tmp = (2.0 / y) / (z_m / x); elseif (y <= -8.2e-33) tmp = -2.0 * (x / (z_m * t)); elseif (y <= -2.95e-92) tmp = ((2.0 * x) / z_m) / y; elseif (y <= 1.4e-88) tmp = -2.0 * ((x / t) / z_m); else tmp = 2.0 / ((y * z_m) / x); 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, -0.85], N[(N[(2.0 / y), $MachinePrecision] / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.2e-33], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.95e-92], N[(N[(N[(2.0 * x), $MachinePrecision] / z$95$m), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.4e-88], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(y * z$95$m), $MachinePrecision] / x), $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 -0.85:\\
\;\;\;\;\frac{\frac{2}{y}}{\frac{z_m}{x}}\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{-33}:\\
\;\;\;\;-2 \cdot \frac{x}{z_m \cdot t}\\
\mathbf{elif}\;y \leq -2.95 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{2 \cdot x}{z_m}}{y}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-88}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{y \cdot z_m}{x}}\\
\end{array}
\end{array}
if y < -0.849999999999999978Initial program 80.8%
distribute-rgt-out--87.3%
times-frac96.8%
Simplified96.8%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
clear-num79.8%
un-div-inv79.9%
Applied egg-rr79.9%
if -0.849999999999999978 < y < -8.2e-33Initial program 99.8%
*-commutative99.8%
associate-*l/99.3%
*-commutative99.3%
distribute-rgt-out--99.3%
associate-/l/99.5%
Simplified99.5%
Taylor expanded in y around 0 88.7%
*-commutative88.7%
Simplified88.7%
if -8.2e-33 < y < -2.95e-92Initial program 99.6%
*-commutative99.6%
associate-*l/99.3%
*-commutative99.3%
distribute-rgt-out--99.3%
associate-/l/99.5%
Simplified99.5%
Taylor expanded in y around inf 70.4%
associate-*r/70.4%
*-commutative70.4%
*-commutative70.4%
associate-/r*77.3%
*-commutative77.3%
Simplified77.3%
if -2.95e-92 < y < 1.39999999999999988e-88Initial program 88.7%
*-commutative88.7%
associate-*l/88.8%
*-commutative88.8%
distribute-rgt-out--91.1%
associate-/l/91.0%
Simplified91.0%
Taylor expanded in y around 0 77.7%
associate-/r*83.0%
Simplified83.0%
if 1.39999999999999988e-88 < y Initial program 91.5%
distribute-rgt-out--97.4%
times-frac92.9%
Simplified92.9%
Taylor expanded in y around inf 69.9%
clear-num69.8%
frac-times70.6%
metadata-eval70.6%
Applied egg-rr70.6%
Taylor expanded in z around 0 72.9%
Final simplification78.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 (or (<= t -8.1e-72) (not (<= t 4.8e+79)))
(* (/ x z_m) (/ -2.0 t))
(* x (/ (/ 2.0 y) 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 ((t <= -8.1e-72) || !(t <= 4.8e+79)) {
tmp = (x / z_m) * (-2.0 / t);
} else {
tmp = x * ((2.0 / y) / 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 ((t <= (-8.1d-72)) .or. (.not. (t <= 4.8d+79))) then
tmp = (x / z_m) * ((-2.0d0) / t)
else
tmp = x * ((2.0d0 / y) / 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 ((t <= -8.1e-72) || !(t <= 4.8e+79)) {
tmp = (x / z_m) * (-2.0 / t);
} else {
tmp = x * ((2.0 / y) / 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 (t <= -8.1e-72) or not (t <= 4.8e+79): tmp = (x / z_m) * (-2.0 / t) else: tmp = x * ((2.0 / y) / 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 ((t <= -8.1e-72) || !(t <= 4.8e+79)) tmp = Float64(Float64(x / z_m) * Float64(-2.0 / t)); else tmp = Float64(x * Float64(Float64(2.0 / y) / 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 ((t <= -8.1e-72) || ~((t <= 4.8e+79))) tmp = (x / z_m) * (-2.0 / t); else tmp = x * ((2.0 / y) / 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[Or[LessEqual[t, -8.1e-72], N[Not[LessEqual[t, 4.8e+79]], $MachinePrecision]], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 / y), $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 \begin{array}{l}
\mathbf{if}\;t \leq -8.1 \cdot 10^{-72} \lor \neg \left(t \leq 4.8 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{x}{z_m} \cdot \frac{-2}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z_m}\\
\end{array}
\end{array}
if t < -8.1000000000000004e-72 or 4.79999999999999971e79 < t Initial program 85.6%
distribute-rgt-out--93.1%
times-frac96.5%
Simplified96.5%
Taylor expanded in y around 0 80.9%
if -8.1000000000000004e-72 < t < 4.79999999999999971e79Initial program 91.3%
*-commutative91.3%
associate-*l/91.3%
*-commutative91.3%
distribute-rgt-out--92.8%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around inf 76.6%
associate-/r*76.6%
Simplified76.6%
Final simplification78.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 (<= t -1.25e+48)
(* -2.0 (/ (/ x t) z_m))
(if (<= t 9.5e+79) (* x (/ (/ 2.0 y) z_m)) (* x (/ (/ -2.0 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 (t <= -1.25e+48) {
tmp = -2.0 * ((x / t) / z_m);
} else if (t <= 9.5e+79) {
tmp = x * ((2.0 / y) / z_m);
} else {
tmp = x * ((-2.0 / 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 (t <= (-1.25d+48)) then
tmp = (-2.0d0) * ((x / t) / z_m)
else if (t <= 9.5d+79) then
tmp = x * ((2.0d0 / y) / z_m)
else
tmp = x * (((-2.0d0) / 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 (t <= -1.25e+48) {
tmp = -2.0 * ((x / t) / z_m);
} else if (t <= 9.5e+79) {
tmp = x * ((2.0 / y) / z_m);
} else {
tmp = x * ((-2.0 / 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 t <= -1.25e+48: tmp = -2.0 * ((x / t) / z_m) elif t <= 9.5e+79: tmp = x * ((2.0 / y) / z_m) else: tmp = x * ((-2.0 / 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 (t <= -1.25e+48) tmp = Float64(-2.0 * Float64(Float64(x / t) / z_m)); elseif (t <= 9.5e+79) tmp = Float64(x * Float64(Float64(2.0 / y) / z_m)); else tmp = Float64(x * Float64(Float64(-2.0 / 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 (t <= -1.25e+48) tmp = -2.0 * ((x / t) / z_m); elseif (t <= 9.5e+79) tmp = x * ((2.0 / y) / z_m); else tmp = x * ((-2.0 / 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[t, -1.25e+48], N[(-2.0 * N[(N[(x / t), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e+79], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-2.0 / 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 \begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+48}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z_m}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+79}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{-2}{t}}{z_m}\\
\end{array}
\end{array}
if t < -1.24999999999999993e48Initial program 81.5%
*-commutative81.5%
associate-*l/81.4%
*-commutative81.4%
distribute-rgt-out--91.0%
associate-/l/91.0%
Simplified91.0%
Taylor expanded in y around 0 86.6%
associate-/r*87.7%
Simplified87.7%
if -1.24999999999999993e48 < t < 9.49999999999999994e79Initial program 92.5%
*-commutative92.5%
associate-*l/92.5%
*-commutative92.5%
distribute-rgt-out--93.8%
associate-/l/93.8%
Simplified93.8%
Taylor expanded in y around inf 72.9%
associate-/r*72.9%
Simplified72.9%
if 9.49999999999999994e79 < t Initial program 82.7%
*-commutative82.7%
associate-*l/82.6%
*-commutative82.6%
distribute-rgt-out--91.9%
associate-/l/92.7%
Simplified92.7%
Taylor expanded in y around 0 86.7%
Final simplification78.3%
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 (<= y 1800.0) (* t_1 (/ x z_m)) (* x (/ t_1 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 = 2.0 / (y - t);
double tmp;
if (y <= 1800.0) {
tmp = t_1 * (x / z_m);
} else {
tmp = x * (t_1 / 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) :: tmp
t_1 = 2.0d0 / (y - t)
if (y <= 1800.0d0) then
tmp = t_1 * (x / z_m)
else
tmp = x * (t_1 / 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 = 2.0 / (y - t);
double tmp;
if (y <= 1800.0) {
tmp = t_1 * (x / z_m);
} else {
tmp = x * (t_1 / 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 = 2.0 / (y - t) tmp = 0 if y <= 1800.0: tmp = t_1 * (x / z_m) else: tmp = x * (t_1 / 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(2.0 / Float64(y - t)) tmp = 0.0 if (y <= 1800.0) tmp = Float64(t_1 * Float64(x / z_m)); else tmp = Float64(x * Float64(t_1 / 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 = 2.0 / (y - t); tmp = 0.0; if (y <= 1800.0) tmp = t_1 * (x / z_m); else tmp = x * (t_1 / 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[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[y, 1800.0], N[(t$95$1 * N[(x / z$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$1 / z$95$m), $MachinePrecision]), $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}\;y \leq 1800:\\
\;\;\;\;t_1 \cdot \frac{x}{z_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t_1}{z_m}\\
\end{array}
\end{array}
\end{array}
if y < 1800Initial program 88.2%
distribute-rgt-out--91.3%
times-frac95.7%
Simplified95.7%
if 1800 < y Initial program 89.9%
*-commutative89.9%
associate-*l/89.9%
*-commutative89.9%
distribute-rgt-out--98.1%
associate-/l/98.8%
Simplified98.8%
Final simplification96.5%
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 3.3e+121) (* -2.0 (/ x (* z_m t))) (* -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) {
double tmp;
if (x <= 3.3e+121) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = -2.0 * ((x / 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 <= 3.3d+121) then
tmp = (-2.0d0) * (x / (z_m * t))
else
tmp = (-2.0d0) * ((x / 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 <= 3.3e+121) {
tmp = -2.0 * (x / (z_m * t));
} else {
tmp = -2.0 * ((x / 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 <= 3.3e+121: tmp = -2.0 * (x / (z_m * t)) else: tmp = -2.0 * ((x / 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 (x <= 3.3e+121) tmp = Float64(-2.0 * Float64(x / Float64(z_m * t))); else tmp = Float64(-2.0 * Float64(Float64(x / 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 <= 3.3e+121) tmp = -2.0 * (x / (z_m * t)); else tmp = -2.0 * ((x / 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[x, 3.3e+121], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;x \leq 3.3 \cdot 10^{+121}:\\
\;\;\;\;-2 \cdot \frac{x}{z_m \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{t}}{z_m}\\
\end{array}
\end{array}
if x < 3.29999999999999979e121Initial program 88.4%
*-commutative88.4%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--93.2%
associate-/l/93.4%
Simplified93.4%
Taylor expanded in y around 0 53.7%
*-commutative53.7%
Simplified53.7%
if 3.29999999999999979e121 < x Initial program 90.8%
*-commutative90.8%
associate-*l/90.7%
*-commutative90.7%
distribute-rgt-out--90.7%
associate-/l/90.7%
Simplified90.7%
Taylor expanded in y around 0 41.9%
associate-/r*45.7%
Simplified45.7%
Final simplification52.9%
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 88.6%
*-commutative88.6%
associate-*l/88.6%
*-commutative88.6%
distribute-rgt-out--92.9%
associate-/l/93.1%
Simplified93.1%
Final simplification93.1%
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 88.6%
*-commutative88.6%
associate-*l/88.6%
*-commutative88.6%
distribute-rgt-out--92.9%
associate-/l/93.1%
Simplified93.1%
Taylor expanded in y around 0 52.5%
*-commutative52.5%
Simplified52.5%
Final simplification52.5%
(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 2024024
(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))))