
(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 (* t_s (* y_s (if (<= t_m 2e-8) (* y_m (* (- x z) t_m)) (* (- 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 <= 2e-8) {
tmp = y_m * ((x - z) * t_m);
} 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 <= 2d-8) then
tmp = y_m * ((x - z) * t_m)
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 <= 2e-8) {
tmp = y_m * ((x - z) * t_m);
} 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 <= 2e-8: tmp = y_m * ((x - z) * t_m) 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 <= 2e-8) tmp = Float64(y_m * Float64(Float64(x - z) * t_m)); 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 <= 2e-8)
tmp = y_m * ((x - z) * t_m);
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, 2e-8], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t$95$m), $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 2 \cdot 10^{-8}:\\
\;\;\;\;y_m \cdot \left(\left(x - z\right) \cdot t_m\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y_m \cdot t_m\right)\\
\end{array}\right)
\end{array}
if t < 2e-8Initial program 88.4%
distribute-rgt-out--89.0%
associate-*l*93.9%
*-commutative93.9%
Simplified93.9%
if 2e-8 < t Initial program 97.6%
*-commutative97.6%
distribute-rgt-out--97.6%
associate-*r*97.1%
*-commutative97.1%
Simplified97.1%
Final simplification94.7%
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 (* y_m x))) (t_3 (* (* y_m t_m) (- z))))
(*
t_s
(*
y_s
(if (<= z -3.7e-7)
t_3
(if (<= z -9e-46)
t_2
(if (<= z -3.3e-73)
t_3
(if (<= z 3.9e-175)
(* y_m (* x t_m))
(if (<= z 1.18e-29) t_2 t_3)))))))))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 * (y_m * x);
double t_3 = (y_m * t_m) * -z;
double tmp;
if (z <= -3.7e-7) {
tmp = t_3;
} else if (z <= -9e-46) {
tmp = t_2;
} else if (z <= -3.3e-73) {
tmp = t_3;
} else if (z <= 3.9e-175) {
tmp = y_m * (x * t_m);
} else if (z <= 1.18e-29) {
tmp = t_2;
} else {
tmp = t_3;
}
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 * (y_m * x)
t_3 = (y_m * t_m) * -z
if (z <= (-3.7d-7)) then
tmp = t_3
else if (z <= (-9d-46)) then
tmp = t_2
else if (z <= (-3.3d-73)) then
tmp = t_3
else if (z <= 3.9d-175) then
tmp = y_m * (x * t_m)
else if (z <= 1.18d-29) then
tmp = t_2
else
tmp = t_3
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 * (y_m * x);
double t_3 = (y_m * t_m) * -z;
double tmp;
if (z <= -3.7e-7) {
tmp = t_3;
} else if (z <= -9e-46) {
tmp = t_2;
} else if (z <= -3.3e-73) {
tmp = t_3;
} else if (z <= 3.9e-175) {
tmp = y_m * (x * t_m);
} else if (z <= 1.18e-29) {
tmp = t_2;
} else {
tmp = t_3;
}
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 * (y_m * x) t_3 = (y_m * t_m) * -z tmp = 0 if z <= -3.7e-7: tmp = t_3 elif z <= -9e-46: tmp = t_2 elif z <= -3.3e-73: tmp = t_3 elif z <= 3.9e-175: tmp = y_m * (x * t_m) elif z <= 1.18e-29: tmp = t_2 else: tmp = t_3 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(y_m * x)) t_3 = Float64(Float64(y_m * t_m) * Float64(-z)) tmp = 0.0 if (z <= -3.7e-7) tmp = t_3; elseif (z <= -9e-46) tmp = t_2; elseif (z <= -3.3e-73) tmp = t_3; elseif (z <= 3.9e-175) tmp = Float64(y_m * Float64(x * t_m)); elseif (z <= 1.18e-29) tmp = t_2; else tmp = t_3; 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 * (y_m * x);
t_3 = (y_m * t_m) * -z;
tmp = 0.0;
if (z <= -3.7e-7)
tmp = t_3;
elseif (z <= -9e-46)
tmp = t_2;
elseif (z <= -3.3e-73)
tmp = t_3;
elseif (z <= 3.9e-175)
tmp = y_m * (x * t_m);
elseif (z <= 1.18e-29)
tmp = t_2;
else
tmp = t_3;
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[(y$95$m * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y$95$m * t$95$m), $MachinePrecision] * (-z)), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[z, -3.7e-7], t$95$3, If[LessEqual[z, -9e-46], t$95$2, If[LessEqual[z, -3.3e-73], t$95$3, If[LessEqual[z, 3.9e-175], N[(y$95$m * N[(x * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.18e-29], t$95$2, t$95$3]]]]]), $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(y_m \cdot x\right)\\
t_3 := \left(y_m \cdot t_m\right) \cdot \left(-z\right)\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-7}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-73}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-175}:\\
\;\;\;\;y_m \cdot \left(x \cdot t_m\right)\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-29}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}\right)
\end{array}
\end{array}
if z < -3.70000000000000004e-7 or -9.00000000000000001e-46 < z < -3.30000000000000004e-73 or 1.17999999999999996e-29 < z Initial program 88.4%
distribute-rgt-out--89.2%
associate-*l*92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in x around 0 70.8%
mul-1-neg70.8%
distribute-rgt-neg-in70.8%
distribute-rgt-neg-out70.8%
associate-*l*76.0%
Simplified76.0%
if -3.70000000000000004e-7 < z < -9.00000000000000001e-46 or 3.89999999999999998e-175 < z < 1.17999999999999996e-29Initial program 90.8%
distribute-rgt-out--90.8%
Simplified90.8%
Taylor expanded in x around inf 81.4%
*-commutative81.4%
Simplified81.4%
if -3.30000000000000004e-73 < z < 3.89999999999999998e-175Initial program 95.8%
distribute-rgt-out--95.8%
associate-*l*90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in x around inf 88.8%
associate-*r*86.4%
*-commutative86.4%
Simplified86.4%
Final simplification79.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
(let* ((t_2 (* t_m (* y_m x))) (t_3 (* t_m (* y_m (- z)))))
(*
t_s
(*
y_s
(if (<= z -3.1e-7)
t_3
(if (<= z -8e-46)
t_2
(if (<= z -5.6e-73)
(* (* y_m t_m) (- z))
(if (<= z 8.2e-175)
(* y_m (* x t_m))
(if (<= z 1.18e-29) t_2 t_3)))))))))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 * (y_m * x);
double t_3 = t_m * (y_m * -z);
double tmp;
if (z <= -3.1e-7) {
tmp = t_3;
} else if (z <= -8e-46) {
tmp = t_2;
} else if (z <= -5.6e-73) {
tmp = (y_m * t_m) * -z;
} else if (z <= 8.2e-175) {
tmp = y_m * (x * t_m);
} else if (z <= 1.18e-29) {
tmp = t_2;
} else {
tmp = t_3;
}
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 * (y_m * x)
t_3 = t_m * (y_m * -z)
if (z <= (-3.1d-7)) then
tmp = t_3
else if (z <= (-8d-46)) then
tmp = t_2
else if (z <= (-5.6d-73)) then
tmp = (y_m * t_m) * -z
else if (z <= 8.2d-175) then
tmp = y_m * (x * t_m)
else if (z <= 1.18d-29) then
tmp = t_2
else
tmp = t_3
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 * (y_m * x);
double t_3 = t_m * (y_m * -z);
double tmp;
if (z <= -3.1e-7) {
tmp = t_3;
} else if (z <= -8e-46) {
tmp = t_2;
} else if (z <= -5.6e-73) {
tmp = (y_m * t_m) * -z;
} else if (z <= 8.2e-175) {
tmp = y_m * (x * t_m);
} else if (z <= 1.18e-29) {
tmp = t_2;
} else {
tmp = t_3;
}
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 * (y_m * x) t_3 = t_m * (y_m * -z) tmp = 0 if z <= -3.1e-7: tmp = t_3 elif z <= -8e-46: tmp = t_2 elif z <= -5.6e-73: tmp = (y_m * t_m) * -z elif z <= 8.2e-175: tmp = y_m * (x * t_m) elif z <= 1.18e-29: tmp = t_2 else: tmp = t_3 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(y_m * x)) t_3 = Float64(t_m * Float64(y_m * Float64(-z))) tmp = 0.0 if (z <= -3.1e-7) tmp = t_3; elseif (z <= -8e-46) tmp = t_2; elseif (z <= -5.6e-73) tmp = Float64(Float64(y_m * t_m) * Float64(-z)); elseif (z <= 8.2e-175) tmp = Float64(y_m * Float64(x * t_m)); elseif (z <= 1.18e-29) tmp = t_2; else tmp = t_3; 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 * (y_m * x);
t_3 = t_m * (y_m * -z);
tmp = 0.0;
if (z <= -3.1e-7)
tmp = t_3;
elseif (z <= -8e-46)
tmp = t_2;
elseif (z <= -5.6e-73)
tmp = (y_m * t_m) * -z;
elseif (z <= 8.2e-175)
tmp = y_m * (x * t_m);
elseif (z <= 1.18e-29)
tmp = t_2;
else
tmp = t_3;
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[(y$95$m * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$m * N[(y$95$m * (-z)), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[z, -3.1e-7], t$95$3, If[LessEqual[z, -8e-46], t$95$2, If[LessEqual[z, -5.6e-73], N[(N[(y$95$m * t$95$m), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[z, 8.2e-175], N[(y$95$m * N[(x * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.18e-29], t$95$2, t$95$3]]]]]), $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(y_m \cdot x\right)\\
t_3 := t_m \cdot \left(y_m \cdot \left(-z\right)\right)\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-7}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-73}:\\
\;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-175}:\\
\;\;\;\;y_m \cdot \left(x \cdot t_m\right)\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-29}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}\right)
\end{array}
\end{array}
if z < -3.1e-7 or 1.17999999999999996e-29 < z Initial program 87.8%
distribute-rgt-out--88.7%
Simplified88.7%
Taylor expanded in x around 0 70.4%
associate-*r*70.4%
*-commutative70.4%
mul-1-neg70.4%
Simplified70.4%
if -3.1e-7 < z < -8.00000000000000018e-46 or 8.19999999999999997e-175 < z < 1.17999999999999996e-29Initial program 90.8%
distribute-rgt-out--90.8%
Simplified90.8%
Taylor expanded in x around inf 81.4%
*-commutative81.4%
Simplified81.4%
if -8.00000000000000018e-46 < z < -5.60000000000000023e-73Initial program 99.6%
distribute-rgt-out--99.3%
associate-*l*86.4%
*-commutative86.4%
Simplified86.4%
Taylor expanded in x around 0 80.4%
mul-1-neg80.4%
distribute-rgt-neg-in80.4%
distribute-rgt-neg-out80.4%
associate-*l*80.8%
Simplified80.8%
if -5.60000000000000023e-73 < z < 8.19999999999999997e-175Initial program 95.8%
distribute-rgt-out--95.8%
associate-*l*90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in x around inf 88.8%
associate-*r*86.4%
*-commutative86.4%
Simplified86.4%
Final simplification76.7%
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 (* y_m (* z (- t_m)))) (t_3 (* t_m (* y_m x))))
(*
t_s
(*
y_s
(if (<= x -1.3e+110)
t_3
(if (<= x -1.85e+71)
t_2
(if (<= x -3.5e-48)
(* x (* y_m t_m))
(if (<= x 2.55e-42) t_2 t_3))))))))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 = y_m * (z * -t_m);
double t_3 = t_m * (y_m * x);
double tmp;
if (x <= -1.3e+110) {
tmp = t_3;
} else if (x <= -1.85e+71) {
tmp = t_2;
} else if (x <= -3.5e-48) {
tmp = x * (y_m * t_m);
} else if (x <= 2.55e-42) {
tmp = t_2;
} else {
tmp = t_3;
}
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 = y_m * (z * -t_m)
t_3 = t_m * (y_m * x)
if (x <= (-1.3d+110)) then
tmp = t_3
else if (x <= (-1.85d+71)) then
tmp = t_2
else if (x <= (-3.5d-48)) then
tmp = x * (y_m * t_m)
else if (x <= 2.55d-42) then
tmp = t_2
else
tmp = t_3
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 = y_m * (z * -t_m);
double t_3 = t_m * (y_m * x);
double tmp;
if (x <= -1.3e+110) {
tmp = t_3;
} else if (x <= -1.85e+71) {
tmp = t_2;
} else if (x <= -3.5e-48) {
tmp = x * (y_m * t_m);
} else if (x <= 2.55e-42) {
tmp = t_2;
} else {
tmp = t_3;
}
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 = y_m * (z * -t_m) t_3 = t_m * (y_m * x) tmp = 0 if x <= -1.3e+110: tmp = t_3 elif x <= -1.85e+71: tmp = t_2 elif x <= -3.5e-48: tmp = x * (y_m * t_m) elif x <= 2.55e-42: tmp = t_2 else: tmp = t_3 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(y_m * Float64(z * Float64(-t_m))) t_3 = Float64(t_m * Float64(y_m * x)) tmp = 0.0 if (x <= -1.3e+110) tmp = t_3; elseif (x <= -1.85e+71) tmp = t_2; elseif (x <= -3.5e-48) tmp = Float64(x * Float64(y_m * t_m)); elseif (x <= 2.55e-42) tmp = t_2; else tmp = t_3; 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 = y_m * (z * -t_m);
t_3 = t_m * (y_m * x);
tmp = 0.0;
if (x <= -1.3e+110)
tmp = t_3;
elseif (x <= -1.85e+71)
tmp = t_2;
elseif (x <= -3.5e-48)
tmp = x * (y_m * t_m);
elseif (x <= 2.55e-42)
tmp = t_2;
else
tmp = t_3;
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[(y$95$m * N[(z * (-t$95$m)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$m * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[x, -1.3e+110], t$95$3, If[LessEqual[x, -1.85e+71], t$95$2, If[LessEqual[x, -3.5e-48], N[(x * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.55e-42], t$95$2, t$95$3]]]]), $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 := y_m \cdot \left(z \cdot \left(-t_m\right)\right)\\
t_3 := t_m \cdot \left(y_m \cdot x\right)\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+110}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+71}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-48}:\\
\;\;\;\;x \cdot \left(y_m \cdot t_m\right)\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{-42}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}\right)
\end{array}
\end{array}
if x < -1.3e110 or 2.55e-42 < x Initial program 89.0%
distribute-rgt-out--90.1%
Simplified90.1%
Taylor expanded in x around inf 78.0%
*-commutative78.0%
Simplified78.0%
if -1.3e110 < x < -1.85e71 or -3.49999999999999991e-48 < x < 2.55e-42Initial program 92.4%
distribute-rgt-out--92.4%
associate-*l*95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in x around 0 79.2%
mul-1-neg79.2%
distribute-rgt-neg-out79.2%
Simplified79.2%
if -1.85e71 < x < -3.49999999999999991e-48Initial program 90.5%
distribute-rgt-out--90.5%
associate-*l*85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in x around inf 57.1%
associate-*r*51.5%
*-commutative51.5%
Simplified51.5%
add-sqr-sqrt30.4%
pow230.4%
*-commutative30.4%
associate-*l*32.8%
*-commutative32.8%
Applied egg-rr32.8%
unpow232.8%
add-sqr-sqrt57.1%
associate-*r*57.3%
*-commutative57.3%
Applied egg-rr57.3%
Final simplification76.1%
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 (<= z 1.3e+120) (* y_m (* (- x z) t_m)) (* t_m (* y_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 (z <= 1.3e+120) {
tmp = y_m * ((x - z) * t_m);
} else {
tmp = t_m * (y_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 (z <= 1.3d+120) then
tmp = y_m * ((x - z) * t_m)
else
tmp = t_m * (y_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 (z <= 1.3e+120) {
tmp = y_m * ((x - z) * t_m);
} else {
tmp = t_m * (y_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 z <= 1.3e+120: tmp = y_m * ((x - z) * t_m) else: tmp = t_m * (y_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 (z <= 1.3e+120) tmp = Float64(y_m * Float64(Float64(x - z) * t_m)); else tmp = Float64(t_m * Float64(y_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 (z <= 1.3e+120)
tmp = y_m * ((x - z) * t_m);
else
tmp = t_m * (y_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[LessEqual[z, 1.3e+120], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], N[(t$95$m * N[(y$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}\;z \leq 1.3 \cdot 10^{+120}:\\
\;\;\;\;y_m \cdot \left(\left(x - z\right) \cdot t_m\right)\\
\mathbf{else}:\\
\;\;\;\;t_m \cdot \left(y_m \cdot \left(-z\right)\right)\\
\end{array}\right)
\end{array}
if z < 1.2999999999999999e120Initial program 92.4%
distribute-rgt-out--92.9%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
if 1.2999999999999999e120 < z Initial program 83.1%
distribute-rgt-out--83.5%
Simplified83.5%
Taylor expanded in x around 0 79.3%
associate-*r*79.3%
*-commutative79.3%
mul-1-neg79.3%
Simplified79.3%
Final simplification90.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 (<= t_m 3.1e-15) (* 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 <= 3.1e-15) {
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 <= 3.1d-15) 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 <= 3.1e-15) {
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 <= 3.1e-15: 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 <= 3.1e-15) 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 <= 3.1e-15)
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, 3.1e-15], 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 3.1 \cdot 10^{-15}:\\
\;\;\;\;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 < 3.0999999999999999e-15Initial program 88.3%
distribute-rgt-out--88.9%
associate-*l*93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in x around inf 53.8%
associate-*r*54.3%
*-commutative54.3%
Simplified54.3%
if 3.0999999999999999e-15 < t Initial program 97.6%
distribute-rgt-out--97.6%
associate-*l*88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in x around inf 59.9%
associate-*r*54.4%
*-commutative54.4%
Simplified54.4%
add-sqr-sqrt21.1%
pow221.1%
*-commutative21.1%
associate-*l*23.9%
*-commutative23.9%
Applied egg-rr23.9%
unpow223.9%
add-sqr-sqrt59.9%
associate-*r*64.1%
*-commutative64.1%
Applied egg-rr64.1%
Final simplification56.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 2e-17) (* t_m (* y_m x)) (* 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 <= 2e-17) {
tmp = t_m * (y_m * x);
} 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 <= 2d-17) then
tmp = t_m * (y_m * x)
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 <= 2e-17) {
tmp = t_m * (y_m * x);
} 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 <= 2e-17: tmp = t_m * (y_m * x) 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 <= 2e-17) tmp = Float64(t_m * Float64(y_m * x)); 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 <= 2e-17)
tmp = t_m * (y_m * x);
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, 2e-17], N[(t$95$m * N[(y$95$m * x), $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 2 \cdot 10^{-17}:\\
\;\;\;\;t_m \cdot \left(y_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y_m \cdot t_m\right)\\
\end{array}\right)
\end{array}
if t < 2.00000000000000014e-17Initial program 88.3%
distribute-rgt-out--88.9%
Simplified88.9%
Taylor expanded in x around inf 54.1%
*-commutative54.1%
Simplified54.1%
if 2.00000000000000014e-17 < t Initial program 97.7%
distribute-rgt-out--97.6%
associate-*l*89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in x around inf 59.0%
associate-*r*53.7%
*-commutative53.7%
Simplified53.7%
add-sqr-sqrt20.8%
pow220.8%
*-commutative20.8%
associate-*l*23.5%
*-commutative23.5%
Applied egg-rr23.5%
unpow223.5%
add-sqr-sqrt59.0%
associate-*r*63.2%
*-commutative63.2%
Applied egg-rr63.2%
Final simplification56.5%
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 (* (* y_m (- x z)) 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 * ((y_m * (x - z)) * 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 * ((y_m * (x - z)) * 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 * ((y_m * (x - z)) * 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 * ((y_m * (x - z)) * 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(Float64(y_m * Float64(x - z)) * 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 * ((y_m * (x - z)) * 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[(N[(y$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision] * t$95$m), $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(\left(y_m \cdot \left(x - z\right)\right) \cdot t_m\right)\right)
\end{array}
Initial program 90.8%
distribute-rgt-out--91.2%
Simplified91.2%
Final simplification91.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 (* y_m (* x 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 * (y_m * (x * 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 * (y_m * (x * 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 * (y_m * (x * 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 * (y_m * (x * 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(y_m * Float64(x * 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 * (y_m * (x * 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[(y$95$m * N[(x * 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(y_m \cdot \left(x \cdot t_m\right)\right)\right)
\end{array}
Initial program 90.8%
distribute-rgt-out--91.2%
associate-*l*92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in x around inf 55.4%
associate-*r*54.4%
*-commutative54.4%
Simplified54.4%
Final simplification54.4%
(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 2024021
(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))