
(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * 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) / sqrt(((z * z) - (t * a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * 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) / sqrt(((z * z) - (t * a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ a z) (/ t z))))
(if (<= z -7.2e+22)
(/ (* x y) (fma 0.5 t_1 -1.0))
(if (<= z 2.7e-59)
(* y (/ (* z x) (sqrt (- (* z z) (* a t)))))
(/ (* x y) (sqrt (- 1.0 t_1)))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (a / z) * (t / z);
double tmp;
if (z <= -7.2e+22) {
tmp = (x * y) / fma(0.5, t_1, -1.0);
} else if (z <= 2.7e-59) {
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
} else {
tmp = (x * y) / sqrt((1.0 - t_1));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(a / z) * Float64(t / z)) tmp = 0.0 if (z <= -7.2e+22) tmp = Float64(Float64(x * y) / fma(0.5, t_1, -1.0)); elseif (z <= 2.7e-59) tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(Float64(z * z) - Float64(a * t))))); else tmp = Float64(Float64(x * y) / sqrt(Float64(1.0 - t_1))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+22], N[(N[(x * y), $MachinePrecision] / N[(0.5 * t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e-59], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := \frac{a}{z} \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+22}:\\
\;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(0.5, t_1, -1\right)}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-59}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{\sqrt{1 - t_1}}\\
\end{array}
\end{array}
if z < -7.2e22Initial program 35.7%
associate-/l*37.3%
Simplified37.3%
Taylor expanded in z around -inf 88.3%
fma-neg88.3%
unpow288.3%
times-frac95.0%
metadata-eval95.0%
Simplified95.0%
if -7.2e22 < z < 2.6999999999999999e-59Initial program 80.4%
*-commutative80.4%
associate-*l*81.3%
associate-*r/85.8%
Simplified85.8%
if 2.6999999999999999e-59 < z Initial program 51.8%
associate-/l*53.2%
Simplified53.2%
add-sqr-sqrt53.2%
sqrt-unprod53.2%
frac-times45.2%
add-sqr-sqrt45.2%
Applied egg-rr45.2%
div-sub45.2%
*-inverses93.5%
*-commutative93.5%
times-frac97.9%
Simplified97.9%
Final simplification92.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= z -9e+22)
(- (* x y))
(if (<= z 5e+83)
(* y (/ (* z x) (sqrt (- (* z z) (* a t)))))
(/ (* x y) (+ 1.0 (* (* (/ a z) (/ t z)) -0.5))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+22) {
tmp = -(x * y);
} else if (z <= 5e+83) {
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-9d+22)) then
tmp = -(x * y)
else if (z <= 5d+83) then
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))))
else
tmp = (x * y) / (1.0d0 + (((a / z) * (t / z)) * (-0.5d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+22) {
tmp = -(x * y);
} else if (z <= 5e+83) {
tmp = y * ((z * x) / Math.sqrt(((z * z) - (a * t))));
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -9e+22: tmp = -(x * y) elif z <= 5e+83: tmp = y * ((z * x) / math.sqrt(((z * z) - (a * t)))) else: tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e+22) tmp = Float64(-Float64(x * y)); elseif (z <= 5e+83) tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(Float64(z * z) - Float64(a * t))))); else tmp = Float64(Float64(x * y) / Float64(1.0 + Float64(Float64(Float64(a / z) * Float64(t / z)) * -0.5))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -9e+22)
tmp = -(x * y);
elseif (z <= 5e+83)
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
else
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e+22], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 5e+83], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(1.0 + N[(N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+22}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{1 + \left(\frac{a}{z} \cdot \frac{t}{z}\right) \cdot -0.5}\\
\end{array}
\end{array}
if z < -8.9999999999999996e22Initial program 35.7%
*-commutative35.7%
associate-*l*34.2%
associate-*r/35.7%
Simplified35.7%
Taylor expanded in z around -inf 94.5%
neg-mul-194.5%
Simplified94.5%
if -8.9999999999999996e22 < z < 5.00000000000000029e83Initial program 82.9%
*-commutative82.9%
associate-*l*83.6%
associate-*r/86.9%
Simplified86.9%
if 5.00000000000000029e83 < z Initial program 32.2%
associate-/l*32.6%
Simplified32.6%
Taylor expanded in z around inf 93.4%
unpow293.4%
Simplified93.4%
*-commutative93.4%
times-frac97.0%
Applied egg-rr97.0%
Final simplification91.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= z -7.8e+22)
(- (* x y))
(if (<= z 1.8e-61)
(* y (/ (* z x) (sqrt (- (* z z) (* a t)))))
(/ (* x y) (sqrt (- 1.0 (* (/ a z) (/ t z))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.8e+22) {
tmp = -(x * y);
} else if (z <= 1.8e-61) {
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
} else {
tmp = (x * y) / sqrt((1.0 - ((a / z) * (t / z))));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-7.8d+22)) then
tmp = -(x * y)
else if (z <= 1.8d-61) then
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))))
else
tmp = (x * y) / sqrt((1.0d0 - ((a / z) * (t / z))))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.8e+22) {
tmp = -(x * y);
} else if (z <= 1.8e-61) {
tmp = y * ((z * x) / Math.sqrt(((z * z) - (a * t))));
} else {
tmp = (x * y) / Math.sqrt((1.0 - ((a / z) * (t / z))));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -7.8e+22: tmp = -(x * y) elif z <= 1.8e-61: tmp = y * ((z * x) / math.sqrt(((z * z) - (a * t)))) else: tmp = (x * y) / math.sqrt((1.0 - ((a / z) * (t / z)))) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.8e+22) tmp = Float64(-Float64(x * y)); elseif (z <= 1.8e-61) tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(Float64(z * z) - Float64(a * t))))); else tmp = Float64(Float64(x * y) / sqrt(Float64(1.0 - Float64(Float64(a / z) * Float64(t / z))))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -7.8e+22)
tmp = -(x * y);
elseif (z <= 1.8e-61)
tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
else
tmp = (x * y) / sqrt((1.0 - ((a / z) * (t / z))));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.8e+22], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 1.8e-61], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+22}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-61}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\\
\end{array}
\end{array}
if z < -7.80000000000000042e22Initial program 35.7%
*-commutative35.7%
associate-*l*34.2%
associate-*r/35.7%
Simplified35.7%
Taylor expanded in z around -inf 94.5%
neg-mul-194.5%
Simplified94.5%
if -7.80000000000000042e22 < z < 1.80000000000000007e-61Initial program 80.4%
*-commutative80.4%
associate-*l*81.3%
associate-*r/85.8%
Simplified85.8%
if 1.80000000000000007e-61 < z Initial program 51.8%
associate-/l*53.2%
Simplified53.2%
add-sqr-sqrt53.2%
sqrt-unprod53.2%
frac-times45.2%
add-sqr-sqrt45.2%
Applied egg-rr45.2%
div-sub45.2%
*-inverses93.5%
*-commutative93.5%
times-frac97.9%
Simplified97.9%
Final simplification92.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.25e-156)
(- (* x y))
(if (<= z 1.12e-60)
(* y (/ (* z x) (sqrt (* a (- t)))))
(/ (* x y) (+ 1.0 (* (* (/ a z) (/ t z)) -0.5))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.25e-156) {
tmp = -(x * y);
} else if (z <= 1.12e-60) {
tmp = y * ((z * x) / sqrt((a * -t)));
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-1.25d-156)) then
tmp = -(x * y)
else if (z <= 1.12d-60) then
tmp = y * ((z * x) / sqrt((a * -t)))
else
tmp = (x * y) / (1.0d0 + (((a / z) * (t / z)) * (-0.5d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.25e-156) {
tmp = -(x * y);
} else if (z <= 1.12e-60) {
tmp = y * ((z * x) / Math.sqrt((a * -t)));
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.25e-156: tmp = -(x * y) elif z <= 1.12e-60: tmp = y * ((z * x) / math.sqrt((a * -t))) else: tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.25e-156) tmp = Float64(-Float64(x * y)); elseif (z <= 1.12e-60) tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(a * Float64(-t))))); else tmp = Float64(Float64(x * y) / Float64(1.0 + Float64(Float64(Float64(a / z) * Float64(t / z)) * -0.5))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.25e-156)
tmp = -(x * y);
elseif (z <= 1.12e-60)
tmp = y * ((z * x) / sqrt((a * -t)));
else
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.25e-156], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 1.12e-60], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(a * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(1.0 + N[(N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-156}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-60}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{a \cdot \left(-t\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{1 + \left(\frac{a}{z} \cdot \frac{t}{z}\right) \cdot -0.5}\\
\end{array}
\end{array}
if z < -1.25000000000000002e-156Initial program 53.8%
*-commutative53.8%
associate-*l*51.9%
associate-*r/54.6%
Simplified54.6%
Taylor expanded in z around -inf 87.3%
neg-mul-187.3%
Simplified87.3%
if -1.25000000000000002e-156 < z < 1.12e-60Initial program 73.5%
*-commutative73.5%
associate-*l*76.9%
associate-*r/81.1%
Simplified81.1%
Taylor expanded in z around 0 72.3%
associate-*r*72.3%
neg-mul-172.3%
Simplified72.3%
if 1.12e-60 < z Initial program 51.8%
associate-/l*53.2%
Simplified53.2%
Taylor expanded in z around inf 86.3%
unpow286.3%
Simplified86.3%
*-commutative86.3%
times-frac88.6%
Applied egg-rr88.6%
Final simplification84.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= z -2e-156)
(- (* x y))
(if (<= z 1.7e-29)
(/ (* x y) (/ (sqrt (* a (- t))) z))
(/ (* x y) (+ 1.0 (* (* (/ a z) (/ t z)) -0.5))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e-156) {
tmp = -(x * y);
} else if (z <= 1.7e-29) {
tmp = (x * y) / (sqrt((a * -t)) / z);
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-2d-156)) then
tmp = -(x * y)
else if (z <= 1.7d-29) then
tmp = (x * y) / (sqrt((a * -t)) / z)
else
tmp = (x * y) / (1.0d0 + (((a / z) * (t / z)) * (-0.5d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e-156) {
tmp = -(x * y);
} else if (z <= 1.7e-29) {
tmp = (x * y) / (Math.sqrt((a * -t)) / z);
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -2e-156: tmp = -(x * y) elif z <= 1.7e-29: tmp = (x * y) / (math.sqrt((a * -t)) / z) else: tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e-156) tmp = Float64(-Float64(x * y)); elseif (z <= 1.7e-29) tmp = Float64(Float64(x * y) / Float64(sqrt(Float64(a * Float64(-t))) / z)); else tmp = Float64(Float64(x * y) / Float64(1.0 + Float64(Float64(Float64(a / z) * Float64(t / z)) * -0.5))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -2e-156)
tmp = -(x * y);
elseif (z <= 1.7e-29)
tmp = (x * y) / (sqrt((a * -t)) / z);
else
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e-156], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 1.7e-29], N[(N[(x * y), $MachinePrecision] / N[(N[Sqrt[N[(a * (-t)), $MachinePrecision]], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(1.0 + N[(N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-156}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-29}:\\
\;\;\;\;\frac{x \cdot y}{\frac{\sqrt{a \cdot \left(-t\right)}}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{1 + \left(\frac{a}{z} \cdot \frac{t}{z}\right) \cdot -0.5}\\
\end{array}
\end{array}
if z < -2.00000000000000008e-156Initial program 53.8%
*-commutative53.8%
associate-*l*51.9%
associate-*r/54.6%
Simplified54.6%
Taylor expanded in z around -inf 87.3%
neg-mul-187.3%
Simplified87.3%
if -2.00000000000000008e-156 < z < 1.69999999999999986e-29Initial program 74.5%
associate-/l*82.0%
Simplified82.0%
Taylor expanded in z around 0 72.3%
associate-*r*70.2%
neg-mul-170.2%
Simplified72.3%
if 1.69999999999999986e-29 < z Initial program 49.5%
associate-/l*51.0%
Simplified51.0%
Taylor expanded in z around inf 88.7%
unpow288.7%
Simplified88.7%
*-commutative88.7%
times-frac91.2%
Applied egg-rr91.2%
Final simplification85.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -5.5e-134) (- (* x y)) (if (<= z 5e-128) (* y (/ (* z x) (+ z (* -0.5 (/ (* a t) z))))) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e-134) {
tmp = -(x * y);
} else if (z <= 5e-128) {
tmp = y * ((z * x) / (z + (-0.5 * ((a * t) / z))));
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-5.5d-134)) then
tmp = -(x * y)
else if (z <= 5d-128) then
tmp = y * ((z * x) / (z + ((-0.5d0) * ((a * t) / z))))
else
tmp = x * y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e-134) {
tmp = -(x * y);
} else if (z <= 5e-128) {
tmp = y * ((z * x) / (z + (-0.5 * ((a * t) / z))));
} else {
tmp = x * y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -5.5e-134: tmp = -(x * y) elif z <= 5e-128: tmp = y * ((z * x) / (z + (-0.5 * ((a * t) / z)))) else: tmp = x * y return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e-134) tmp = Float64(-Float64(x * y)); elseif (z <= 5e-128) tmp = Float64(y * Float64(Float64(z * x) / Float64(z + Float64(-0.5 * Float64(Float64(a * t) / z))))); else tmp = Float64(x * y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -5.5e-134)
tmp = -(x * y);
elseif (z <= 5e-128)
tmp = y * ((z * x) / (z + (-0.5 * ((a * t) / z))));
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e-134], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 5e-128], N[(y * N[(N[(z * x), $MachinePrecision] / N[(z + N[(-0.5 * N[(N[(a * t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-134}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-128}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{z + -0.5 \cdot \frac{a \cdot t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if z < -5.5000000000000002e-134Initial program 52.1%
*-commutative52.1%
associate-*l*50.2%
associate-*r/52.9%
Simplified52.9%
Taylor expanded in z around -inf 87.7%
neg-mul-187.7%
Simplified87.7%
if -5.5000000000000002e-134 < z < 5.0000000000000001e-128Initial program 74.1%
*-commutative74.1%
associate-*l*76.3%
associate-*r/77.4%
Simplified77.4%
Taylor expanded in z around inf 52.4%
if 5.0000000000000001e-128 < z Initial program 55.3%
*-commutative55.3%
associate-*l*56.1%
associate-*r/57.9%
Simplified57.9%
Taylor expanded in z around inf 84.2%
Final simplification80.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -9e-148) (- (* x y)) (if (<= z 5.8e-145) (* -2.0 (* (/ y a) (/ x (/ (/ t z) z)))) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e-148) {
tmp = -(x * y);
} else if (z <= 5.8e-145) {
tmp = -2.0 * ((y / a) * (x / ((t / z) / z)));
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-9d-148)) then
tmp = -(x * y)
else if (z <= 5.8d-145) then
tmp = (-2.0d0) * ((y / a) * (x / ((t / z) / z)))
else
tmp = x * y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e-148) {
tmp = -(x * y);
} else if (z <= 5.8e-145) {
tmp = -2.0 * ((y / a) * (x / ((t / z) / z)));
} else {
tmp = x * y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -9e-148: tmp = -(x * y) elif z <= 5.8e-145: tmp = -2.0 * ((y / a) * (x / ((t / z) / z))) else: tmp = x * y return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e-148) tmp = Float64(-Float64(x * y)); elseif (z <= 5.8e-145) tmp = Float64(-2.0 * Float64(Float64(y / a) * Float64(x / Float64(Float64(t / z) / z)))); else tmp = Float64(x * y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -9e-148)
tmp = -(x * y);
elseif (z <= 5.8e-145)
tmp = -2.0 * ((y / a) * (x / ((t / z) / z)));
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e-148], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 5.8e-145], N[(-2.0 * N[(N[(y / a), $MachinePrecision] * N[(x / N[(N[(t / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-148}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-145}:\\
\;\;\;\;-2 \cdot \left(\frac{y}{a} \cdot \frac{x}{\frac{\frac{t}{z}}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if z < -9.00000000000000029e-148Initial program 52.6%
*-commutative52.6%
associate-*l*50.6%
associate-*r/53.3%
Simplified53.3%
Taylor expanded in z around -inf 87.8%
neg-mul-187.8%
Simplified87.8%
if -9.00000000000000029e-148 < z < 5.79999999999999968e-145Initial program 72.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in z around inf 49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in a around inf 47.7%
associate-/l*47.7%
*-commutative47.7%
times-frac49.9%
unpow249.9%
associate-/r*49.9%
Simplified49.9%
Taylor expanded in y around 0 47.7%
times-frac49.8%
*-commutative49.8%
associate-/l*49.8%
unpow249.8%
associate-/r*49.9%
Simplified49.9%
if 5.79999999999999968e-145 < z Initial program 55.8%
*-commutative55.8%
associate-*l*56.5%
associate-*r/58.3%
Simplified58.3%
Taylor expanded in z around inf 84.0%
Final simplification80.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -1.08e-147) (- (* x y)) (if (<= z 3.5e-150) (* -2.0 (* (* z x) (/ y (* a (/ t z))))) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.08e-147) {
tmp = -(x * y);
} else if (z <= 3.5e-150) {
tmp = -2.0 * ((z * x) * (y / (a * (t / z))));
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-1.08d-147)) then
tmp = -(x * y)
else if (z <= 3.5d-150) then
tmp = (-2.0d0) * ((z * x) * (y / (a * (t / z))))
else
tmp = x * y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.08e-147) {
tmp = -(x * y);
} else if (z <= 3.5e-150) {
tmp = -2.0 * ((z * x) * (y / (a * (t / z))));
} else {
tmp = x * y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.08e-147: tmp = -(x * y) elif z <= 3.5e-150: tmp = -2.0 * ((z * x) * (y / (a * (t / z)))) else: tmp = x * y return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.08e-147) tmp = Float64(-Float64(x * y)); elseif (z <= 3.5e-150) tmp = Float64(-2.0 * Float64(Float64(z * x) * Float64(y / Float64(a * Float64(t / z))))); else tmp = Float64(x * y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.08e-147)
tmp = -(x * y);
elseif (z <= 3.5e-150)
tmp = -2.0 * ((z * x) * (y / (a * (t / z))));
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.08e-147], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 3.5e-150], N[(-2.0 * N[(N[(z * x), $MachinePrecision] * N[(y / N[(a * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{-147}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-150}:\\
\;\;\;\;-2 \cdot \left(\left(z \cdot x\right) \cdot \frac{y}{a \cdot \frac{t}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if z < -1.07999999999999995e-147Initial program 52.6%
*-commutative52.6%
associate-*l*50.6%
associate-*r/53.3%
Simplified53.3%
Taylor expanded in z around -inf 87.8%
neg-mul-187.8%
Simplified87.8%
if -1.07999999999999995e-147 < z < 3.4999999999999998e-150Initial program 72.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in z around inf 49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in a around inf 47.7%
associate-/l*47.7%
*-commutative47.7%
times-frac49.9%
unpow249.9%
associate-/r*49.9%
Simplified49.9%
frac-times50.2%
Applied egg-rr50.2%
associate-/r/50.2%
*-commutative50.2%
*-commutative50.2%
Applied egg-rr50.2%
if 3.4999999999999998e-150 < z Initial program 55.8%
*-commutative55.8%
associate-*l*56.5%
associate-*r/58.3%
Simplified58.3%
Taylor expanded in z around inf 84.0%
Final simplification80.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -1.05e-145) (- (* x y)) (if (<= z 3.7e-156) (* -2.0 (/ y (/ (* a (/ t z)) (* z x)))) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e-145) {
tmp = -(x * y);
} else if (z <= 3.7e-156) {
tmp = -2.0 * (y / ((a * (t / z)) / (z * x)));
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-1.05d-145)) then
tmp = -(x * y)
else if (z <= 3.7d-156) then
tmp = (-2.0d0) * (y / ((a * (t / z)) / (z * x)))
else
tmp = x * y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e-145) {
tmp = -(x * y);
} else if (z <= 3.7e-156) {
tmp = -2.0 * (y / ((a * (t / z)) / (z * x)));
} else {
tmp = x * y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.05e-145: tmp = -(x * y) elif z <= 3.7e-156: tmp = -2.0 * (y / ((a * (t / z)) / (z * x))) else: tmp = x * y return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e-145) tmp = Float64(-Float64(x * y)); elseif (z <= 3.7e-156) tmp = Float64(-2.0 * Float64(y / Float64(Float64(a * Float64(t / z)) / Float64(z * x)))); else tmp = Float64(x * y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.05e-145)
tmp = -(x * y);
elseif (z <= 3.7e-156)
tmp = -2.0 * (y / ((a * (t / z)) / (z * x)));
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e-145], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 3.7e-156], N[(-2.0 * N[(y / N[(N[(a * N[(t / z), $MachinePrecision]), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-145}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-156}:\\
\;\;\;\;-2 \cdot \frac{y}{\frac{a \cdot \frac{t}{z}}{z \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if z < -1.04999999999999996e-145Initial program 52.6%
*-commutative52.6%
associate-*l*50.6%
associate-*r/53.3%
Simplified53.3%
Taylor expanded in z around -inf 87.8%
neg-mul-187.8%
Simplified87.8%
if -1.04999999999999996e-145 < z < 3.7e-156Initial program 72.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in z around inf 49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in a around inf 47.7%
associate-/l*47.7%
*-commutative47.7%
times-frac49.9%
unpow249.9%
associate-/r*49.9%
Simplified49.9%
frac-times50.2%
Applied egg-rr50.2%
if 3.7e-156 < z Initial program 55.8%
*-commutative55.8%
associate-*l*56.5%
associate-*r/58.3%
Simplified58.3%
Taylor expanded in z around inf 84.0%
Final simplification80.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -1.6e-129) (- (* x y)) (/ (* x y) (+ 1.0 (* (* (/ a z) (/ t z)) -0.5)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e-129) {
tmp = -(x * y);
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-1.6d-129)) then
tmp = -(x * y)
else
tmp = (x * y) / (1.0d0 + (((a / z) * (t / z)) * (-0.5d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e-129) {
tmp = -(x * y);
} else {
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.6e-129: tmp = -(x * y) else: tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e-129) tmp = Float64(-Float64(x * y)); else tmp = Float64(Float64(x * y) / Float64(1.0 + Float64(Float64(Float64(a / z) * Float64(t / z)) * -0.5))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.6e-129)
tmp = -(x * y);
else
tmp = (x * y) / (1.0 + (((a / z) * (t / z)) * -0.5));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e-129], (-N[(x * y), $MachinePrecision]), N[(N[(x * y), $MachinePrecision] / N[(1.0 + N[(N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-129}:\\
\;\;\;\;-x \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{1 + \left(\frac{a}{z} \cdot \frac{t}{z}\right) \cdot -0.5}\\
\end{array}
\end{array}
if z < -1.6000000000000001e-129Initial program 52.1%
*-commutative52.1%
associate-*l*50.2%
associate-*r/52.9%
Simplified52.9%
Taylor expanded in z around -inf 87.7%
neg-mul-187.7%
Simplified87.7%
if -1.6000000000000001e-129 < z Initial program 61.0%
associate-/l*64.8%
Simplified64.8%
Taylor expanded in z around inf 73.4%
unpow273.4%
Simplified73.4%
*-commutative73.4%
times-frac74.9%
Applied egg-rr74.9%
Final simplification80.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -1.6e-196) (- (* x y)) (if (<= z 3.7e-162) (* y (/ (* z x) z)) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e-196) {
tmp = -(x * y);
} else if (z <= 3.7e-162) {
tmp = y * ((z * x) / z);
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-1.6d-196)) then
tmp = -(x * y)
else if (z <= 3.7d-162) then
tmp = y * ((z * x) / z)
else
tmp = x * y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e-196) {
tmp = -(x * y);
} else if (z <= 3.7e-162) {
tmp = y * ((z * x) / z);
} else {
tmp = x * y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.6e-196: tmp = -(x * y) elif z <= 3.7e-162: tmp = y * ((z * x) / z) else: tmp = x * y return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e-196) tmp = Float64(-Float64(x * y)); elseif (z <= 3.7e-162) tmp = Float64(y * Float64(Float64(z * x) / z)); else tmp = Float64(x * y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.6e-196)
tmp = -(x * y);
elseif (z <= 3.7e-162)
tmp = y * ((z * x) / z);
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e-196], (-N[(x * y), $MachinePrecision]), If[LessEqual[z, 3.7e-162], N[(y * N[(N[(z * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-196}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-162}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if z < -1.6e-196Initial program 53.7%
*-commutative53.7%
associate-*l*52.7%
associate-*r/55.2%
Simplified55.2%
Taylor expanded in z around -inf 83.2%
neg-mul-183.2%
Simplified83.2%
if -1.6e-196 < z < 3.7000000000000002e-162Initial program 76.4%
*-commutative76.4%
associate-*l*76.4%
associate-*r/77.9%
Simplified77.9%
Taylor expanded in z around inf 28.1%
if 3.7000000000000002e-162 < z Initial program 55.3%
*-commutative55.3%
associate-*l*56.1%
associate-*r/57.9%
Simplified57.9%
Taylor expanded in z around inf 83.2%
Final simplification76.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -5e-310) (- (* x y)) (* x y)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e-310) {
tmp = -(x * y);
} else {
tmp = x * y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) :: tmp
if (z <= (-5d-310)) then
tmp = -(x * y)
else
tmp = x * y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e-310) {
tmp = -(x * y);
} else {
tmp = x * y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -5e-310: tmp = -(x * y) else: tmp = x * y return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e-310) tmp = Float64(-Float64(x * y)); else tmp = Float64(x * y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -5e-310)
tmp = -(x * y);
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e-310], (-N[(x * y), $MachinePrecision]), N[(x * y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-x \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if z < -4.999999999999985e-310Initial program 55.1%
*-commutative55.1%
associate-*l*54.8%
associate-*r/57.5%
Simplified57.5%
Taylor expanded in z around -inf 76.5%
neg-mul-176.5%
Simplified76.5%
if -4.999999999999985e-310 < z Initial program 59.5%
*-commutative59.5%
associate-*l*59.4%
associate-*r/60.9%
Simplified60.9%
Taylor expanded in z around inf 71.6%
Final simplification74.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x y))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return x * y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return x * y;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return x * y
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(x * y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = x * y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x \cdot y
\end{array}
Initial program 57.2%
*-commutative57.2%
associate-*l*57.0%
associate-*r/59.1%
Simplified59.1%
Taylor expanded in z around inf 40.2%
Final simplification40.2%
(FPCore (x y z t a)
:precision binary64
(if (< z -3.1921305903852764e+46)
(- (* y x))
(if (< z 5.976268120920894e+90)
(/ (* x z) (/ (sqrt (- (* z z) (* a t))) y))
(* y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z < -3.1921305903852764e+46) {
tmp = -(y * x);
} else if (z < 5.976268120920894e+90) {
tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y);
} else {
tmp = y * x;
}
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) :: tmp
if (z < (-3.1921305903852764d+46)) then
tmp = -(y * x)
else if (z < 5.976268120920894d+90) then
tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z < -3.1921305903852764e+46) {
tmp = -(y * x);
} else if (z < 5.976268120920894e+90) {
tmp = (x * z) / (Math.sqrt(((z * z) - (a * t))) / y);
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z < -3.1921305903852764e+46: tmp = -(y * x) elif z < 5.976268120920894e+90: tmp = (x * z) / (math.sqrt(((z * z) - (a * t))) / y) else: tmp = y * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z < -3.1921305903852764e+46) tmp = Float64(-Float64(y * x)); elseif (z < 5.976268120920894e+90) tmp = Float64(Float64(x * z) / Float64(sqrt(Float64(Float64(z * z) - Float64(a * t))) / y)); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z < -3.1921305903852764e+46) tmp = -(y * x); elseif (z < 5.976268120920894e+90) tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y); else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Less[z, -3.1921305903852764e+46], (-N[(y * x), $MachinePrecision]), If[Less[z, 5.976268120920894e+90], N[(N[(x * z), $MachinePrecision] / N[(N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < -3.1921305903852764 \cdot 10^{+46}:\\
\;\;\;\;-y \cdot x\\
\mathbf{elif}\;z < 5.976268120920894 \cdot 10^{+90}:\\
\;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
herbie shell --seed 2023176
(FPCore (x y z t a)
:name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z -3.1921305903852764e+46) (- (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))