
(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 8 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) 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 1.5e+30) (* 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 <= 1.5e+30) {
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 <= 1.5d+30) 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 <= 1.5e+30) {
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 <= 1.5e+30: 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 <= 1.5e+30) 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 <= 1.5e+30)
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, 1.5e+30], 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 1.5 \cdot 10^{+30}:\\
\;\;\;\;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 < 1.49999999999999989e30Initial program 90.0%
distribute-rgt-out--91.9%
associate-*l*93.7%
*-commutative93.7%
Simplified93.7%
if 1.49999999999999989e30 < t Initial program 96.1%
*-commutative96.1%
distribute-rgt-out--98.0%
associate-*r*98.0%
*-commutative98.0%
Simplified98.0%
Final simplification94.6%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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 -1.9e-48) (not (<= x 0.11)))
(* 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 <= -1.9e-48) || !(x <= 0.11)) {
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 <= (-1.9d-48)) .or. (.not. (x <= 0.11d0))) 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 <= -1.9e-48) || !(x <= 0.11)) {
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 <= -1.9e-48) or not (x <= 0.11): 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 <= -1.9e-48) || !(x <= 0.11)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(y_m * Float64(-Float64(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 ((x <= -1.9e-48) || ~((x <= 0.11)))
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, -1.9e-48], N[Not[LessEqual[x, 0.11]], $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 -1.9 \cdot 10^{-48} \lor \neg \left(x \leq 0.11\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(-z \cdot t\right)\\
\end{array}
\end{array}
if x < -1.90000000000000001e-48 or 0.110000000000000001 < x Initial program 88.4%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -1.90000000000000001e-48 < x < 0.110000000000000001Initial program 94.3%
distribute-rgt-out--94.3%
associate-*l*91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 82.2%
mul-1-neg82.2%
distribute-rgt-neg-out82.2%
Simplified82.2%
Final simplification77.9%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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.5e-50) (not (<= x 0.6)))
(* t (* y_m 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 ((x <= -2.5e-50) || !(x <= 0.6)) {
tmp = t * (y_m * x);
} else {
tmp = 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 ((x <= (-2.5d-50)) .or. (.not. (x <= 0.6d0))) then
tmp = t * (y_m * x)
else
tmp = 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 ((x <= -2.5e-50) || !(x <= 0.6)) {
tmp = t * (y_m * x);
} else {
tmp = 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 (x <= -2.5e-50) or not (x <= 0.6): tmp = t * (y_m * x) else: tmp = 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 ((x <= -2.5e-50) || !(x <= 0.6)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(z * Float64(-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 ((x <= -2.5e-50) || ~((x <= 0.6)))
tmp = t * (y_m * x);
else
tmp = 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[Or[LessEqual[x, -2.5e-50], N[Not[LessEqual[x, 0.6]], $MachinePrecision]], N[(t * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(z * (-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}\;x \leq -2.5 \cdot 10^{-50} \lor \neg \left(x \leq 0.6\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\_m \cdot t\right)\\
\end{array}
\end{array}
if x < -2.49999999999999984e-50 or 0.599999999999999978 < x Initial program 88.4%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -2.49999999999999984e-50 < x < 0.599999999999999978Initial program 94.3%
distribute-rgt-out--94.3%
associate-*l*91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 84.6%
mul-1-neg84.6%
distribute-rgt-neg-in84.6%
distribute-rgt-neg-out84.6%
associate-*l*86.4%
Simplified86.4%
Final simplification79.9%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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 -8.5e-50) (not (<= x 1.6)))
(* t (* y_m x))
(* t (* z (- y_m))))))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 <= -8.5e-50) || !(x <= 1.6)) {
tmp = t * (y_m * x);
} else {
tmp = t * (z * -y_m);
}
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 <= (-8.5d-50)) .or. (.not. (x <= 1.6d0))) then
tmp = t * (y_m * x)
else
tmp = t * (z * -y_m)
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 <= -8.5e-50) || !(x <= 1.6)) {
tmp = t * (y_m * x);
} else {
tmp = t * (z * -y_m);
}
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 <= -8.5e-50) or not (x <= 1.6): tmp = t * (y_m * x) else: tmp = t * (z * -y_m) 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 <= -8.5e-50) || !(x <= 1.6)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(t * Float64(z * Float64(-y_m))); 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 <= -8.5e-50) || ~((x <= 1.6)))
tmp = t * (y_m * x);
else
tmp = t * (z * -y_m);
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, -8.5e-50], N[Not[LessEqual[x, 1.6]], $MachinePrecision]], N[(t * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(t * N[(z * (-y$95$m)), $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 -8.5 \cdot 10^{-50} \lor \neg \left(x \leq 1.6\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot \left(-y\_m\right)\right)\\
\end{array}
\end{array}
if x < -8.50000000000000012e-50 or 1.6000000000000001 < x Initial program 88.4%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -8.50000000000000012e-50 < x < 1.6000000000000001Initial program 94.3%
distribute-rgt-out--94.3%
Simplified94.3%
Taylor expanded in x around 0 84.6%
associate-*r*84.6%
*-commutative84.6%
mul-1-neg84.6%
Simplified84.6%
Final simplification79.1%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 (<= z 3.5e+100) (* y_m (* (- x z) t)) (* t (* z (- y_m))))))
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.5e+100) {
tmp = y_m * ((x - z) * t);
} else {
tmp = t * (z * -y_m);
}
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.5d+100) then
tmp = y_m * ((x - z) * t)
else
tmp = t * (z * -y_m)
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.5e+100) {
tmp = y_m * ((x - z) * t);
} else {
tmp = t * (z * -y_m);
}
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.5e+100: tmp = y_m * ((x - z) * t) else: tmp = t * (z * -y_m) 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.5e+100) tmp = Float64(y_m * Float64(Float64(x - z) * t)); else tmp = Float64(t * Float64(z * Float64(-y_m))); 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.5e+100)
tmp = y_m * ((x - z) * t);
else
tmp = t * (z * -y_m);
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[z, 3.5e+100], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t * N[(z * (-y$95$m)), $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.5 \cdot 10^{+100}:\\
\;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot \left(-y\_m\right)\right)\\
\end{array}
\end{array}
if z < 3.49999999999999976e100Initial program 93.0%
distribute-rgt-out--94.8%
associate-*l*94.7%
*-commutative94.7%
Simplified94.7%
if 3.49999999999999976e100 < z Initial program 77.5%
distribute-rgt-out--80.9%
Simplified80.9%
Taylor expanded in x around 0 70.9%
associate-*r*70.9%
*-commutative70.9%
mul-1-neg70.9%
Simplified70.9%
Final simplification91.9%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 91.2%
distribute-rgt-out--93.2%
Simplified93.2%
Final simplification93.2%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 91.2%
distribute-rgt-out--93.2%
associate-*l*93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in x around inf 52.8%
associate-*r*54.1%
*-commutative54.1%
Simplified54.1%
Final simplification54.1%
y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 (* t (* y_m x))))
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 * (t * (y_m * x));
}
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 * (t * (y_m * x))
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 * (t * (y_m * x));
}
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 * (t * (y_m * x))
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(t * Float64(y_m * x))) 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 * (t * (y_m * x));
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[(t * N[(y$95$m * x), $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(t \cdot \left(y\_m \cdot x\right)\right)
\end{array}
Initial program 91.2%
distribute-rgt-out--93.2%
Simplified93.2%
Taylor expanded in x around inf 52.8%
*-commutative52.8%
Simplified52.8%
Final simplification52.8%
(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 2024027
(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))