
(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}
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= (* x_m 2.0) 1e-111)
(/ (/ x_m z) (* (- y t) 0.5))
(/ (* x_m (/ 2.0 (- y t))) z))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 1e-111) {
tmp = (x_m / z) / ((y - t) * 0.5);
} else {
tmp = (x_m * (2.0 / (y - t))) / z;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * 2.0d0) <= 1d-111) then
tmp = (x_m / z) / ((y - t) * 0.5d0)
else
tmp = (x_m * (2.0d0 / (y - t))) / z
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((x_m * 2.0) <= 1e-111) {
tmp = (x_m / z) / ((y - t) * 0.5);
} else {
tmp = (x_m * (2.0 / (y - t))) / z;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (x_m * 2.0) <= 1e-111: tmp = (x_m / z) / ((y - t) * 0.5) else: tmp = (x_m * (2.0 / (y - t))) / z return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (Float64(x_m * 2.0) <= 1e-111) tmp = Float64(Float64(x_m / z) / Float64(Float64(y - t) * 0.5)); else tmp = Float64(Float64(x_m * Float64(2.0 / Float64(y - t))) / z); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((x_m * 2.0) <= 1e-111) tmp = (x_m / z) / ((y - t) * 0.5); else tmp = (x_m * (2.0 / (y - t))) / z; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 1e-111], N[(N[(x$95$m / z), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;x_m \cdot 2 \leq 10^{-111}:\\
\;\;\;\;\frac{\frac{x_m}{z}}{\left(y - t\right) \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m \cdot \frac{2}{y - t}}{z}\\
\end{array}
\end{array}
if (*.f64 x 2) < 1.00000000000000009e-111Initial program 86.7%
*-commutative86.7%
associate-*l/86.5%
*-commutative86.5%
distribute-rgt-out--90.2%
associate-/l/91.7%
Simplified91.7%
associate-*r/93.0%
associate-*l/96.9%
clear-num96.9%
un-div-inv97.0%
div-inv97.0%
metadata-eval97.0%
Applied egg-rr97.0%
if 1.00000000000000009e-111 < (*.f64 x 2) Initial program 86.8%
*-commutative86.8%
associate-*l/86.8%
*-commutative86.8%
distribute-rgt-out--89.2%
associate-/l/91.3%
Simplified91.3%
associate-*r/97.5%
Applied egg-rr97.5%
Final simplification97.2%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -1.3e+20)
(and (not (<= y -1.3e-158))
(or (<= y -2.15e-170) (not (<= y 2.4e-8)))))
(* (/ x_m y) (/ 2.0 z))
(* -2.0 (/ (/ x_m t) z)))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+20) || (!(y <= -1.3e-158) && ((y <= -2.15e-170) || !(y <= 2.4e-8)))) {
tmp = (x_m / y) * (2.0 / z);
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.3d+20)) .or. (.not. (y <= (-1.3d-158))) .and. (y <= (-2.15d-170)) .or. (.not. (y <= 2.4d-8))) then
tmp = (x_m / y) * (2.0d0 / z)
else
tmp = (-2.0d0) * ((x_m / t) / z)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+20) || (!(y <= -1.3e-158) && ((y <= -2.15e-170) || !(y <= 2.4e-8)))) {
tmp = (x_m / y) * (2.0 / z);
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -1.3e+20) or (not (y <= -1.3e-158) and ((y <= -2.15e-170) or not (y <= 2.4e-8))): tmp = (x_m / y) * (2.0 / z) else: tmp = -2.0 * ((x_m / t) / z) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -1.3e+20) || (!(y <= -1.3e-158) && ((y <= -2.15e-170) || !(y <= 2.4e-8)))) tmp = Float64(Float64(x_m / y) * Float64(2.0 / z)); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((y <= -1.3e+20) || (~((y <= -1.3e-158)) && ((y <= -2.15e-170) || ~((y <= 2.4e-8))))) tmp = (x_m / y) * (2.0 / z); else tmp = -2.0 * ((x_m / t) / z); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -1.3e+20], And[N[Not[LessEqual[y, -1.3e-158]], $MachinePrecision], Or[LessEqual[y, -2.15e-170], N[Not[LessEqual[y, 2.4e-8]], $MachinePrecision]]]], N[(N[(x$95$m / y), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+20} \lor \neg \left(y \leq -1.3 \cdot 10^{-158}\right) \land \left(y \leq -2.15 \cdot 10^{-170} \lor \neg \left(y \leq 2.4 \cdot 10^{-8}\right)\right):\\
\;\;\;\;\frac{x_m}{y} \cdot \frac{2}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z}\\
\end{array}
\end{array}
if y < -1.3e20 or -1.3e-158 < y < -2.1499999999999999e-170 or 2.39999999999999998e-8 < y Initial program 85.1%
distribute-rgt-out--88.7%
Simplified88.7%
Taylor expanded in y around inf 80.6%
*-commutative80.6%
Simplified80.6%
*-commutative80.6%
times-frac87.8%
Applied egg-rr87.8%
if -1.3e20 < y < -1.3e-158 or -2.1499999999999999e-170 < y < 2.39999999999999998e-8Initial program 88.7%
*-commutative88.7%
associate-*l/88.6%
*-commutative88.6%
distribute-rgt-out--91.3%
associate-/l/91.9%
Simplified91.9%
Taylor expanded in y around 0 75.5%
associate-/r*80.0%
Simplified80.0%
Final simplification84.3%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* (/ x_m y) (/ 2.0 z))))
(*
x_s
(if (<= y -1.3e+20)
t_1
(if (<= y -7e-159)
(* (/ x_m z) (/ -2.0 t))
(if (or (<= y -2.15e-170) (not (<= y 2e-8)))
t_1
(* -2.0 (/ (/ x_m t) z))))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / y) * (2.0 / z);
double tmp;
if (y <= -1.3e+20) {
tmp = t_1;
} else if (y <= -7e-159) {
tmp = (x_m / z) * (-2.0 / t);
} else if ((y <= -2.15e-170) || !(y <= 2e-8)) {
tmp = t_1;
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x_m / y) * (2.0d0 / z)
if (y <= (-1.3d+20)) then
tmp = t_1
else if (y <= (-7d-159)) then
tmp = (x_m / z) * ((-2.0d0) / t)
else if ((y <= (-2.15d-170)) .or. (.not. (y <= 2d-8))) then
tmp = t_1
else
tmp = (-2.0d0) * ((x_m / t) / z)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / y) * (2.0 / z);
double tmp;
if (y <= -1.3e+20) {
tmp = t_1;
} else if (y <= -7e-159) {
tmp = (x_m / z) * (-2.0 / t);
} else if ((y <= -2.15e-170) || !(y <= 2e-8)) {
tmp = t_1;
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = (x_m / y) * (2.0 / z) tmp = 0 if y <= -1.3e+20: tmp = t_1 elif y <= -7e-159: tmp = (x_m / z) * (-2.0 / t) elif (y <= -2.15e-170) or not (y <= 2e-8): tmp = t_1 else: tmp = -2.0 * ((x_m / t) / z) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(x_m / y) * Float64(2.0 / z)) tmp = 0.0 if (y <= -1.3e+20) tmp = t_1; elseif (y <= -7e-159) tmp = Float64(Float64(x_m / z) * Float64(-2.0 / t)); elseif ((y <= -2.15e-170) || !(y <= 2e-8)) tmp = t_1; else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = (x_m / y) * (2.0 / z); tmp = 0.0; if (y <= -1.3e+20) tmp = t_1; elseif (y <= -7e-159) tmp = (x_m / z) * (-2.0 / t); elseif ((y <= -2.15e-170) || ~((y <= 2e-8))) tmp = t_1; else tmp = -2.0 * ((x_m / t) / z); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / y), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -1.3e+20], t$95$1, If[LessEqual[y, -7e-159], N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.15e-170], N[Not[LessEqual[y, 2e-8]], $MachinePrecision]], t$95$1, N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{x_m}{y} \cdot \frac{2}{z}\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-159}:\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{-2}{t}\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{-170} \lor \neg \left(y \leq 2 \cdot 10^{-8}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z}\\
\end{array}
\end{array}
\end{array}
if y < -1.3e20 or -7.00000000000000005e-159 < y < -2.1499999999999999e-170 or 2e-8 < y Initial program 85.1%
distribute-rgt-out--88.7%
Simplified88.7%
Taylor expanded in y around inf 80.6%
*-commutative80.6%
Simplified80.6%
*-commutative80.6%
times-frac87.8%
Applied egg-rr87.8%
if -1.3e20 < y < -7.00000000000000005e-159Initial program 85.9%
distribute-rgt-out--88.7%
times-frac99.7%
Simplified99.7%
Taylor expanded in y around 0 75.2%
if -2.1499999999999999e-170 < y < 2e-8Initial program 90.0%
*-commutative90.0%
associate-*l/89.8%
*-commutative89.8%
distribute-rgt-out--92.5%
associate-/l/93.4%
Simplified93.4%
Taylor expanded in y around 0 80.6%
associate-/r*83.9%
Simplified83.9%
Final simplification84.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -1e+35)
(/ 2.0 (* z (/ y x_m)))
(if (<= y -7e-159)
(* (/ x_m z) (/ -2.0 t))
(if (or (<= y -2.15e-170) (not (<= y 1.8e-8)))
(* (/ x_m y) (/ 2.0 z))
(* -2.0 (/ (/ x_m t) z)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -1e+35) {
tmp = 2.0 / (z * (y / x_m));
} else if (y <= -7e-159) {
tmp = (x_m / z) * (-2.0 / t);
} else if ((y <= -2.15e-170) || !(y <= 1.8e-8)) {
tmp = (x_m / y) * (2.0 / z);
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1d+35)) then
tmp = 2.0d0 / (z * (y / x_m))
else if (y <= (-7d-159)) then
tmp = (x_m / z) * ((-2.0d0) / t)
else if ((y <= (-2.15d-170)) .or. (.not. (y <= 1.8d-8))) then
tmp = (x_m / y) * (2.0d0 / z)
else
tmp = (-2.0d0) * ((x_m / t) / z)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -1e+35) {
tmp = 2.0 / (z * (y / x_m));
} else if (y <= -7e-159) {
tmp = (x_m / z) * (-2.0 / t);
} else if ((y <= -2.15e-170) || !(y <= 1.8e-8)) {
tmp = (x_m / y) * (2.0 / z);
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -1e+35: tmp = 2.0 / (z * (y / x_m)) elif y <= -7e-159: tmp = (x_m / z) * (-2.0 / t) elif (y <= -2.15e-170) or not (y <= 1.8e-8): tmp = (x_m / y) * (2.0 / z) else: tmp = -2.0 * ((x_m / t) / z) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -1e+35) tmp = Float64(2.0 / Float64(z * Float64(y / x_m))); elseif (y <= -7e-159) tmp = Float64(Float64(x_m / z) * Float64(-2.0 / t)); elseif ((y <= -2.15e-170) || !(y <= 1.8e-8)) tmp = Float64(Float64(x_m / y) * Float64(2.0 / z)); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -1e+35) tmp = 2.0 / (z * (y / x_m)); elseif (y <= -7e-159) tmp = (x_m / z) * (-2.0 / t); elseif ((y <= -2.15e-170) || ~((y <= 1.8e-8))) tmp = (x_m / y) * (2.0 / z); else tmp = -2.0 * ((x_m / t) / z); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -1e+35], N[(2.0 / N[(z * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7e-159], N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.15e-170], N[Not[LessEqual[y, 1.8e-8]], $MachinePrecision]], N[(N[(x$95$m / y), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+35}:\\
\;\;\;\;\frac{2}{z \cdot \frac{y}{x_m}}\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-159}:\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{-2}{t}\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{-170} \lor \neg \left(y \leq 1.8 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x_m}{y} \cdot \frac{2}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z}\\
\end{array}
\end{array}
if y < -9.9999999999999997e34Initial program 85.2%
distribute-rgt-out--90.3%
Simplified90.3%
Taylor expanded in y around inf 81.0%
*-commutative81.0%
Simplified81.0%
*-commutative81.0%
times-frac87.6%
Applied egg-rr87.6%
clear-num87.5%
frac-times88.3%
metadata-eval88.3%
Applied egg-rr88.3%
if -9.9999999999999997e34 < y < -7.00000000000000005e-159Initial program 85.9%
distribute-rgt-out--88.7%
times-frac99.7%
Simplified99.7%
Taylor expanded in y around 0 75.2%
if -7.00000000000000005e-159 < y < -2.1499999999999999e-170 or 1.79999999999999991e-8 < y Initial program 85.0%
distribute-rgt-out--87.5%
Simplified87.5%
Taylor expanded in y around inf 80.2%
*-commutative80.2%
Simplified80.2%
*-commutative80.2%
times-frac88.0%
Applied egg-rr88.0%
if -2.1499999999999999e-170 < y < 1.79999999999999991e-8Initial program 90.0%
*-commutative90.0%
associate-*l/89.8%
*-commutative89.8%
distribute-rgt-out--92.5%
associate-/l/93.4%
Simplified93.4%
Taylor expanded in y around 0 80.6%
associate-/r*83.9%
Simplified83.9%
Final simplification85.1%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -7.2e+23)
(/ 2.0 (* z (/ y x_m)))
(if (<= y -7.5e-159)
(* (/ x_m z) (/ -2.0 t))
(if (<= y -2.15e-170)
(* (/ x_m y) (/ 2.0 z))
(if (<= y 4.3e-7)
(* -2.0 (/ (/ x_m t) z))
(/ (/ x_m (/ y 2.0)) z)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -7.2e+23) {
tmp = 2.0 / (z * (y / x_m));
} else if (y <= -7.5e-159) {
tmp = (x_m / z) * (-2.0 / t);
} else if (y <= -2.15e-170) {
tmp = (x_m / y) * (2.0 / z);
} else if (y <= 4.3e-7) {
tmp = -2.0 * ((x_m / t) / z);
} else {
tmp = (x_m / (y / 2.0)) / z;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-7.2d+23)) then
tmp = 2.0d0 / (z * (y / x_m))
else if (y <= (-7.5d-159)) then
tmp = (x_m / z) * ((-2.0d0) / t)
else if (y <= (-2.15d-170)) then
tmp = (x_m / y) * (2.0d0 / z)
else if (y <= 4.3d-7) then
tmp = (-2.0d0) * ((x_m / t) / z)
else
tmp = (x_m / (y / 2.0d0)) / z
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -7.2e+23) {
tmp = 2.0 / (z * (y / x_m));
} else if (y <= -7.5e-159) {
tmp = (x_m / z) * (-2.0 / t);
} else if (y <= -2.15e-170) {
tmp = (x_m / y) * (2.0 / z);
} else if (y <= 4.3e-7) {
tmp = -2.0 * ((x_m / t) / z);
} else {
tmp = (x_m / (y / 2.0)) / z;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -7.2e+23: tmp = 2.0 / (z * (y / x_m)) elif y <= -7.5e-159: tmp = (x_m / z) * (-2.0 / t) elif y <= -2.15e-170: tmp = (x_m / y) * (2.0 / z) elif y <= 4.3e-7: tmp = -2.0 * ((x_m / t) / z) else: tmp = (x_m / (y / 2.0)) / z return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -7.2e+23) tmp = Float64(2.0 / Float64(z * Float64(y / x_m))); elseif (y <= -7.5e-159) tmp = Float64(Float64(x_m / z) * Float64(-2.0 / t)); elseif (y <= -2.15e-170) tmp = Float64(Float64(x_m / y) * Float64(2.0 / z)); elseif (y <= 4.3e-7) tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z)); else tmp = Float64(Float64(x_m / Float64(y / 2.0)) / z); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -7.2e+23) tmp = 2.0 / (z * (y / x_m)); elseif (y <= -7.5e-159) tmp = (x_m / z) * (-2.0 / t); elseif (y <= -2.15e-170) tmp = (x_m / y) * (2.0 / z); elseif (y <= 4.3e-7) tmp = -2.0 * ((x_m / t) / z); else tmp = (x_m / (y / 2.0)) / z; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -7.2e+23], N[(2.0 / N[(z * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.5e-159], N[(N[(x$95$m / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.15e-170], N[(N[(x$95$m / y), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.3e-7], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y / 2.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{2}{z \cdot \frac{y}{x_m}}\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-159}:\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{-2}{t}\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{-170}:\\
\;\;\;\;\frac{x_m}{y} \cdot \frac{2}{z}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-7}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x_m}{\frac{y}{2}}}{z}\\
\end{array}
\end{array}
if y < -7.1999999999999997e23Initial program 85.2%
distribute-rgt-out--90.3%
Simplified90.3%
Taylor expanded in y around inf 81.0%
*-commutative81.0%
Simplified81.0%
*-commutative81.0%
times-frac87.6%
Applied egg-rr87.6%
clear-num87.5%
frac-times88.3%
metadata-eval88.3%
Applied egg-rr88.3%
if -7.1999999999999997e23 < y < -7.5e-159Initial program 85.9%
distribute-rgt-out--88.7%
times-frac99.7%
Simplified99.7%
Taylor expanded in y around 0 75.2%
if -7.5e-159 < y < -2.1499999999999999e-170Initial program 81.0%
distribute-rgt-out--81.0%
Simplified81.0%
Taylor expanded in y around inf 79.5%
*-commutative79.5%
Simplified79.5%
*-commutative79.5%
times-frac98.2%
Applied egg-rr98.2%
if -2.1499999999999999e-170 < y < 4.3000000000000001e-7Initial program 90.0%
*-commutative90.0%
associate-*l/89.8%
*-commutative89.8%
distribute-rgt-out--92.5%
associate-/l/93.4%
Simplified93.4%
Taylor expanded in y around 0 80.6%
associate-/r*83.9%
Simplified83.9%
if 4.3000000000000001e-7 < y Initial program 85.3%
*-commutative85.3%
associate-*l/85.2%
*-commutative85.2%
distribute-rgt-out--87.9%
associate-/l/91.1%
Simplified91.1%
associate-*r/93.7%
Applied egg-rr93.7%
Taylor expanded in y around inf 87.5%
*-commutative87.5%
associate-/r/87.5%
Simplified87.5%
Final simplification85.1%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -1.3e+20) (not (<= y 8.5e-8)))
(* x_m (/ (/ 2.0 y) z))
(* -2.0 (/ (/ x_m t) z)))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+20) || !(y <= 8.5e-8)) {
tmp = x_m * ((2.0 / y) / z);
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.3d+20)) .or. (.not. (y <= 8.5d-8))) then
tmp = x_m * ((2.0d0 / y) / z)
else
tmp = (-2.0d0) * ((x_m / t) / z)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+20) || !(y <= 8.5e-8)) {
tmp = x_m * ((2.0 / y) / z);
} else {
tmp = -2.0 * ((x_m / t) / z);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -1.3e+20) or not (y <= 8.5e-8): tmp = x_m * ((2.0 / y) / z) else: tmp = -2.0 * ((x_m / t) / z) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -1.3e+20) || !(y <= 8.5e-8)) tmp = Float64(x_m * Float64(Float64(2.0 / y) / z)); else tmp = Float64(-2.0 * Float64(Float64(x_m / t) / z)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((y <= -1.3e+20) || ~((y <= 8.5e-8))) tmp = x_m * ((2.0 / y) / z); else tmp = -2.0 * ((x_m / t) / z); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -1.3e+20], N[Not[LessEqual[y, 8.5e-8]], $MachinePrecision]], N[(x$95$m * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+20} \lor \neg \left(y \leq 8.5 \cdot 10^{-8}\right):\\
\;\;\;\;x_m \cdot \frac{\frac{2}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x_m}{t}}{z}\\
\end{array}
\end{array}
if y < -1.3e20 or 8.49999999999999935e-8 < y Initial program 85.3%
*-commutative85.3%
associate-*l/85.2%
*-commutative85.2%
distribute-rgt-out--88.9%
associate-/l/91.7%
Simplified91.7%
Taylor expanded in y around inf 80.5%
associate-/r*83.3%
Simplified83.3%
if -1.3e20 < y < 8.49999999999999935e-8Initial program 88.4%
*-commutative88.4%
associate-*l/88.3%
*-commutative88.3%
distribute-rgt-out--90.9%
associate-/l/91.5%
Simplified91.5%
Taylor expanded in y around 0 72.4%
associate-/r*76.7%
Simplified76.7%
Final simplification80.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (let* ((t_1 (/ 2.0 (- y t)))) (* x_s (if (<= (* x_m 2.0) 1e-111) (* (/ x_m z) t_1) (/ (* x_m t_1) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 2.0 / (y - t);
double tmp;
if ((x_m * 2.0) <= 1e-111) {
tmp = (x_m / z) * t_1;
} else {
tmp = (x_m * t_1) / z;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 / (y - t)
if ((x_m * 2.0d0) <= 1d-111) then
tmp = (x_m / z) * t_1
else
tmp = (x_m * t_1) / z
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 2.0 / (y - t);
double tmp;
if ((x_m * 2.0) <= 1e-111) {
tmp = (x_m / z) * t_1;
} else {
tmp = (x_m * t_1) / z;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = 2.0 / (y - t) tmp = 0 if (x_m * 2.0) <= 1e-111: tmp = (x_m / z) * t_1 else: tmp = (x_m * t_1) / z return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(2.0 / Float64(y - t)) tmp = 0.0 if (Float64(x_m * 2.0) <= 1e-111) tmp = Float64(Float64(x_m / z) * t_1); else tmp = Float64(Float64(x_m * t_1) / z); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = 2.0 / (y - t); tmp = 0.0; if ((x_m * 2.0) <= 1e-111) tmp = (x_m / z) * t_1; else tmp = (x_m * t_1) / z; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 1e-111], N[(N[(x$95$m / z), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(x$95$m * t$95$1), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{2}{y - t}\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;x_m \cdot 2 \leq 10^{-111}:\\
\;\;\;\;\frac{x_m}{z} \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m \cdot t_1}{z}\\
\end{array}
\end{array}
\end{array}
if (*.f64 x 2) < 1.00000000000000009e-111Initial program 86.7%
distribute-rgt-out--90.3%
times-frac96.9%
Simplified96.9%
if 1.00000000000000009e-111 < (*.f64 x 2) Initial program 86.8%
*-commutative86.8%
associate-*l/86.8%
*-commutative86.8%
distribute-rgt-out--89.2%
associate-/l/91.3%
Simplified91.3%
associate-*r/97.5%
Applied egg-rr97.5%
Final simplification97.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (let* ((t_1 (/ 2.0 (- y t)))) (* x_s (if (<= z 3e-48) (* x_m (/ t_1 z)) (* (/ x_m z) t_1)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 2.0 / (y - t);
double tmp;
if (z <= 3e-48) {
tmp = x_m * (t_1 / z);
} else {
tmp = (x_m / z) * t_1;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 / (y - t)
if (z <= 3d-48) then
tmp = x_m * (t_1 / z)
else
tmp = (x_m / z) * t_1
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 2.0 / (y - t);
double tmp;
if (z <= 3e-48) {
tmp = x_m * (t_1 / z);
} else {
tmp = (x_m / z) * t_1;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = 2.0 / (y - t) tmp = 0 if z <= 3e-48: tmp = x_m * (t_1 / z) else: tmp = (x_m / z) * t_1 return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(2.0 / Float64(y - t)) tmp = 0.0 if (z <= 3e-48) tmp = Float64(x_m * Float64(t_1 / z)); else tmp = Float64(Float64(x_m / z) * t_1); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = 2.0 / (y - t); tmp = 0.0; if (z <= 3e-48) tmp = x_m * (t_1 / z); else tmp = (x_m / z) * t_1; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, 3e-48], N[(x$95$m * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * t$95$1), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{2}{y - t}\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{-48}:\\
\;\;\;\;x_m \cdot \frac{t_1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z} \cdot t_1\\
\end{array}
\end{array}
\end{array}
if z < 2.9999999999999999e-48Initial program 87.3%
*-commutative87.3%
associate-*l/87.1%
*-commutative87.1%
distribute-rgt-out--90.8%
associate-/l/92.6%
Simplified92.6%
if 2.9999999999999999e-48 < z Initial program 85.6%
distribute-rgt-out--88.1%
times-frac99.7%
Simplified99.7%
Final simplification95.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z 1e+31)
(/ (* x_m 2.0) (* z (- y t)))
(* (/ x_m z) (/ 2.0 (- y t))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1e+31) {
tmp = (x_m * 2.0) / (z * (y - t));
} else {
tmp = (x_m / z) * (2.0 / (y - t));
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1d+31) then
tmp = (x_m * 2.0d0) / (z * (y - t))
else
tmp = (x_m / z) * (2.0d0 / (y - t))
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= 1e+31) {
tmp = (x_m * 2.0) / (z * (y - t));
} else {
tmp = (x_m / z) * (2.0 / (y - t));
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= 1e+31: tmp = (x_m * 2.0) / (z * (y - t)) else: tmp = (x_m / z) * (2.0 / (y - t)) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= 1e+31) tmp = Float64(Float64(x_m * 2.0) / Float64(z * Float64(y - t))); else tmp = Float64(Float64(x_m / z) * Float64(2.0 / Float64(y - t))); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= 1e+31) tmp = (x_m * 2.0) / (z * (y - t)); else tmp = (x_m / z) * (2.0 / (y - t)); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, 1e+31], N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 10^{+31}:\\
\;\;\;\;\frac{x_m \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{2}{y - t}\\
\end{array}
\end{array}
if z < 9.9999999999999996e30Initial program 88.4%
distribute-rgt-out--91.7%
Simplified91.7%
if 9.9999999999999996e30 < z Initial program 82.2%
distribute-rgt-out--85.3%
times-frac99.8%
Simplified99.8%
Final simplification93.9%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ (/ 2.0 (- y t)) z))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((2.0 / (y - t)) / z));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m * ((2.0d0 / (y - t)) / z))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((2.0 / (y - t)) / z));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * ((2.0 / (y - t)) / z))
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(Float64(2.0 / Float64(y - t)) / z))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * ((2.0 / (y - t)) / z)); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \left(x_m \cdot \frac{\frac{2}{y - t}}{z}\right)
\end{array}
Initial program 86.7%
*-commutative86.7%
associate-*l/86.6%
*-commutative86.6%
distribute-rgt-out--89.8%
associate-/l/91.6%
Simplified91.6%
Final simplification91.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -2.0 (/ x_m (* z t)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * ((-2.0d0) * (x_m / (z * t)))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * (x_m / (z * t)));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (-2.0 * (x_m / (z * t)))
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(-2.0 * Float64(x_m / Float64(z * t)))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (-2.0 * (x_m / (z * t))); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \left(-2 \cdot \frac{x_m}{z \cdot t}\right)
\end{array}
Initial program 86.7%
*-commutative86.7%
associate-*l/86.6%
*-commutative86.6%
distribute-rgt-out--89.8%
associate-/l/91.6%
Simplified91.6%
Taylor expanded in y around 0 47.4%
Final simplification47.4%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -2.0 (/ (/ x_m t) z))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * ((x_m / t) / z));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * ((-2.0d0) * ((x_m / t) / z))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (-2.0 * ((x_m / t) / z));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (-2.0 * ((x_m / t) / z))
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(-2.0 * Float64(Float64(x_m / t) / z))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (-2.0 * ((x_m / t) / z)); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(-2.0 * N[(N[(x$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \left(-2 \cdot \frac{\frac{x_m}{t}}{z}\right)
\end{array}
Initial program 86.7%
*-commutative86.7%
associate-*l/86.6%
*-commutative86.6%
distribute-rgt-out--89.8%
associate-/l/91.6%
Simplified91.6%
Taylor expanded in y around 0 47.4%
associate-/r*48.8%
Simplified48.8%
Final simplification48.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x (* (- y t) z)) 2.0))
(t_2 (/ (* x 2.0) (- (* y z) (* t z)))))
(if (< t_2 -2.559141628295061e-13)
t_1
(if (< t_2 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / ((y - t) * z)) * 2.0d0
t_2 = (x * 2.0d0) / ((y * z) - (t * z))
if (t_2 < (-2.559141628295061d-13)) then
tmp = t_1
else if (t_2 < 1.045027827330126d-269) then
tmp = ((x / z) * 2.0d0) / (y - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / ((y - t) * z)) * 2.0;
double t_2 = (x * 2.0) / ((y * z) - (t * z));
double tmp;
if (t_2 < -2.559141628295061e-13) {
tmp = t_1;
} else if (t_2 < 1.045027827330126e-269) {
tmp = ((x / z) * 2.0) / (y - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / ((y - t) * z)) * 2.0 t_2 = (x * 2.0) / ((y * z) - (t * z)) tmp = 0 if t_2 < -2.559141628295061e-13: tmp = t_1 elif t_2 < 1.045027827330126e-269: tmp = ((x / z) * 2.0) / (y - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(Float64(y - t) * z)) * 2.0) t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) tmp = 0.0 if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = Float64(Float64(Float64(x / z) * 2.0) / Float64(y - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / ((y - t) * z)) * 2.0; t_2 = (x * 2.0) / ((y * z) - (t * z)); tmp = 0.0; if (t_2 < -2.559141628295061e-13) tmp = t_1; elseif (t_2 < 1.045027827330126e-269) tmp = ((x / z) * 2.0) / (y - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -2.559141628295061e-13], t$95$1, If[Less[t$95$2, 1.045027827330126e-269], N[(N[(N[(x / z), $MachinePrecision] * 2.0), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\
t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{if}\;t_2 < -2.559141628295061 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.045027827330126 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2024021
(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))))