
(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 #s(literal 1 binary64) y) NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z t) :precision binary64 (* y_s (if (<= t 1e+16) (* y_m (* (- x z) t)) (* (- x z) (* y_m t)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if (t <= 1e+16) {
tmp = y_m * ((x - z) * t);
} else {
tmp = (x - z) * (y_m * t);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if (t <= 1d+16) then
tmp = y_m * ((x - z) * t)
else
tmp = (x - z) * (y_m * t)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if (t <= 1e+16) {
tmp = y_m * ((x - z) * t);
} else {
tmp = (x - z) * (y_m * t);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if t <= 1e+16: tmp = y_m * ((x - z) * t) else: tmp = (x - z) * (y_m * t) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if (t <= 1e+16) tmp = Float64(y_m * Float64(Float64(x - z) * t)); else tmp = Float64(Float64(x - z) * Float64(y_m * t)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if (t <= 1e+16)
tmp = y_m * ((x - z) * t);
else
tmp = (x - z) * (y_m * t);
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[LessEqual[t, 1e+16], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y$95$m * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 10^{+16}:\\
\;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y\_m \cdot t\right)\\
\end{array}
\end{array}
if t < 1e16Initial program 94.0%
distribute-rgt-out--94.5%
associate-*l*93.5%
*-commutative93.5%
Simplified93.5%
if 1e16 < t Initial program 99.8%
*-commutative99.8%
distribute-rgt-out--99.8%
associate-*r*98.1%
*-commutative98.1%
Simplified98.1%
Final simplification94.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z t)
:precision binary64
(*
y_s
(if (or (<= z -3.4e+181) (not (<= z 1.5e+171)))
(* t (* y_m (- z)))
(* y_m (* (- x z) t)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((z <= -3.4e+181) || !(z <= 1.5e+171)) {
tmp = t * (y_m * -z);
} else {
tmp = y_m * ((x - z) * t);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if ((z <= (-3.4d+181)) .or. (.not. (z <= 1.5d+171))) then
tmp = t * (y_m * -z)
else
tmp = y_m * ((x - z) * t)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((z <= -3.4e+181) || !(z <= 1.5e+171)) {
tmp = t * (y_m * -z);
} else {
tmp = y_m * ((x - z) * t);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if (z <= -3.4e+181) or not (z <= 1.5e+171): tmp = t * (y_m * -z) else: tmp = y_m * ((x - z) * t) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if ((z <= -3.4e+181) || !(z <= 1.5e+171)) tmp = Float64(t * Float64(y_m * Float64(-z))); else tmp = Float64(y_m * Float64(Float64(x - z) * t)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if ((z <= -3.4e+181) || ~((z <= 1.5e+171)))
tmp = t * (y_m * -z);
else
tmp = y_m * ((x - z) * t);
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[Or[LessEqual[z, -3.4e+181], N[Not[LessEqual[z, 1.5e+171]], $MachinePrecision]], N[(t * N[(y$95$m * (-z)), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+181} \lor \neg \left(z \leq 1.5 \cdot 10^{+171}\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\
\end{array}
\end{array}
if z < -3.40000000000000031e181 or 1.5e171 < z Initial program 91.5%
distribute-rgt-out--91.6%
Simplified91.6%
Taylor expanded in x around 0 88.3%
neg-mul-188.3%
Simplified88.3%
if -3.40000000000000031e181 < z < 1.5e171Initial program 96.4%
distribute-rgt-out--96.9%
associate-*l*93.6%
*-commutative93.6%
Simplified93.6%
Final simplification92.4%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z t)
:precision binary64
(*
y_s
(if (or (<= z -1.4e-74) (not (<= z 5.8e+29)))
(* t (* y_m (- z)))
(* x (* y_m t)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((z <= -1.4e-74) || !(z <= 5.8e+29)) {
tmp = t * (y_m * -z);
} else {
tmp = x * (y_m * t);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if ((z <= (-1.4d-74)) .or. (.not. (z <= 5.8d+29))) then
tmp = t * (y_m * -z)
else
tmp = x * (y_m * t)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((z <= -1.4e-74) || !(z <= 5.8e+29)) {
tmp = t * (y_m * -z);
} else {
tmp = x * (y_m * t);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if (z <= -1.4e-74) or not (z <= 5.8e+29): tmp = t * (y_m * -z) else: tmp = x * (y_m * t) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if ((z <= -1.4e-74) || !(z <= 5.8e+29)) tmp = Float64(t * Float64(y_m * Float64(-z))); else tmp = Float64(x * Float64(y_m * t)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if ((z <= -1.4e-74) || ~((z <= 5.8e+29)))
tmp = t * (y_m * -z);
else
tmp = x * (y_m * t);
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[Or[LessEqual[z, -1.4e-74], N[Not[LessEqual[z, 5.8e+29]], $MachinePrecision]], N[(t * N[(y$95$m * (-z)), $MachinePrecision]), $MachinePrecision], N[(x * N[(y$95$m * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-74} \lor \neg \left(z \leq 5.8 \cdot 10^{+29}\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y\_m \cdot t\right)\\
\end{array}
\end{array}
if z < -1.39999999999999994e-74 or 5.7999999999999999e29 < z Initial program 93.8%
distribute-rgt-out--94.6%
Simplified94.6%
Taylor expanded in x around 0 78.7%
neg-mul-178.7%
Simplified78.7%
if -1.39999999999999994e-74 < z < 5.7999999999999999e29Initial program 97.2%
*-commutative97.2%
distribute-rgt-out--97.2%
associate-*r*95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in x around inf 87.1%
Final simplification82.3%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z t)
:precision binary64
(*
y_s
(if (or (<= x -2.6e+37) (not (<= x 6.7e-16)))
(* t (* y_m x))
(* (* y_m t) (- z)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((x <= -2.6e+37) || !(x <= 6.7e-16)) {
tmp = t * (y_m * x);
} else {
tmp = (y_m * t) * -z;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if ((x <= (-2.6d+37)) .or. (.not. (x <= 6.7d-16))) then
tmp = t * (y_m * x)
else
tmp = (y_m * t) * -z
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((x <= -2.6e+37) || !(x <= 6.7e-16)) {
tmp = t * (y_m * x);
} else {
tmp = (y_m * t) * -z;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if (x <= -2.6e+37) or not (x <= 6.7e-16): tmp = t * (y_m * x) else: tmp = (y_m * t) * -z return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if ((x <= -2.6e+37) || !(x <= 6.7e-16)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(Float64(y_m * t) * Float64(-z)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if ((x <= -2.6e+37) || ~((x <= 6.7e-16)))
tmp = t * (y_m * x);
else
tmp = (y_m * t) * -z;
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[Or[LessEqual[x, -2.6e+37], N[Not[LessEqual[x, 6.7e-16]], $MachinePrecision]], N[(t * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * t), $MachinePrecision] * (-z)), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+37} \lor \neg \left(x \leq 6.7 \cdot 10^{-16}\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y\_m \cdot t\right) \cdot \left(-z\right)\\
\end{array}
\end{array}
if x < -2.5999999999999999e37 or 6.7000000000000004e-16 < x Initial program 92.2%
distribute-rgt-out--93.2%
Simplified93.2%
Taylor expanded in x around inf 77.7%
if -2.5999999999999999e37 < x < 6.7000000000000004e-16Initial program 97.7%
*-commutative97.7%
distribute-rgt-out--97.7%
associate-*r*93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in x around 0 79.9%
neg-mul-180.9%
Simplified79.9%
Final simplification78.9%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z t)
:precision binary64
(*
y_s
(if (or (<= x -4.6e-29) (not (<= x 2.45e-14)))
(* t (* y_m x))
(* y_m (* z (- t))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((x <= -4.6e-29) || !(x <= 2.45e-14)) {
tmp = t * (y_m * x);
} else {
tmp = y_m * (z * -t);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if ((x <= (-4.6d-29)) .or. (.not. (x <= 2.45d-14))) then
tmp = t * (y_m * x)
else
tmp = y_m * (z * -t)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if ((x <= -4.6e-29) || !(x <= 2.45e-14)) {
tmp = t * (y_m * x);
} else {
tmp = y_m * (z * -t);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if (x <= -4.6e-29) or not (x <= 2.45e-14): tmp = t * (y_m * x) else: tmp = y_m * (z * -t) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if ((x <= -4.6e-29) || !(x <= 2.45e-14)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(y_m * Float64(z * Float64(-t))); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if ((x <= -4.6e-29) || ~((x <= 2.45e-14)))
tmp = t * (y_m * x);
else
tmp = y_m * (z * -t);
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[Or[LessEqual[x, -4.6e-29], N[Not[LessEqual[x, 2.45e-14]], $MachinePrecision]], N[(t * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(z * (-t)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-29} \lor \neg \left(x \leq 2.45 \cdot 10^{-14}\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(z \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if x < -4.59999999999999982e-29 or 2.44999999999999997e-14 < x Initial program 93.3%
distribute-rgt-out--94.2%
Simplified94.2%
Taylor expanded in x around inf 75.9%
if -4.59999999999999982e-29 < x < 2.44999999999999997e-14Initial program 97.4%
distribute-rgt-out--97.4%
associate-*l*92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
Simplified81.0%
Final simplification78.3%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z t) :precision binary64 (* y_s (if (<= t 2.4e+186) (* t (* y_m x)) (* x (* y_m t)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if (t <= 2.4e+186) {
tmp = t * (y_m * x);
} else {
tmp = x * (y_m * t);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if (t <= 2.4d+186) then
tmp = t * (y_m * x)
else
tmp = x * (y_m * t)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if (t <= 2.4e+186) {
tmp = t * (y_m * x);
} else {
tmp = x * (y_m * t);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if t <= 2.4e+186: tmp = t * (y_m * x) else: tmp = x * (y_m * t) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if (t <= 2.4e+186) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(x * Float64(y_m * t)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if (t <= 2.4e+186)
tmp = t * (y_m * x);
else
tmp = x * (y_m * t);
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[LessEqual[t, 2.4e+186], N[(t * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y$95$m * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 2.4 \cdot 10^{+186}:\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y\_m \cdot t\right)\\
\end{array}
\end{array}
if t < 2.39999999999999995e186Initial program 94.7%
distribute-rgt-out--95.2%
Simplified95.2%
Taylor expanded in x around inf 52.4%
if 2.39999999999999995e186 < t Initial program 99.8%
*-commutative99.8%
distribute-rgt-out--99.8%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 74.4%
Final simplification54.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z t) :precision binary64 (* y_s (if (<= t 100000000000.0) (* y_m (* x t)) (* x (* y_m t)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if (t <= 100000000000.0) {
tmp = y_m * (x * t);
} else {
tmp = x * (y_m * t);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
real(8) :: tmp
if (t <= 100000000000.0d0) then
tmp = y_m * (x * t)
else
tmp = x * (y_m * t)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
double tmp;
if (t <= 100000000000.0) {
tmp = y_m * (x * t);
} else {
tmp = x * (y_m * t);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): tmp = 0 if t <= 100000000000.0: tmp = y_m * (x * t) else: tmp = x * (y_m * t) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) tmp = 0.0 if (t <= 100000000000.0) tmp = Float64(y_m * Float64(x * t)); else tmp = Float64(x * Float64(y_m * t)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
tmp = 0.0;
if (t <= 100000000000.0)
tmp = y_m * (x * t);
else
tmp = x * (y_m * t);
end
tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[LessEqual[t, 100000000000.0], N[(y$95$m * N[(x * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y$95$m * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 100000000000:\\
\;\;\;\;y\_m \cdot \left(x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y\_m \cdot t\right)\\
\end{array}
\end{array}
if t < 1e11Initial program 93.9%
distribute-rgt-out--94.5%
associate-*l*93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in x around inf 54.5%
if 1e11 < t Initial program 99.8%
*-commutative99.8%
distribute-rgt-out--99.8%
associate-*r*98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in x around inf 58.9%
Final simplification55.5%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z t) :precision binary64 (* y_s (* (* y_m (- x z)) t)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
return y_s * ((y_m * (x - z)) * t);
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
code = y_s * ((y_m * (x - z)) * t)
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
return y_s * ((y_m * (x - z)) * t);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): return y_s * ((y_m * (x - z)) * t)
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) return Float64(y_s * Float64(Float64(y_m * Float64(x - z)) * t)) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp = code(y_s, x, y_m, z, t)
tmp = y_s * ((y_m * (x - z)) * t);
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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * N[(N[(y$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \left(\left(y\_m \cdot \left(x - z\right)\right) \cdot t\right)
\end{array}
Initial program 95.3%
distribute-rgt-out--95.7%
Simplified95.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z t) :precision binary64 (* y_s (* y_m (* x t))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
return y_s * (y_m * (x * t));
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
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
code = y_s * (y_m * (x * t))
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
return y_s * (y_m * (x * t));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z, t] = sort([x, y_m, z, t]) def code(y_s, x, y_m, z, t): return y_s * (y_m * (x * t))
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z, t = sort([x, y_m, z, t]) function code(y_s, x, y_m, z, t) return Float64(y_s * Float64(y_m * Float64(x * t))) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp = code(y_s, x, y_m, z, t)
tmp = y_s * (y_m * (x * t));
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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * N[(y$95$m * N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \left(y\_m \cdot \left(x \cdot t\right)\right)
\end{array}
Initial program 95.3%
distribute-rgt-out--95.7%
associate-*l*90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in x around inf 53.4%
Final simplification53.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 2024143
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< t -9231879582886777/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (* y t) (- x z)) (if (< t 254306705156487700000000000000000000000000000000000000000000000000000000000000000000) (* y (* t (- x z))) (* (* y (- x z)) t))))
(* (- (* x y) (* z y)) t))