
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (let* ((t_1 (/ (- (* x y) (* z t)) a_m))) (* a_s (if (<= t_1 2e+296) t_1 (/ z (/ a_m (- (/ (* x y) z) t)))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = ((x * y) - (z * t)) / a_m;
double tmp;
if (t_1 <= 2e+296) {
tmp = t_1;
} else {
tmp = z / (a_m / (((x * y) / z) - t));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: t_1
real(8) :: tmp
t_1 = ((x * y) - (z * t)) / a_m
if (t_1 <= 2d+296) then
tmp = t_1
else
tmp = z / (a_m / (((x * y) / z) - t))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = ((x * y) - (z * t)) / a_m;
double tmp;
if (t_1 <= 2e+296) {
tmp = t_1;
} else {
tmp = z / (a_m / (((x * y) / z) - t));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = ((x * y) - (z * t)) / a_m tmp = 0 if t_1 <= 2e+296: tmp = t_1 else: tmp = z / (a_m / (((x * y) / z) - t)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m) tmp = 0.0 if (t_1 <= 2e+296) tmp = t_1; else tmp = Float64(z / Float64(a_m / Float64(Float64(Float64(x * y) / z) - t))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
t_1 = ((x * y) - (z * t)) / a_m;
tmp = 0.0;
if (t_1 <= 2e+296)
tmp = t_1;
else
tmp = z / (a_m / (((x * y) / z) - t));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 2e+296], t$95$1, N[(z / N[(a$95$m / N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{a\_m}{\frac{x \cdot y}{z} - t}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 1.99999999999999996e296Initial program 97.0%
if 1.99999999999999996e296 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 74.0%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6474.2%
Simplified74.2%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6482.3%
Applied egg-rr82.3%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6482.4%
Applied egg-rr82.4%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (let* ((t_1 (/ (- (* x y) (* z t)) a_m))) (* a_s (if (<= t_1 2e+288) t_1 (* (- (/ (* x y) z) t) (/ z a_m))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = ((x * y) - (z * t)) / a_m;
double tmp;
if (t_1 <= 2e+288) {
tmp = t_1;
} else {
tmp = (((x * y) / z) - t) * (z / a_m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: t_1
real(8) :: tmp
t_1 = ((x * y) - (z * t)) / a_m
if (t_1 <= 2d+288) then
tmp = t_1
else
tmp = (((x * y) / z) - t) * (z / a_m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = ((x * y) - (z * t)) / a_m;
double tmp;
if (t_1 <= 2e+288) {
tmp = t_1;
} else {
tmp = (((x * y) / z) - t) * (z / a_m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = ((x * y) - (z * t)) / a_m tmp = 0 if t_1 <= 2e+288: tmp = t_1 else: tmp = (((x * y) / z) - t) * (z / a_m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m) tmp = 0.0 if (t_1 <= 2e+288) tmp = t_1; else tmp = Float64(Float64(Float64(Float64(x * y) / z) - t) * Float64(z / a_m)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
t_1 = ((x * y) - (z * t)) / a_m;
tmp = 0.0;
if (t_1 <= 2e+288)
tmp = t_1;
else
tmp = (((x * y) / z) - t) * (z / a_m);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 2e+288], t$95$1, N[(N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $MachinePrecision] * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+288}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x \cdot y}{z} - t\right) \cdot \frac{z}{a\_m}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 2e288Initial program 97.0%
if 2e288 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 74.0%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6474.2%
Simplified74.2%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6484.3%
Applied egg-rr84.3%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* z t) -1e-68)
(* (/ z a_m) (- 0.0 t))
(if (<= (* z t) 5e-35) (/ (* x y) a_m) (- 0.0 (/ (* z t) a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((z * t) <= -1e-68) {
tmp = (z / a_m) * (0.0 - t);
} else if ((z * t) <= 5e-35) {
tmp = (x * y) / a_m;
} else {
tmp = 0.0 - ((z * t) / a_m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: tmp
if ((z * t) <= (-1d-68)) then
tmp = (z / a_m) * (0.0d0 - t)
else if ((z * t) <= 5d-35) then
tmp = (x * y) / a_m
else
tmp = 0.0d0 - ((z * t) / a_m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((z * t) <= -1e-68) {
tmp = (z / a_m) * (0.0 - t);
} else if ((z * t) <= 5e-35) {
tmp = (x * y) / a_m;
} else {
tmp = 0.0 - ((z * t) / a_m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (z * t) <= -1e-68: tmp = (z / a_m) * (0.0 - t) elif (z * t) <= 5e-35: tmp = (x * y) / a_m else: tmp = 0.0 - ((z * t) / a_m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(z * t) <= -1e-68) tmp = Float64(Float64(z / a_m) * Float64(0.0 - t)); elseif (Float64(z * t) <= 5e-35) tmp = Float64(Float64(x * y) / a_m); else tmp = Float64(0.0 - Float64(Float64(z * t) / a_m)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((z * t) <= -1e-68)
tmp = (z / a_m) * (0.0 - t);
elseif ((z * t) <= 5e-35)
tmp = (x * y) / a_m;
else
tmp = 0.0 - ((z * t) / a_m);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(z * t), $MachinePrecision], -1e-68], N[(N[(z / a$95$m), $MachinePrecision] * N[(0.0 - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-35], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], N[(0.0 - N[(N[(z * t), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-68}:\\
\;\;\;\;\frac{z}{a\_m} \cdot \left(0 - t\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;0 - \frac{z \cdot t}{a\_m}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000007e-68Initial program 86.2%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6486.1%
Applied egg-rr86.1%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6461.2%
Simplified61.2%
sub0-negN/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-neg-outN/A
un-div-invN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6461.2%
Applied egg-rr61.2%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6463.0%
Applied egg-rr63.0%
if -1.00000000000000007e-68 < (*.f64 z t) < 4.99999999999999964e-35Initial program 97.4%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6488.3%
Simplified88.3%
if 4.99999999999999964e-35 < (*.f64 z t) Initial program 90.2%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6490.2%
Applied egg-rr90.2%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6480.8%
Simplified80.8%
sub0-negN/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-neg-outN/A
un-div-invN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6480.8%
Applied egg-rr80.8%
Final simplification79.6%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (let* ((t_1 (* (/ z a_m) (- 0.0 t)))) (* a_s (if (<= z -3.4e+107) t_1 (if (<= z 1.6e-145) (/ (* x y) a_m) t_1)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = (z / a_m) * (0.0 - t);
double tmp;
if (z <= -3.4e+107) {
tmp = t_1;
} else if (z <= 1.6e-145) {
tmp = (x * y) / a_m;
} else {
tmp = t_1;
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: t_1
real(8) :: tmp
t_1 = (z / a_m) * (0.0d0 - t)
if (z <= (-3.4d+107)) then
tmp = t_1
else if (z <= 1.6d-145) then
tmp = (x * y) / a_m
else
tmp = t_1
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = (z / a_m) * (0.0 - t);
double tmp;
if (z <= -3.4e+107) {
tmp = t_1;
} else if (z <= 1.6e-145) {
tmp = (x * y) / a_m;
} else {
tmp = t_1;
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = (z / a_m) * (0.0 - t) tmp = 0 if z <= -3.4e+107: tmp = t_1 elif z <= 1.6e-145: tmp = (x * y) / a_m else: tmp = t_1 return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(Float64(z / a_m) * Float64(0.0 - t)) tmp = 0.0 if (z <= -3.4e+107) tmp = t_1; elseif (z <= 1.6e-145) tmp = Float64(Float64(x * y) / a_m); else tmp = t_1; end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
t_1 = (z / a_m) * (0.0 - t);
tmp = 0.0;
if (z <= -3.4e+107)
tmp = t_1;
elseif (z <= 1.6e-145)
tmp = (x * y) / a_m;
else
tmp = t_1;
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(N[(z / a$95$m), $MachinePrecision] * N[(0.0 - t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[z, -3.4e+107], t$95$1, If[LessEqual[z, 1.6e-145], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \frac{z}{a\_m} \cdot \left(0 - t\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+107}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-145}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -3.3999999999999997e107 or 1.60000000000000004e-145 < z Initial program 86.7%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6486.6%
Applied egg-rr86.6%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6458.1%
Simplified58.1%
sub0-negN/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-neg-outN/A
un-div-invN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6458.1%
Applied egg-rr58.1%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6462.5%
Applied egg-rr62.5%
if -3.3999999999999997e107 < z < 1.60000000000000004e-145Initial program 97.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6472.2%
Simplified72.2%
Final simplification67.7%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* z t) -1e+234)
(- 0.0 (/ z (/ a_m t)))
(/ (- (* x y) (* z t)) a_m))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((z * t) <= -1e+234) {
tmp = 0.0 - (z / (a_m / t));
} else {
tmp = ((x * y) - (z * t)) / a_m;
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: tmp
if ((z * t) <= (-1d+234)) then
tmp = 0.0d0 - (z / (a_m / t))
else
tmp = ((x * y) - (z * t)) / a_m
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((z * t) <= -1e+234) {
tmp = 0.0 - (z / (a_m / t));
} else {
tmp = ((x * y) - (z * t)) / a_m;
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (z * t) <= -1e+234: tmp = 0.0 - (z / (a_m / t)) else: tmp = ((x * y) - (z * t)) / a_m return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(z * t) <= -1e+234) tmp = Float64(0.0 - Float64(z / Float64(a_m / t))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((z * t) <= -1e+234)
tmp = 0.0 - (z / (a_m / t));
else
tmp = ((x * y) - (z * t)) / a_m;
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(z * t), $MachinePrecision], -1e+234], N[(0.0 - N[(z / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+234}:\\
\;\;\;\;0 - \frac{z}{\frac{a\_m}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000002e234Initial program 58.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6458.6%
Applied egg-rr58.6%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6458.6%
Simplified58.6%
sub0-negN/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-neg-outN/A
un-div-invN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6458.5%
Applied egg-rr58.5%
distribute-neg-fracN/A
distribute-rgt-neg-inN/A
sub0-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.9%
Applied egg-rr99.9%
if -1.00000000000000002e234 < (*.f64 z t) Initial program 94.9%
Final simplification95.2%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= x -6e+54) (* x (/ y a_m)) (/ (* x y) a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (x <= -6e+54) {
tmp = x * (y / a_m);
} else {
tmp = (x * y) / a_m;
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: tmp
if (x <= (-6d+54)) then
tmp = x * (y / a_m)
else
tmp = (x * y) / a_m
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (x <= -6e+54) {
tmp = x * (y / a_m);
} else {
tmp = (x * y) / a_m;
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if x <= -6e+54: tmp = x * (y / a_m) else: tmp = (x * y) / a_m return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (x <= -6e+54) tmp = Float64(x * Float64(y / a_m)); else tmp = Float64(Float64(x * y) / a_m); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (x <= -6e+54)
tmp = x * (y / a_m);
else
tmp = (x * y) / a_m;
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[x, -6e+54], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+54}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\end{array}
\end{array}
if x < -5.9999999999999998e54Initial program 86.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6467.1%
Simplified67.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6470.4%
Applied egg-rr70.4%
if -5.9999999999999998e54 < x Initial program 94.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6453.5%
Simplified53.5%
Final simplification57.2%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* x (/ y a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (x * (y / a_m));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
code = a_s * (x * (y / a_m))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (x * (y / a_m));
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): return a_s * (x * (y / a_m))
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) return Float64(a_s * Float64(x * Float64(y / a_m))) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
tmp = a_s * (x * (y / a_m));
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right)
\end{array}
Initial program 92.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6456.5%
Simplified56.5%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6455.8%
Applied egg-rr55.8%
Final simplification55.8%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* y (/ x a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (y * (x / a_m));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
code = a_s * (y * (x / a_m))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (y * (x / a_m));
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): return a_s * (y * (x / a_m))
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) return Float64(a_s * Float64(y * Float64(x / a_m))) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
tmp = a_s * (y * (x / a_m));
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right)
\end{array}
Initial program 92.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6456.5%
Simplified56.5%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6453.3%
Applied egg-rr53.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024161
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))