
(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}
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s x y z t_m) :precision binary64 (* t_s (if (<= t_m 2.9e+56) (* y (* (- x z) t_m)) (* (- x z) (* y t_m)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 2.9e+56) {
tmp = y * ((x - z) * t_m);
} else {
tmp = (x - z) * (y * t_m);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if (t_m <= 2.9d+56) then
tmp = y * ((x - z) * t_m)
else
tmp = (x - z) * (y * t_m)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 2.9e+56) {
tmp = y * ((x - z) * t_m);
} else {
tmp = (x - z) * (y * t_m);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if t_m <= 2.9e+56: tmp = y * ((x - z) * t_m) else: tmp = (x - z) * (y * t_m) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if (t_m <= 2.9e+56) tmp = Float64(y * Float64(Float64(x - z) * t_m)); else tmp = Float64(Float64(x - z) * Float64(y * t_m)); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if (t_m <= 2.9e+56)
tmp = y * ((x - z) * t_m);
else
tmp = (x - z) * (y * t_m);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 2.9e+56], N[(y * N[(N[(x - z), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 2.9 \cdot 10^{+56}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\_m\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\_m\right)\\
\end{array}
\end{array}
if t < 2.90000000000000007e56Initial program 93.9%
distribute-rgt-out--94.0%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
if 2.90000000000000007e56 < t Initial program 93.8%
*-commutative93.8%
distribute-rgt-out--93.8%
associate-*r*97.8%
*-commutative97.8%
Simplified97.8%
Final simplification95.4%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s x y z t_m)
:precision binary64
(*
t_s
(if (or (<= x -0.00092) (not (<= x 2e+79)))
(* t_m (* y x))
(* t_m (* y (- z))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if ((x <= -0.00092) || !(x <= 2e+79)) {
tmp = t_m * (y * x);
} else {
tmp = t_m * (y * -z);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((x <= (-0.00092d0)) .or. (.not. (x <= 2d+79))) then
tmp = t_m * (y * x)
else
tmp = t_m * (y * -z)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if ((x <= -0.00092) || !(x <= 2e+79)) {
tmp = t_m * (y * x);
} else {
tmp = t_m * (y * -z);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if (x <= -0.00092) or not (x <= 2e+79): tmp = t_m * (y * x) else: tmp = t_m * (y * -z) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if ((x <= -0.00092) || !(x <= 2e+79)) tmp = Float64(t_m * Float64(y * x)); else tmp = Float64(t_m * Float64(y * Float64(-z))); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if ((x <= -0.00092) || ~((x <= 2e+79)))
tmp = t_m * (y * x);
else
tmp = t_m * (y * -z);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[x, -0.00092], N[Not[LessEqual[x, 2e+79]], $MachinePrecision]], N[(t$95$m * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(t$95$m * N[(y * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -0.00092 \lor \neg \left(x \leq 2 \cdot 10^{+79}\right):\\
\;\;\;\;t\_m \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_m \cdot \left(y \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if x < -9.2000000000000003e-4 or 1.99999999999999993e79 < x Initial program 93.2%
distribute-rgt-out--93.3%
Simplified93.3%
Taylor expanded in x around inf 82.7%
if -9.2000000000000003e-4 < x < 1.99999999999999993e79Initial program 94.4%
distribute-rgt-out--94.4%
Simplified94.4%
Taylor expanded in x around 0 78.1%
neg-mul-178.1%
Simplified78.1%
Final simplification79.9%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s x y z t_m)
:precision binary64
(*
t_s
(if (or (<= x -2.2e-43) (not (<= x 1.8e+79)))
(* t_m (* y x))
(* z (* y (- t_m))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if ((x <= -2.2e-43) || !(x <= 1.8e+79)) {
tmp = t_m * (y * x);
} else {
tmp = z * (y * -t_m);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((x <= (-2.2d-43)) .or. (.not. (x <= 1.8d+79))) then
tmp = t_m * (y * x)
else
tmp = z * (y * -t_m)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if ((x <= -2.2e-43) || !(x <= 1.8e+79)) {
tmp = t_m * (y * x);
} else {
tmp = z * (y * -t_m);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if (x <= -2.2e-43) or not (x <= 1.8e+79): tmp = t_m * (y * x) else: tmp = z * (y * -t_m) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if ((x <= -2.2e-43) || !(x <= 1.8e+79)) tmp = Float64(t_m * Float64(y * x)); else tmp = Float64(z * Float64(y * Float64(-t_m))); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if ((x <= -2.2e-43) || ~((x <= 1.8e+79)))
tmp = t_m * (y * x);
else
tmp = z * (y * -t_m);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[x, -2.2e-43], N[Not[LessEqual[x, 1.8e+79]], $MachinePrecision]], N[(t$95$m * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * (-t$95$m)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-43} \lor \neg \left(x \leq 1.8 \cdot 10^{+79}\right):\\
\;\;\;\;t\_m \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-t\_m\right)\right)\\
\end{array}
\end{array}
if x < -2.19999999999999997e-43 or 1.8e79 < x Initial program 93.8%
distribute-rgt-out--93.9%
Simplified93.9%
Taylor expanded in x around inf 79.7%
if -2.19999999999999997e-43 < x < 1.8e79Initial program 94.0%
*-commutative94.0%
distribute-rgt-out--94.0%
associate-*r*95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in x around 0 80.2%
neg-mul-179.6%
Simplified80.2%
Final simplification80.0%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s x y z t_m)
:precision binary64
(*
t_s
(if (or (<= x -1.2e-43) (not (<= x 4.8e+79)))
(* t_m (* y x))
(* y (* z (- t_m))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if ((x <= -1.2e-43) || !(x <= 4.8e+79)) {
tmp = t_m * (y * x);
} else {
tmp = y * (z * -t_m);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((x <= (-1.2d-43)) .or. (.not. (x <= 4.8d+79))) then
tmp = t_m * (y * x)
else
tmp = y * (z * -t_m)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if ((x <= -1.2e-43) || !(x <= 4.8e+79)) {
tmp = t_m * (y * x);
} else {
tmp = y * (z * -t_m);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if (x <= -1.2e-43) or not (x <= 4.8e+79): tmp = t_m * (y * x) else: tmp = y * (z * -t_m) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if ((x <= -1.2e-43) || !(x <= 4.8e+79)) tmp = Float64(t_m * Float64(y * x)); else tmp = Float64(y * Float64(z * Float64(-t_m))); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if ((x <= -1.2e-43) || ~((x <= 4.8e+79)))
tmp = t_m * (y * x);
else
tmp = y * (z * -t_m);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[x, -1.2e-43], N[Not[LessEqual[x, 4.8e+79]], $MachinePrecision]], N[(t$95$m * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * (-t$95$m)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-43} \lor \neg \left(x \leq 4.8 \cdot 10^{+79}\right):\\
\;\;\;\;t\_m \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-t\_m\right)\right)\\
\end{array}
\end{array}
if x < -1.2000000000000001e-43 or 4.79999999999999971e79 < x Initial program 93.8%
distribute-rgt-out--93.9%
Simplified93.9%
Taylor expanded in x around inf 79.7%
if -1.2000000000000001e-43 < x < 4.79999999999999971e79Initial program 94.0%
distribute-rgt-out--94.0%
associate-*l*93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in x around 0 77.6%
mul-1-neg77.6%
distribute-rgt-neg-out77.6%
Simplified77.6%
Final simplification78.5%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s x y z t_m) :precision binary64 (* t_s (if (<= z 2.65e+97) (* y (* (- x z) t_m)) (* t_m (* y (- z))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (z <= 2.65e+97) {
tmp = y * ((x - z) * t_m);
} else {
tmp = t_m * (y * -z);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if (z <= 2.65d+97) then
tmp = y * ((x - z) * t_m)
else
tmp = t_m * (y * -z)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (z <= 2.65e+97) {
tmp = y * ((x - z) * t_m);
} else {
tmp = t_m * (y * -z);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if z <= 2.65e+97: tmp = y * ((x - z) * t_m) else: tmp = t_m * (y * -z) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if (z <= 2.65e+97) tmp = Float64(y * Float64(Float64(x - z) * t_m)); else tmp = Float64(t_m * Float64(y * Float64(-z))); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if (z <= 2.65e+97)
tmp = y * ((x - z) * t_m);
else
tmp = t_m * (y * -z);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[z, 2.65e+97], N[(y * N[(N[(x - z), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], N[(t$95$m * N[(y * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2.65 \cdot 10^{+97}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\_m\right)\\
\mathbf{else}:\\
\;\;\;\;t\_m \cdot \left(y \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if z < 2.6500000000000001e97Initial program 95.3%
distribute-rgt-out--95.4%
associate-*l*96.2%
*-commutative96.2%
Simplified96.2%
if 2.6500000000000001e97 < z Initial program 86.8%
distribute-rgt-out--86.9%
Simplified86.9%
Taylor expanded in x around 0 78.0%
neg-mul-178.0%
Simplified78.0%
Final simplification93.2%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s x y z t_m) :precision binary64 (* t_s (if (<= t_m 1.65e+68) (* t_m (* y x)) (* x (* y t_m)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 1.65e+68) {
tmp = t_m * (y * x);
} else {
tmp = x * (y * t_m);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if (t_m <= 1.65d+68) then
tmp = t_m * (y * x)
else
tmp = x * (y * t_m)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 1.65e+68) {
tmp = t_m * (y * x);
} else {
tmp = x * (y * t_m);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if t_m <= 1.65e+68: tmp = t_m * (y * x) else: tmp = x * (y * t_m) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if (t_m <= 1.65e+68) tmp = Float64(t_m * Float64(y * x)); else tmp = Float64(x * Float64(y * t_m)); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if (t_m <= 1.65e+68)
tmp = t_m * (y * x);
else
tmp = x * (y * t_m);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 1.65e+68], N[(t$95$m * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 1.65 \cdot 10^{+68}:\\
\;\;\;\;t\_m \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot t\_m\right)\\
\end{array}
\end{array}
if t < 1.65e68Initial program 94.0%
distribute-rgt-out--94.0%
Simplified94.0%
Taylor expanded in x around inf 57.6%
if 1.65e68 < t Initial program 93.7%
*-commutative93.7%
distribute-rgt-out--93.7%
associate-*r*97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in x around inf 50.1%
Final simplification56.2%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s x y z t_m) :precision binary64 (* t_s (if (<= t_m 4e+78) (* y (* x t_m)) (* x (* y t_m)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 4e+78) {
tmp = y * (x * t_m);
} else {
tmp = x * (y * t_m);
}
return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if (t_m <= 4d+78) then
tmp = y * (x * t_m)
else
tmp = x * (y * t_m)
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 4e+78) {
tmp = y * (x * t_m);
} else {
tmp = x * (y * t_m);
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): tmp = 0 if t_m <= 4e+78: tmp = y * (x * t_m) else: tmp = x * (y * t_m) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) tmp = 0.0 if (t_m <= 4e+78) tmp = Float64(y * Float64(x * t_m)); else tmp = Float64(x * Float64(y * t_m)); end return Float64(t_s * tmp) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp_2 = code(t_s, x, y, z, t_m)
tmp = 0.0;
if (t_m <= 4e+78)
tmp = y * (x * t_m);
else
tmp = x * (y * t_m);
end
tmp_2 = t_s * tmp;
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 4e+78], N[(y * N[(x * t$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 4 \cdot 10^{+78}:\\
\;\;\;\;y \cdot \left(x \cdot t\_m\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot t\_m\right)\\
\end{array}
\end{array}
if t < 4.00000000000000003e78Initial program 94.0%
distribute-rgt-out--94.0%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in x around inf 57.6%
associate-*r*58.9%
*-commutative58.9%
Simplified58.9%
if 4.00000000000000003e78 < t Initial program 93.7%
*-commutative93.7%
distribute-rgt-out--93.7%
associate-*r*97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in x around inf 50.1%
Final simplification57.3%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s x y z t_m) :precision binary64 (* t_s (* (* y (- x z)) t_m)))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
return t_s * ((y * (x - z)) * t_m);
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = t_s * ((y * (x - z)) * t_m)
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
return t_s * ((y * (x - z)) * t_m);
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): return t_s * ((y * (x - z)) * t_m)
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) return Float64(t_s * Float64(Float64(y * Float64(x - z)) * t_m)) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp = code(t_s, x, y, z, t_m)
tmp = t_s * ((y * (x - z)) * t_m);
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * N[(N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \left(\left(y \cdot \left(x - z\right)\right) \cdot t\_m\right)
\end{array}
Initial program 93.9%
distribute-rgt-out--94.0%
Simplified94.0%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function. (FPCore (t_s x y z t_m) :precision binary64 (* t_s (* y (* x t_m))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
assert(x < y && y < z && z < t_m);
double code(double t_s, double x, double y, double z, double t_m) {
return t_s * (y * (x * t_m));
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
NOTE: x, y, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, x, y, z, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = t_s * (y * (x * t_m))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
assert x < y && y < z && z < t_m;
public static double code(double t_s, double x, double y, double z, double t_m) {
return t_s * (y * (x * t_m));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) [x, y, z, t_m] = sort([x, y, z, t_m]) def code(t_s, x, y, z, t_m): return t_s * (y * (x * t_m))
t\_m = abs(t) t\_s = copysign(1.0, t) x, y, z, t_m = sort([x, y, z, t_m]) function code(t_s, x, y, z, t_m) return Float64(t_s * Float64(y * Float64(x * t_m))) end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
x, y, z, t_m = num2cell(sort([x, y, z, t_m])){:}
function tmp = code(t_s, x, y, z, t_m)
tmp = t_s * (y * (x * t_m));
end
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, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * N[(y * N[(x * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y, z, t_m] = \mathsf{sort}([x, y, z, t_m])\\
\\
t\_s \cdot \left(y \cdot \left(x \cdot t\_m\right)\right)
\end{array}
Initial program 93.9%
distribute-rgt-out--94.0%
associate-*l*93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in x around inf 55.5%
associate-*r*57.3%
*-commutative57.3%
Simplified57.3%
Final simplification57.3%
(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 2024157
(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))