
(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 #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-5) (* 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-5) {
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-5) 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-5) {
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-5: 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-5) 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-5)
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-5], 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^{-5}:\\
\;\;\;\;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.00000000000000008e-5Initial program 88.0%
distribute-rgt-out--90.9%
associate-*l*93.4%
*-commutative93.4%
Simplified93.4%
if 1.00000000000000008e-5 < t Initial program 91.9%
*-commutative91.9%
distribute-rgt-out--95.8%
associate-*r*96.1%
*-commutative96.1%
Simplified96.1%
Final simplification94.2%
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 -0.23) (not (<= x 4.2e-27)))
(* t (* y_m x))
(* t (* y_m (- 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 <= -0.23) || !(x <= 4.2e-27)) {
tmp = t * (y_m * x);
} else {
tmp = t * (y_m * -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 <= (-0.23d0)) .or. (.not. (x <= 4.2d-27))) then
tmp = t * (y_m * x)
else
tmp = t * (y_m * -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 <= -0.23) || !(x <= 4.2e-27)) {
tmp = t * (y_m * x);
} else {
tmp = t * (y_m * -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 <= -0.23) or not (x <= 4.2e-27): tmp = t * (y_m * x) else: tmp = t * (y_m * -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 <= -0.23) || !(x <= 4.2e-27)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(t * Float64(y_m * 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 <= -0.23) || ~((x <= 4.2e-27)))
tmp = t * (y_m * x);
else
tmp = t * (y_m * -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, -0.23], N[Not[LessEqual[x, 4.2e-27]], $MachinePrecision]], N[(t * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(t * N[(y$95$m * (-z)), $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 -0.23 \lor \neg \left(x \leq 4.2 \cdot 10^{-27}\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y\_m \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if x < -0.23000000000000001 or 4.20000000000000031e-27 < x Initial program 84.9%
distribute-rgt-out--91.1%
Simplified91.1%
Taylor expanded in x around inf 71.8%
if -0.23000000000000001 < x < 4.20000000000000031e-27Initial program 93.6%
distribute-rgt-out--93.6%
Simplified93.6%
Taylor expanded in x around 0 79.8%
neg-mul-179.8%
Simplified79.8%
Final simplification75.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 (or (<= x -250.0) (not (<= x 3e+118)))
(* 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 <= -250.0) || !(x <= 3e+118)) {
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 <= (-250.0d0)) .or. (.not. (x <= 3d+118))) 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 <= -250.0) || !(x <= 3e+118)) {
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 <= -250.0) or not (x <= 3e+118): 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 <= -250.0) || !(x <= 3e+118)) tmp = Float64(t * Float64(y_m * x)); else tmp = Float64(z * Float64(y_m * 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 <= -250.0) || ~((x <= 3e+118)))
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, -250.0], N[Not[LessEqual[x, 3e+118]], $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 -250 \lor \neg \left(x \leq 3 \cdot 10^{+118}\right):\\
\;\;\;\;t \cdot \left(y\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y\_m \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if x < -250 or 3e118 < x Initial program 85.2%
distribute-rgt-out--90.9%
Simplified90.9%
Taylor expanded in x around inf 76.4%
if -250 < x < 3e118Initial program 92.1%
*-commutative92.1%
distribute-rgt-out--93.4%
associate-*r*96.0%
*-commutative96.0%
Simplified96.0%
Taylor expanded in x around 0 77.2%
neg-mul-175.2%
Simplified77.2%
Final simplification76.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 -1.6e-86) (not (<= x 3.5e-27)))
(* 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.6e-86) || !(x <= 3.5e-27)) {
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.6d-86)) .or. (.not. (x <= 3.5d-27))) 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.6e-86) || !(x <= 3.5e-27)) {
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.6e-86) or not (x <= 3.5e-27): 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.6e-86) || !(x <= 3.5e-27)) 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 <= -1.6e-86) || ~((x <= 3.5e-27)))
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.6e-86], N[Not[LessEqual[x, 3.5e-27]], $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.6 \cdot 10^{-86} \lor \neg \left(x \leq 3.5 \cdot 10^{-27}\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 < -1.60000000000000003e-86 or 3.5000000000000001e-27 < x Initial program 86.6%
distribute-rgt-out--92.1%
Simplified92.1%
Taylor expanded in x around inf 70.2%
if -1.60000000000000003e-86 < x < 3.5000000000000001e-27Initial program 92.7%
distribute-rgt-out--92.7%
associate-*l*94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in x around 0 82.3%
mul-1-neg82.3%
distribute-rgt-neg-out82.3%
Simplified82.3%
Final simplification75.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 (<= z -5e+141) (* 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 <= -5e+141) {
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 <= (-5d+141)) 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 <= -5e+141) {
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 <= -5e+141: 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 <= -5e+141) 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 <= -5e+141)
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[LessEqual[z, -5e+141], 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 -5 \cdot 10^{+141}:\\
\;\;\;\;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 < -5.00000000000000025e141Initial program 85.3%
distribute-rgt-out--93.0%
Simplified93.0%
Taylor expanded in x around 0 90.9%
neg-mul-190.9%
Simplified90.9%
if -5.00000000000000025e141 < z Initial program 89.7%
distribute-rgt-out--92.3%
associate-*l*93.1%
*-commutative93.1%
Simplified93.1%
Final simplification92.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 (* (* 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 89.2%
distribute-rgt-out--92.4%
Simplified92.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 (* 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) {
return y_s * (x * (y_m * 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 * (x * (y_m * 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 * (x * (y_m * 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 * (x * (y_m * 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(x * Float64(y_m * 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 * (x * (y_m * 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[(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 \left(x \cdot \left(y\_m \cdot t\right)\right)
\end{array}
Initial program 89.2%
*-commutative89.2%
distribute-rgt-out--92.4%
associate-*r*95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in x around inf 57.3%
Final simplification57.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 (* 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 89.2%
distribute-rgt-out--92.4%
associate-*l*91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in x around inf 53.5%
associate-*r*55.2%
*-commutative55.2%
Simplified55.2%
Final simplification55.2%
(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 2024185
(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))