
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
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 * y) - (z * y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
def code(x, y, z, t): return ((x * y) - (z * y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x * y) - (z * y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y - z \cdot y\right) \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
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 * y) - (z * y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
def code(x, y, z, t): return ((x * y) - (z * y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x * y) - (z * y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y - z \cdot y\right) \cdot t
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
:precision binary64
(let* ((t_2 (- (* x y_m) (* y_m z))))
(*
t_s
(*
y_s
(if (<= t_2 -2e-219)
(* t_2 t_m)
(if (<= t_2 1e-204)
(* y_m (- (* x t_m) (* z t_m)))
(* t_m (* y_m (- x z)))))))))y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double t_2 = (x * y_m) - (y_m * z);
double tmp;
if (t_2 <= -2e-219) {
tmp = t_2 * t_m;
} else if (t_2 <= 1e-204) {
tmp = y_m * ((x * t_m) - (z * t_m));
} else {
tmp = t_m * (y_m * (x - z));
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_2
real(8) :: tmp
t_2 = (x * y_m) - (y_m * z)
if (t_2 <= (-2d-219)) then
tmp = t_2 * t_m
else if (t_2 <= 1d-204) then
tmp = y_m * ((x * t_m) - (z * t_m))
else
tmp = t_m * (y_m * (x - z))
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double t_2 = (x * y_m) - (y_m * z);
double tmp;
if (t_2 <= -2e-219) {
tmp = t_2 * t_m;
} else if (t_2 <= 1e-204) {
tmp = y_m * ((x * t_m) - (z * t_m));
} else {
tmp = t_m * (y_m * (x - z));
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): t_2 = (x * y_m) - (y_m * z) tmp = 0 if t_2 <= -2e-219: tmp = t_2 * t_m elif t_2 <= 1e-204: tmp = y_m * ((x * t_m) - (z * t_m)) else: tmp = t_m * (y_m * (x - z)) return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) t_2 = Float64(Float64(x * y_m) - Float64(y_m * z)) tmp = 0.0 if (t_2 <= -2e-219) tmp = Float64(t_2 * t_m); elseif (t_2 <= 1e-204) tmp = Float64(y_m * Float64(Float64(x * t_m) - Float64(z * t_m))); else tmp = Float64(t_m * Float64(y_m * Float64(x - z))); end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
t_2 = (x * y_m) - (y_m * z);
tmp = 0.0;
if (t_2 <= -2e-219)
tmp = t_2 * t_m;
elseif (t_2 <= 1e-204)
tmp = y_m * ((x * t_m) - (z * t_m));
else
tmp = t_m * (y_m * (x - z));
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := Block[{t$95$2 = N[(N[(x * y$95$m), $MachinePrecision] - N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[t$95$2, -2e-219], N[(t$95$2 * t$95$m), $MachinePrecision], If[LessEqual[t$95$2, 1e-204], N[(y$95$m * N[(N[(x * t$95$m), $MachinePrecision] - N[(z * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$m * N[(y$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
\begin{array}{l}
t_2 := x \cdot y_m - y_m \cdot z\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-219}:\\
\;\;\;\;t_2 \cdot t_m\\
\mathbf{elif}\;t_2 \leq 10^{-204}:\\
\;\;\;\;y_m \cdot \left(x \cdot t_m - z \cdot t_m\right)\\
\mathbf{else}:\\
\;\;\;\;t_m \cdot \left(y_m \cdot \left(x - z\right)\right)\\
\end{array}\right)
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z y)) < -2.0000000000000001e-219Initial program 89.1%
if -2.0000000000000001e-219 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1e-204Initial program 73.1%
distribute-rgt-out--73.1%
associate-*l*95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in x around 0 95.2%
+-commutative95.2%
mul-1-neg95.2%
unsub-neg95.2%
Simplified95.2%
if 1e-204 < (-.f64 (*.f64 x y) (*.f64 z y)) Initial program 87.1%
distribute-rgt-out--92.0%
Simplified92.0%
Final simplification91.0%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
:precision binary64
(let* ((t_2 (* t_m (* x y_m))) (t_3 (* (* y_m z) (- t_m))))
(*
t_s
(*
y_s
(if (<= x -1.75e+124)
t_2
(if (<= x -4.5e+44)
(* (* y_m t_m) (- z))
(if (<= x -10500000000.0)
t_2
(if (<= x -1.66e-243)
t_3
(if (<= x 4.5e-240)
(* y_m (* t_m (- z)))
(if (<= x 1.45e-26) t_3 t_2))))))))))y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double t_2 = t_m * (x * y_m);
double t_3 = (y_m * z) * -t_m;
double tmp;
if (x <= -1.75e+124) {
tmp = t_2;
} else if (x <= -4.5e+44) {
tmp = (y_m * t_m) * -z;
} else if (x <= -10500000000.0) {
tmp = t_2;
} else if (x <= -1.66e-243) {
tmp = t_3;
} else if (x <= 4.5e-240) {
tmp = y_m * (t_m * -z);
} else if (x <= 1.45e-26) {
tmp = t_3;
} else {
tmp = t_2;
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_2 = t_m * (x * y_m)
t_3 = (y_m * z) * -t_m
if (x <= (-1.75d+124)) then
tmp = t_2
else if (x <= (-4.5d+44)) then
tmp = (y_m * t_m) * -z
else if (x <= (-10500000000.0d0)) then
tmp = t_2
else if (x <= (-1.66d-243)) then
tmp = t_3
else if (x <= 4.5d-240) then
tmp = y_m * (t_m * -z)
else if (x <= 1.45d-26) then
tmp = t_3
else
tmp = t_2
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double t_2 = t_m * (x * y_m);
double t_3 = (y_m * z) * -t_m;
double tmp;
if (x <= -1.75e+124) {
tmp = t_2;
} else if (x <= -4.5e+44) {
tmp = (y_m * t_m) * -z;
} else if (x <= -10500000000.0) {
tmp = t_2;
} else if (x <= -1.66e-243) {
tmp = t_3;
} else if (x <= 4.5e-240) {
tmp = y_m * (t_m * -z);
} else if (x <= 1.45e-26) {
tmp = t_3;
} else {
tmp = t_2;
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): t_2 = t_m * (x * y_m) t_3 = (y_m * z) * -t_m tmp = 0 if x <= -1.75e+124: tmp = t_2 elif x <= -4.5e+44: tmp = (y_m * t_m) * -z elif x <= -10500000000.0: tmp = t_2 elif x <= -1.66e-243: tmp = t_3 elif x <= 4.5e-240: tmp = y_m * (t_m * -z) elif x <= 1.45e-26: tmp = t_3 else: tmp = t_2 return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) t_2 = Float64(t_m * Float64(x * y_m)) t_3 = Float64(Float64(y_m * z) * Float64(-t_m)) tmp = 0.0 if (x <= -1.75e+124) tmp = t_2; elseif (x <= -4.5e+44) tmp = Float64(Float64(y_m * t_m) * Float64(-z)); elseif (x <= -10500000000.0) tmp = t_2; elseif (x <= -1.66e-243) tmp = t_3; elseif (x <= 4.5e-240) tmp = Float64(y_m * Float64(t_m * Float64(-z))); elseif (x <= 1.45e-26) tmp = t_3; else tmp = t_2; end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
t_2 = t_m * (x * y_m);
t_3 = (y_m * z) * -t_m;
tmp = 0.0;
if (x <= -1.75e+124)
tmp = t_2;
elseif (x <= -4.5e+44)
tmp = (y_m * t_m) * -z;
elseif (x <= -10500000000.0)
tmp = t_2;
elseif (x <= -1.66e-243)
tmp = t_3;
elseif (x <= 4.5e-240)
tmp = y_m * (t_m * -z);
elseif (x <= 1.45e-26)
tmp = t_3;
else
tmp = t_2;
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := Block[{t$95$2 = N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y$95$m * z), $MachinePrecision] * (-t$95$m)), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[x, -1.75e+124], t$95$2, If[LessEqual[x, -4.5e+44], N[(N[(y$95$m * t$95$m), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[x, -10500000000.0], t$95$2, If[LessEqual[x, -1.66e-243], t$95$3, If[LessEqual[x, 4.5e-240], N[(y$95$m * N[(t$95$m * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e-26], t$95$3, t$95$2]]]]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
\begin{array}{l}
t_2 := t_m \cdot \left(x \cdot y_m\right)\\
t_3 := \left(y_m \cdot z\right) \cdot \left(-t_m\right)\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{+44}:\\
\;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\
\mathbf{elif}\;x \leq -10500000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.66 \cdot 10^{-243}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-240}:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(-z\right)\right)\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-26}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}\right)
\end{array}
\end{array}
if x < -1.7500000000000001e124 or -4.5e44 < x < -1.05e10 or 1.4499999999999999e-26 < x Initial program 86.6%
distribute-rgt-out--89.9%
Simplified89.9%
Taylor expanded in x around inf 79.4%
*-commutative79.4%
Simplified79.4%
if -1.7500000000000001e124 < x < -4.5e44Initial program 76.1%
distribute-rgt-out--84.4%
associate-*l*75.8%
*-commutative75.8%
Simplified75.8%
Taylor expanded in x around 0 60.3%
mul-1-neg60.3%
distribute-rgt-neg-in60.3%
distribute-rgt-neg-out60.3%
associate-*r*75.6%
Simplified75.6%
if -1.05e10 < x < -1.66000000000000005e-243 or 4.5000000000000001e-240 < x < 1.4499999999999999e-26Initial program 89.3%
distribute-rgt-out--90.4%
Simplified90.4%
Taylor expanded in x around 0 71.3%
mul-1-neg71.3%
distribute-rgt-neg-out71.3%
Simplified71.3%
if -1.66000000000000005e-243 < x < 4.5000000000000001e-240Initial program 85.1%
distribute-rgt-out--85.1%
associate-*l*90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in x around 0 78.8%
mul-1-neg78.8%
*-commutative78.8%
distribute-rgt-neg-in78.8%
Simplified78.8%
Final simplification76.3%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
:precision binary64
(*
t_s
(*
y_s
(if (or (<= x -1.15e+124)
(not
(or (<= x -5.5e+44)
(and (not (<= x -4000000000.0)) (<= x 2.5e-26)))))
(* t_m (* x y_m))
(* (* y_m t_m) (- z))))))y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if ((x <= -1.15e+124) || !((x <= -5.5e+44) || (!(x <= -4000000000.0) && (x <= 2.5e-26)))) {
tmp = t_m * (x * y_m);
} else {
tmp = (y_m * t_m) * -z;
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((x <= (-1.15d+124)) .or. (.not. (x <= (-5.5d+44)) .or. (.not. (x <= (-4000000000.0d0))) .and. (x <= 2.5d-26))) then
tmp = t_m * (x * y_m)
else
tmp = (y_m * t_m) * -z
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if ((x <= -1.15e+124) || !((x <= -5.5e+44) || (!(x <= -4000000000.0) && (x <= 2.5e-26)))) {
tmp = t_m * (x * y_m);
} else {
tmp = (y_m * t_m) * -z;
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): tmp = 0 if (x <= -1.15e+124) or not ((x <= -5.5e+44) or (not (x <= -4000000000.0) and (x <= 2.5e-26))): tmp = t_m * (x * y_m) else: tmp = (y_m * t_m) * -z return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) tmp = 0.0 if ((x <= -1.15e+124) || !((x <= -5.5e+44) || (!(x <= -4000000000.0) && (x <= 2.5e-26)))) tmp = Float64(t_m * Float64(x * y_m)); else tmp = Float64(Float64(y_m * t_m) * Float64(-z)); end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
tmp = 0.0;
if ((x <= -1.15e+124) || ~(((x <= -5.5e+44) || (~((x <= -4000000000.0)) && (x <= 2.5e-26)))))
tmp = t_m * (x * y_m);
else
tmp = (y_m * t_m) * -z;
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[Or[LessEqual[x, -1.15e+124], N[Not[Or[LessEqual[x, -5.5e+44], And[N[Not[LessEqual[x, -4000000000.0]], $MachinePrecision], LessEqual[x, 2.5e-26]]]], $MachinePrecision]], N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * t$95$m), $MachinePrecision] * (-z)), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+124} \lor \neg \left(x \leq -5.5 \cdot 10^{+44} \lor \neg \left(x \leq -4000000000\right) \land x \leq 2.5 \cdot 10^{-26}\right):\\
\;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\
\end{array}\right)
\end{array}
if x < -1.14999999999999992e124 or -5.5000000000000001e44 < x < -4e9 or 2.5000000000000001e-26 < x Initial program 86.6%
distribute-rgt-out--89.9%
Simplified89.9%
Taylor expanded in x around inf 79.4%
*-commutative79.4%
Simplified79.4%
if -1.14999999999999992e124 < x < -5.5000000000000001e44 or -4e9 < x < 2.5000000000000001e-26Initial program 87.1%
distribute-rgt-out--88.6%
associate-*l*91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in x around 0 71.2%
mul-1-neg71.2%
distribute-rgt-neg-in71.2%
distribute-rgt-neg-out71.2%
associate-*r*77.1%
Simplified77.1%
Final simplification78.2%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
:precision binary64
(*
t_s
(*
y_s
(if (or (<= x -1.95e+175) (not (<= x 1.35e+82)))
(* t_m (* x y_m))
(* y_m (* t_m (- x z)))))))y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if ((x <= -1.95e+175) || !(x <= 1.35e+82)) {
tmp = t_m * (x * y_m);
} else {
tmp = y_m * (t_m * (x - z));
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((x <= (-1.95d+175)) .or. (.not. (x <= 1.35d+82))) then
tmp = t_m * (x * y_m)
else
tmp = y_m * (t_m * (x - z))
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if ((x <= -1.95e+175) || !(x <= 1.35e+82)) {
tmp = t_m * (x * y_m);
} else {
tmp = y_m * (t_m * (x - z));
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): tmp = 0 if (x <= -1.95e+175) or not (x <= 1.35e+82): tmp = t_m * (x * y_m) else: tmp = y_m * (t_m * (x - z)) return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) tmp = 0.0 if ((x <= -1.95e+175) || !(x <= 1.35e+82)) tmp = Float64(t_m * Float64(x * y_m)); else tmp = Float64(y_m * Float64(t_m * Float64(x - z))); end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
tmp = 0.0;
if ((x <= -1.95e+175) || ~((x <= 1.35e+82)))
tmp = t_m * (x * y_m);
else
tmp = y_m * (t_m * (x - z));
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[Or[LessEqual[x, -1.95e+175], N[Not[LessEqual[x, 1.35e+82]], $MachinePrecision]], N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(t$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+175} \lor \neg \left(x \leq 1.35 \cdot 10^{+82}\right):\\
\;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(x - z\right)\right)\\
\end{array}\right)
\end{array}
if x < -1.94999999999999986e175 or 1.35e82 < x Initial program 82.3%
distribute-rgt-out--87.0%
Simplified87.0%
Taylor expanded in x around inf 80.4%
*-commutative80.4%
Simplified80.4%
if -1.94999999999999986e175 < x < 1.35e82Initial program 89.2%
distribute-rgt-out--90.4%
associate-*l*93.1%
*-commutative93.1%
Simplified93.1%
Final simplification88.8%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
:precision binary64
(*
t_s
(*
y_s
(if (or (<= x -30000000000.0) (not (<= x 4.6e-27)))
(* t_m (* x y_m))
(* y_m (* t_m (- z)))))))y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if ((x <= -30000000000.0) || !(x <= 4.6e-27)) {
tmp = t_m * (x * y_m);
} else {
tmp = y_m * (t_m * -z);
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((x <= (-30000000000.0d0)) .or. (.not. (x <= 4.6d-27))) then
tmp = t_m * (x * y_m)
else
tmp = y_m * (t_m * -z)
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if ((x <= -30000000000.0) || !(x <= 4.6e-27)) {
tmp = t_m * (x * y_m);
} else {
tmp = y_m * (t_m * -z);
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): tmp = 0 if (x <= -30000000000.0) or not (x <= 4.6e-27): tmp = t_m * (x * y_m) else: tmp = y_m * (t_m * -z) return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) tmp = 0.0 if ((x <= -30000000000.0) || !(x <= 4.6e-27)) tmp = Float64(t_m * Float64(x * y_m)); else tmp = Float64(y_m * Float64(t_m * Float64(-z))); end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
tmp = 0.0;
if ((x <= -30000000000.0) || ~((x <= 4.6e-27)))
tmp = t_m * (x * y_m);
else
tmp = y_m * (t_m * -z);
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[Or[LessEqual[x, -30000000000.0], N[Not[LessEqual[x, 4.6e-27]], $MachinePrecision]], N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(t$95$m * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -30000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-27}\right):\\
\;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(-z\right)\right)\\
\end{array}\right)
\end{array}
if x < -3e10 or 4.5999999999999999e-27 < x Initial program 85.7%
distribute-rgt-out--89.4%
Simplified89.4%
Taylor expanded in x around inf 75.5%
*-commutative75.5%
Simplified75.5%
if -3e10 < x < 4.5999999999999999e-27Initial program 88.2%
distribute-rgt-out--89.0%
associate-*l*92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in x around 0 75.6%
mul-1-neg75.6%
*-commutative75.6%
distribute-rgt-neg-in75.6%
Simplified75.6%
Final simplification75.6%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
:precision binary64
(*
t_s
(*
y_s
(if (<= t_m 2000000000.0)
(* y_m (* t_m (- x z)))
(* (- x z) (* y_m t_m))))))y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if (t_m <= 2000000000.0) {
tmp = y_m * (t_m * (x - z));
} else {
tmp = (x - z) * (y_m * t_m);
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if (t_m <= 2000000000.0d0) then
tmp = y_m * (t_m * (x - z))
else
tmp = (x - z) * (y_m * t_m)
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if (t_m <= 2000000000.0) {
tmp = y_m * (t_m * (x - z));
} else {
tmp = (x - z) * (y_m * t_m);
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): tmp = 0 if t_m <= 2000000000.0: tmp = y_m * (t_m * (x - z)) else: tmp = (x - z) * (y_m * t_m) return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) tmp = 0.0 if (t_m <= 2000000000.0) tmp = Float64(y_m * Float64(t_m * Float64(x - z))); else tmp = Float64(Float64(x - z) * Float64(y_m * t_m)); end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
tmp = 0.0;
if (t_m <= 2000000000.0)
tmp = y_m * (t_m * (x - z));
else
tmp = (x - z) * (y_m * t_m);
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[LessEqual[t$95$m, 2000000000.0], N[(y$95$m * N[(t$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 2000000000:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y_m \cdot t_m\right)\\
\end{array}\right)
\end{array}
if t < 2e9Initial program 85.9%
distribute-rgt-out--87.4%
associate-*l*92.9%
*-commutative92.9%
Simplified92.9%
if 2e9 < t Initial program 89.9%
*-commutative89.9%
distribute-rgt-out--94.5%
associate-*r*96.8%
*-commutative96.8%
Simplified96.8%
Final simplification93.9%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s y_s x y_m z t_m) :precision binary64 (* t_s (* y_s (if (<= t_m 0.01) (* y_m (* x t_m)) (* x (* y_m t_m))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if (t_m <= 0.01) {
tmp = y_m * (x * t_m);
} else {
tmp = x * (y_m * t_m);
}
return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if (t_m <= 0.01d0) then
tmp = y_m * (x * t_m)
else
tmp = x * (y_m * t_m)
end if
code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
double tmp;
if (t_m <= 0.01) {
tmp = y_m * (x * t_m);
} else {
tmp = x * (y_m * t_m);
}
return t_s * (y_s * tmp);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): tmp = 0 if t_m <= 0.01: tmp = y_m * (x * t_m) else: tmp = x * (y_m * t_m) return t_s * (y_s * tmp)
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) tmp = 0.0 if (t_m <= 0.01) tmp = Float64(y_m * Float64(x * t_m)); else tmp = Float64(x * Float64(y_m * t_m)); end return Float64(t_s * Float64(y_s * tmp)) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
tmp = 0.0;
if (t_m <= 0.01)
tmp = y_m * (x * t_m);
else
tmp = x * (y_m * t_m);
end
tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[LessEqual[t$95$m, 0.01], N[(y$95$m * N[(x * t$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 0.01:\\
\;\;\;\;y_m \cdot \left(x \cdot t_m\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y_m \cdot t_m\right)\\
\end{array}\right)
\end{array}
if t < 0.0100000000000000002Initial program 85.9%
distribute-rgt-out--87.4%
associate-*l*92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in x around inf 54.9%
if 0.0100000000000000002 < t Initial program 89.9%
distribute-rgt-out--94.5%
Simplified94.5%
flip--68.0%
associate-*r/66.9%
associate-/l*67.9%
*-un-lft-identity67.9%
associate-/l*67.9%
flip--94.3%
Applied egg-rr94.3%
Taylor expanded in x around inf 53.5%
*-commutative53.5%
associate-*r*56.4%
*-commutative56.4%
Simplified56.4%
Final simplification55.3%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s y_s x y_m z t_m) :precision binary64 (* t_s (* y_s (* t_m (* y_m (- x z))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
return t_s * (y_s * (t_m * (y_m * (x - z))));
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = t_s * (y_s * (t_m * (y_m * (x - z))))
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
return t_s * (y_s * (t_m * (y_m * (x - z))));
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): return t_s * (y_s * (t_m * (y_m * (x - z))))
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) return Float64(t_s * Float64(y_s * Float64(t_m * Float64(y_m * Float64(x - z))))) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp = code(t_s, y_s, x, y_m, z, t_m)
tmp = t_s * (y_s * (t_m * (y_m * (x - z))));
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * N[(t$95$m * N[(y$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \left(t_m \cdot \left(y_m \cdot \left(x - z\right)\right)\right)\right)
\end{array}
Initial program 86.9%
distribute-rgt-out--89.2%
Simplified89.2%
Final simplification89.2%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s y_s x y_m z t_m) :precision binary64 (* t_s (* y_s (* x (* y_m t_m)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
return t_s * (y_s * (x * (y_m * t_m)));
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = t_s * (y_s * (x * (y_m * t_m)))
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
return t_s * (y_s * (x * (y_m * t_m)));
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) t_m = math.fabs(t) t_s = math.copysign(1.0, t) [x, y_m, z, t_m] = sort([x, y_m, z, t_m]) def code(t_s, y_s, x, y_m, z, t_m): return t_s * (y_s * (x * (y_m * t_m)))
y_m = abs(y) y_s = copysign(1.0, y) t_m = abs(t) t_s = copysign(1.0, t) x, y_m, z, t_m = sort([x, y_m, z, t_m]) function code(t_s, y_s, x, y_m, z, t_m) return Float64(t_s * Float64(y_s * Float64(x * Float64(y_m * t_m)))) end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp = code(t_s, y_s, x, y_m, z, t_m)
tmp = t_s * (y_s * (x * (y_m * t_m)));
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * N[(x * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \left(x \cdot \left(y_m \cdot t_m\right)\right)\right)
\end{array}
Initial program 86.9%
distribute-rgt-out--89.2%
Simplified89.2%
flip--60.2%
associate-*r/56.9%
associate-/l*60.2%
*-un-lft-identity60.2%
associate-/l*60.2%
flip--89.1%
Applied egg-rr89.1%
Taylor expanded in x around inf 52.9%
*-commutative52.9%
associate-*r*55.1%
*-commutative55.1%
Simplified55.1%
Final simplification55.1%
(FPCore (x y z t) :precision binary64 (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t < -9.231879582886777e-80) {
tmp = (y * t) * (x - z);
} else if (t < 2.543067051564877e+83) {
tmp = y * (t * (x - z));
} else {
tmp = (y * (x - z)) * t;
}
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) :: tmp
if (t < (-9.231879582886777d-80)) then
tmp = (y * t) * (x - z)
else if (t < 2.543067051564877d+83) then
tmp = y * (t * (x - z))
else
tmp = (y * (x - z)) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t < -9.231879582886777e-80) {
tmp = (y * t) * (x - z);
} else if (t < 2.543067051564877e+83) {
tmp = y * (t * (x - z));
} else {
tmp = (y * (x - z)) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t < -9.231879582886777e-80: tmp = (y * t) * (x - z) elif t < 2.543067051564877e+83: tmp = y * (t * (x - z)) else: tmp = (y * (x - z)) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t < -9.231879582886777e-80) tmp = Float64(Float64(y * t) * Float64(x - z)); elseif (t < 2.543067051564877e+83) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(Float64(y * Float64(x - z)) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t < -9.231879582886777e-80) tmp = (y * t) * (x - z); elseif (t < 2.543067051564877e+83) tmp = y * (t * (x - z)); else tmp = (y * (x - z)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[t, -9.231879582886777e-80], N[(N[(y * t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], If[Less[t, 2.543067051564877e+83], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\
\mathbf{elif}\;t < 2.543067051564877 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\
\end{array}
\end{array}
herbie shell --seed 2023336
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))
(* (- (* x y) (* z y)) t))