
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
(FPCore (a b)
:precision binary64
(let* ((t_0 (pow (hypot a b) 4.0)))
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* b b) (- 1.0 (* a 3.0))) (* (* a a) (+ a 1.0)))))
2e+293)
(+ (fma 4.0 (fma a (fma a a a) (* b (* b (fma a -3.0 1.0)))) t_0) -1.0)
(+ (+ -1.0 (exp (log1p t_0))) (+ -1.0 (* (* b b) 4.0))))))
double code(double a, double b) {
double t_0 = pow(hypot(a, b), 4.0);
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0))))) <= 2e+293) {
tmp = fma(4.0, fma(a, fma(a, a, a), (b * (b * fma(a, -3.0, 1.0)))), t_0) + -1.0;
} else {
tmp = (-1.0 + exp(log1p(t_0))) + (-1.0 + ((b * b) * 4.0));
}
return tmp;
}
function code(a, b) t_0 = hypot(a, b) ^ 4.0 tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0))) + Float64(Float64(a * a) * Float64(a + 1.0))))) <= 2e+293) tmp = Float64(fma(4.0, fma(a, fma(a, a, a), Float64(b * Float64(b * fma(a, -3.0, 1.0)))), t_0) + -1.0); else tmp = Float64(Float64(-1.0 + exp(log1p(t_0))) + Float64(-1.0 + Float64(Float64(b * b) * 4.0))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+293], N[(N[(4.0 * N[(a * N[(a * a + a), $MachinePrecision] + N[(b * N[(b * N[(a * -3.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(-1.0 + N[Exp[N[Log[1 + t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\\
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right) \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\mathsf{fma}\left(4, \mathsf{fma}\left(a, \mathsf{fma}\left(a, a, a\right), b \cdot \left(b \cdot \mathsf{fma}\left(a, -3, 1\right)\right)\right), t_0\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + e^{\mathsf{log1p}\left(t_0\right)}\right) + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < 1.9999999999999998e293Initial program 99.7%
sub-neg99.7%
Simplified100.0%
if 1.9999999999999998e293 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 52.7%
associate--l+52.7%
fma-def52.7%
Simplified58.2%
fma-def58.2%
add-sqr-sqrt58.2%
hypot-udef58.2%
hypot-udef58.2%
pow-prod-down58.2%
pow-prod-up58.2%
metadata-eval58.2%
expm1-log1p-u58.2%
expm1-udef58.2%
Applied egg-rr58.2%
Taylor expanded in a around 0 100.0%
unpow2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* b b) (- 1.0 (* a 3.0))) (* (* a a) (+ a 1.0)))))))
(if (<= t_0 2e+293)
(+ t_0 -1.0)
(+
(+ -1.0 (exp (log1p (pow (hypot a b) 4.0))))
(+ -1.0 (* (* b b) 4.0))))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0))));
double tmp;
if (t_0 <= 2e+293) {
tmp = t_0 + -1.0;
} else {
tmp = (-1.0 + exp(log1p(pow(hypot(a, b), 4.0)))) + (-1.0 + ((b * b) * 4.0));
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0))));
double tmp;
if (t_0 <= 2e+293) {
tmp = t_0 + -1.0;
} else {
tmp = (-1.0 + Math.exp(Math.log1p(Math.pow(Math.hypot(a, b), 4.0)))) + (-1.0 + ((b * b) * 4.0));
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0)))) tmp = 0 if t_0 <= 2e+293: tmp = t_0 + -1.0 else: tmp = (-1.0 + math.exp(math.log1p(math.pow(math.hypot(a, b), 4.0)))) + (-1.0 + ((b * b) * 4.0)) return tmp
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0))) + Float64(Float64(a * a) * Float64(a + 1.0))))) tmp = 0.0 if (t_0 <= 2e+293) tmp = Float64(t_0 + -1.0); else tmp = Float64(Float64(-1.0 + exp(log1p((hypot(a, b) ^ 4.0)))) + Float64(-1.0 + Float64(Float64(b * b) * 4.0))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+293], N[(t$95$0 + -1.0), $MachinePrecision], N[(N[(-1.0 + N[Exp[N[Log[1 + N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+293}:\\
\;\;\;\;t_0 + -1\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + e^{\mathsf{log1p}\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\right)}\right) + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < 1.9999999999999998e293Initial program 99.7%
if 1.9999999999999998e293 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 52.7%
associate--l+52.7%
fma-def52.7%
Simplified58.2%
fma-def58.2%
add-sqr-sqrt58.2%
hypot-udef58.2%
hypot-udef58.2%
pow-prod-down58.2%
pow-prod-up58.2%
metadata-eval58.2%
expm1-log1p-u58.2%
expm1-udef58.2%
Applied egg-rr58.2%
Taylor expanded in a around 0 100.0%
unpow2100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* b b) (- 1.0 (* a 3.0))) (* (* a a) (+ a 1.0)))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (pow a 4.0))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0)))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0))) + Float64(Float64(a * a) * Float64(a + 1.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((b * b) * (1.0 - (a * 3.0))) + ((a * a) * (a + 1.0)))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified11.6%
Taylor expanded in a around inf 93.2%
Final simplification98.1%
(FPCore (a b) :precision binary64 (if (or (<= a -1800000000.0) (not (<= a 8.2e+21))) (pow a 4.0) (+ (+ -1.0 (* (* b b) 4.0)) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if ((a <= -1800000000.0) || !(a <= 8.2e+21)) {
tmp = pow(a, 4.0);
} else {
tmp = (-1.0 + ((b * b) * 4.0)) + pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-1800000000.0d0)) .or. (.not. (a <= 8.2d+21))) then
tmp = a ** 4.0d0
else
tmp = ((-1.0d0) + ((b * b) * 4.0d0)) + (b ** 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -1800000000.0) || !(a <= 8.2e+21)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = (-1.0 + ((b * b) * 4.0)) + Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -1800000000.0) or not (a <= 8.2e+21): tmp = math.pow(a, 4.0) else: tmp = (-1.0 + ((b * b) * 4.0)) + math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if ((a <= -1800000000.0) || !(a <= 8.2e+21)) tmp = a ^ 4.0; else tmp = Float64(Float64(-1.0 + Float64(Float64(b * b) * 4.0)) + (b ^ 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -1800000000.0) || ~((a <= 8.2e+21))) tmp = a ^ 4.0; else tmp = (-1.0 + ((b * b) * 4.0)) + (b ^ 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -1800000000.0], N[Not[LessEqual[a, 8.2e+21]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1800000000 \lor \neg \left(a \leq 8.2 \cdot 10^{+21}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + \left(b \cdot b\right) \cdot 4\right) + {b}^{4}\\
\end{array}
\end{array}
if a < -1.8e9 or 8.2e21 < a Initial program 47.6%
associate--l+47.6%
fma-def47.6%
Simplified53.7%
Taylor expanded in a around inf 94.7%
if -1.8e9 < a < 8.2e21Initial program 99.1%
associate--l+99.1%
fma-def99.1%
Simplified99.1%
fma-def99.1%
add-sqr-sqrt99.1%
hypot-udef99.1%
hypot-udef99.1%
pow-prod-down99.1%
pow-prod-up99.2%
metadata-eval99.2%
expm1-log1p-u97.5%
expm1-udef97.5%
Applied egg-rr97.5%
Taylor expanded in a around 0 97.6%
unpow297.6%
Simplified97.6%
Taylor expanded in a around 0 99.2%
Final simplification96.9%
(FPCore (a b) :precision binary64 (if (or (<= a -1550000000.0) (not (<= a 9.2e+26))) (pow a 4.0) (+ -1.0 (* (* b b) (+ (* b b) 4.0)))))
double code(double a, double b) {
double tmp;
if ((a <= -1550000000.0) || !(a <= 9.2e+26)) {
tmp = pow(a, 4.0);
} else {
tmp = -1.0 + ((b * b) * ((b * b) + 4.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-1550000000.0d0)) .or. (.not. (a <= 9.2d+26))) then
tmp = a ** 4.0d0
else
tmp = (-1.0d0) + ((b * b) * ((b * b) + 4.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -1550000000.0) || !(a <= 9.2e+26)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0 + ((b * b) * ((b * b) + 4.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -1550000000.0) or not (a <= 9.2e+26): tmp = math.pow(a, 4.0) else: tmp = -1.0 + ((b * b) * ((b * b) + 4.0)) return tmp
function code(a, b) tmp = 0.0 if ((a <= -1550000000.0) || !(a <= 9.2e+26)) tmp = a ^ 4.0; else tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -1550000000.0) || ~((a <= 9.2e+26))) tmp = a ^ 4.0; else tmp = -1.0 + ((b * b) * ((b * b) + 4.0)); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -1550000000.0], N[Not[LessEqual[a, 9.2e+26]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1550000000 \lor \neg \left(a \leq 9.2 \cdot 10^{+26}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if a < -1.55e9 or 9.2000000000000002e26 < a Initial program 47.6%
associate--l+47.6%
fma-def47.6%
Simplified53.7%
Taylor expanded in a around inf 94.7%
if -1.55e9 < a < 9.2000000000000002e26Initial program 99.1%
associate--l+99.1%
fma-def99.1%
Simplified99.1%
fma-def99.1%
add-sqr-sqrt99.1%
hypot-udef99.1%
hypot-udef99.1%
pow-prod-down99.1%
pow-prod-up99.2%
metadata-eval99.2%
expm1-log1p-u97.5%
expm1-udef97.5%
Applied egg-rr97.5%
Taylor expanded in a around 0 97.6%
unpow297.6%
Simplified97.6%
Taylor expanded in a around 0 99.2%
associate-+r-99.2%
sqr-pow99.1%
metadata-eval99.1%
pow299.1%
metadata-eval99.1%
pow299.1%
distribute-rgt-out99.1%
Applied egg-rr99.1%
Final simplification96.9%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (* b b) 4.0)))
(if (<= a -2.5e+153)
(* a (* a 4.0))
(if (<= a -5.1e-20)
(* (* b b) (* a -12.0))
(if (<= a 9.2e-214)
-1.0
(if (<= a 1.05e-165)
t_0
(if (<= a 3e-9)
-1.0
(if (<= a 3.5e+102) t_0 (* 4.0 (* (* a a) (+ a 1.0)))))))))))
double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -2.5e+153) {
tmp = a * (a * 4.0);
} else if (a <= -5.1e-20) {
tmp = (b * b) * (a * -12.0);
} else if (a <= 9.2e-214) {
tmp = -1.0;
} else if (a <= 1.05e-165) {
tmp = t_0;
} else if (a <= 3e-9) {
tmp = -1.0;
} else if (a <= 3.5e+102) {
tmp = t_0;
} else {
tmp = 4.0 * ((a * a) * (a + 1.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) * 4.0d0
if (a <= (-2.5d+153)) then
tmp = a * (a * 4.0d0)
else if (a <= (-5.1d-20)) then
tmp = (b * b) * (a * (-12.0d0))
else if (a <= 9.2d-214) then
tmp = -1.0d0
else if (a <= 1.05d-165) then
tmp = t_0
else if (a <= 3d-9) then
tmp = -1.0d0
else if (a <= 3.5d+102) then
tmp = t_0
else
tmp = 4.0d0 * ((a * a) * (a + 1.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -2.5e+153) {
tmp = a * (a * 4.0);
} else if (a <= -5.1e-20) {
tmp = (b * b) * (a * -12.0);
} else if (a <= 9.2e-214) {
tmp = -1.0;
} else if (a <= 1.05e-165) {
tmp = t_0;
} else if (a <= 3e-9) {
tmp = -1.0;
} else if (a <= 3.5e+102) {
tmp = t_0;
} else {
tmp = 4.0 * ((a * a) * (a + 1.0));
}
return tmp;
}
def code(a, b): t_0 = (b * b) * 4.0 tmp = 0 if a <= -2.5e+153: tmp = a * (a * 4.0) elif a <= -5.1e-20: tmp = (b * b) * (a * -12.0) elif a <= 9.2e-214: tmp = -1.0 elif a <= 1.05e-165: tmp = t_0 elif a <= 3e-9: tmp = -1.0 elif a <= 3.5e+102: tmp = t_0 else: tmp = 4.0 * ((a * a) * (a + 1.0)) return tmp
function code(a, b) t_0 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -2.5e+153) tmp = Float64(a * Float64(a * 4.0)); elseif (a <= -5.1e-20) tmp = Float64(Float64(b * b) * Float64(a * -12.0)); elseif (a <= 9.2e-214) tmp = -1.0; elseif (a <= 1.05e-165) tmp = t_0; elseif (a <= 3e-9) tmp = -1.0; elseif (a <= 3.5e+102) tmp = t_0; else tmp = Float64(4.0 * Float64(Float64(a * a) * Float64(a + 1.0))); end return tmp end
function tmp_2 = code(a, b) t_0 = (b * b) * 4.0; tmp = 0.0; if (a <= -2.5e+153) tmp = a * (a * 4.0); elseif (a <= -5.1e-20) tmp = (b * b) * (a * -12.0); elseif (a <= 9.2e-214) tmp = -1.0; elseif (a <= 1.05e-165) tmp = t_0; elseif (a <= 3e-9) tmp = -1.0; elseif (a <= 3.5e+102) tmp = t_0; else tmp = 4.0 * ((a * a) * (a + 1.0)); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -2.5e+153], N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -5.1e-20], N[(N[(b * b), $MachinePrecision] * N[(a * -12.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.2e-214], -1.0, If[LessEqual[a, 1.05e-165], t$95$0, If[LessEqual[a, 3e-9], -1.0, If[LessEqual[a, 3.5e+102], t$95$0, N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -2.5 \cdot 10^{+153}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right)\\
\mathbf{elif}\;a \leq -5.1 \cdot 10^{-20}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot -12\right)\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-214}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-165}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq 3 \cdot 10^{-9}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right)\right)\\
\end{array}
\end{array}
if a < -2.50000000000000009e153Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified0.0%
fma-def0.0%
add-sqr-sqrt0.0%
hypot-udef0.0%
hypot-udef0.0%
pow-prod-down0.0%
pow-prod-up0.0%
metadata-eval0.0%
add-cube-cbrt0.0%
unpow-prod-down0.0%
pow20.0%
Applied egg-rr0.0%
*-commutative0.0%
metadata-eval0.0%
pow-sqr0.0%
sqr-pow0.0%
unpow20.0%
metadata-eval0.0%
cube-unmult0.0%
metadata-eval0.0%
unpow20.0%
pow-sqr0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in a around inf 0.0%
distribute-lft-out0.0%
*-lft-identity0.0%
cube-mult0.0%
unpow20.0%
distribute-rgt-in0.0%
distribute-rgt-in0.0%
*-lft-identity0.0%
unpow20.0%
unpow20.0%
cube-mult0.0%
Simplified0.0%
Taylor expanded in a around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -2.50000000000000009e153 < a < -5.10000000000000019e-20Initial program 62.5%
associate--l+62.5%
fma-def62.5%
Simplified81.1%
fma-def81.1%
add-sqr-sqrt81.1%
hypot-udef81.1%
hypot-udef81.1%
pow-prod-down81.1%
pow-prod-up81.4%
metadata-eval81.4%
add-cube-cbrt79.7%
unpow-prod-down79.6%
pow279.6%
Applied egg-rr79.6%
*-commutative79.6%
metadata-eval79.6%
pow-sqr79.6%
sqr-pow79.7%
unpow279.7%
metadata-eval79.7%
cube-unmult79.7%
metadata-eval79.7%
unpow279.7%
pow-sqr79.6%
metadata-eval79.6%
Simplified79.6%
Taylor expanded in b around inf 32.7%
*-commutative32.7%
*-commutative32.7%
associate-*r*32.7%
unpow232.7%
*-commutative32.7%
+-commutative32.7%
distribute-lft-in32.7%
metadata-eval32.7%
associate-*r*32.7%
metadata-eval32.7%
Simplified32.7%
Taylor expanded in a around inf 32.6%
*-commutative32.6%
Simplified32.6%
if -5.10000000000000019e-20 < a < 9.20000000000000044e-214 or 1.04999999999999997e-165 < a < 2.99999999999999998e-9Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 60.0%
associate--l+60.0%
associate-*r*60.0%
unpow260.0%
Simplified60.0%
Taylor expanded in a around 0 60.0%
if 9.20000000000000044e-214 < a < 1.04999999999999997e-165 or 2.99999999999999998e-9 < a < 3.50000000000000011e102Initial program 84.8%
associate--l+84.8%
fma-def84.8%
Simplified84.8%
fma-def84.8%
add-sqr-sqrt84.8%
hypot-udef84.8%
hypot-udef84.8%
pow-prod-down84.8%
pow-prod-up85.0%
metadata-eval85.0%
add-cube-cbrt83.9%
unpow-prod-down83.8%
pow283.8%
Applied egg-rr83.8%
*-commutative83.8%
metadata-eval83.8%
pow-sqr83.7%
sqr-pow83.6%
unpow283.6%
metadata-eval83.6%
cube-unmult83.6%
metadata-eval83.6%
unpow283.6%
pow-sqr83.8%
metadata-eval83.8%
Simplified83.8%
Taylor expanded in b around inf 21.9%
*-commutative21.9%
*-commutative21.9%
associate-*r*21.9%
unpow221.9%
*-commutative21.9%
+-commutative21.9%
distribute-lft-in21.9%
metadata-eval21.9%
associate-*r*21.9%
metadata-eval21.9%
Simplified21.9%
Taylor expanded in a around 0 38.0%
if 3.50000000000000011e102 < a Initial program 70.3%
associate--l+70.3%
fma-def70.3%
Simplified70.3%
fma-def70.3%
add-sqr-sqrt70.3%
hypot-udef70.3%
hypot-udef70.3%
pow-prod-down70.3%
pow-prod-up70.3%
metadata-eval70.3%
add-cube-cbrt70.3%
unpow-prod-down70.3%
pow270.3%
Applied egg-rr70.3%
*-commutative70.3%
metadata-eval70.3%
pow-sqr70.3%
sqr-pow70.3%
unpow270.3%
metadata-eval70.3%
cube-unmult70.3%
metadata-eval70.3%
unpow270.3%
pow-sqr70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in a around inf 100.0%
distribute-lft-out100.0%
*-lft-identity100.0%
cube-mult100.0%
unpow2100.0%
distribute-rgt-in100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
unpow2100.0%
unpow2100.0%
cube-mult100.0%
Simplified100.0%
cube-mult100.0%
distribute-rgt1-in100.0%
Applied egg-rr100.0%
Final simplification63.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (* b b) 4.0)))
(if (<= a -5e+153)
(* a (* a 4.0))
(if (<= a -2.25e-20)
(* (* b b) (+ 4.0 (* a -12.0)))
(if (<= a 1.25e-213)
-1.0
(if (<= a 1.05e-165)
t_0
(if (<= a 3e-9)
-1.0
(if (<= a 1.15e+101) t_0 (* 4.0 (* (* a a) (+ a 1.0)))))))))))
double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -5e+153) {
tmp = a * (a * 4.0);
} else if (a <= -2.25e-20) {
tmp = (b * b) * (4.0 + (a * -12.0));
} else if (a <= 1.25e-213) {
tmp = -1.0;
} else if (a <= 1.05e-165) {
tmp = t_0;
} else if (a <= 3e-9) {
tmp = -1.0;
} else if (a <= 1.15e+101) {
tmp = t_0;
} else {
tmp = 4.0 * ((a * a) * (a + 1.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) * 4.0d0
if (a <= (-5d+153)) then
tmp = a * (a * 4.0d0)
else if (a <= (-2.25d-20)) then
tmp = (b * b) * (4.0d0 + (a * (-12.0d0)))
else if (a <= 1.25d-213) then
tmp = -1.0d0
else if (a <= 1.05d-165) then
tmp = t_0
else if (a <= 3d-9) then
tmp = -1.0d0
else if (a <= 1.15d+101) then
tmp = t_0
else
tmp = 4.0d0 * ((a * a) * (a + 1.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -5e+153) {
tmp = a * (a * 4.0);
} else if (a <= -2.25e-20) {
tmp = (b * b) * (4.0 + (a * -12.0));
} else if (a <= 1.25e-213) {
tmp = -1.0;
} else if (a <= 1.05e-165) {
tmp = t_0;
} else if (a <= 3e-9) {
tmp = -1.0;
} else if (a <= 1.15e+101) {
tmp = t_0;
} else {
tmp = 4.0 * ((a * a) * (a + 1.0));
}
return tmp;
}
def code(a, b): t_0 = (b * b) * 4.0 tmp = 0 if a <= -5e+153: tmp = a * (a * 4.0) elif a <= -2.25e-20: tmp = (b * b) * (4.0 + (a * -12.0)) elif a <= 1.25e-213: tmp = -1.0 elif a <= 1.05e-165: tmp = t_0 elif a <= 3e-9: tmp = -1.0 elif a <= 1.15e+101: tmp = t_0 else: tmp = 4.0 * ((a * a) * (a + 1.0)) return tmp
function code(a, b) t_0 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -5e+153) tmp = Float64(a * Float64(a * 4.0)); elseif (a <= -2.25e-20) tmp = Float64(Float64(b * b) * Float64(4.0 + Float64(a * -12.0))); elseif (a <= 1.25e-213) tmp = -1.0; elseif (a <= 1.05e-165) tmp = t_0; elseif (a <= 3e-9) tmp = -1.0; elseif (a <= 1.15e+101) tmp = t_0; else tmp = Float64(4.0 * Float64(Float64(a * a) * Float64(a + 1.0))); end return tmp end
function tmp_2 = code(a, b) t_0 = (b * b) * 4.0; tmp = 0.0; if (a <= -5e+153) tmp = a * (a * 4.0); elseif (a <= -2.25e-20) tmp = (b * b) * (4.0 + (a * -12.0)); elseif (a <= 1.25e-213) tmp = -1.0; elseif (a <= 1.05e-165) tmp = t_0; elseif (a <= 3e-9) tmp = -1.0; elseif (a <= 1.15e+101) tmp = t_0; else tmp = 4.0 * ((a * a) * (a + 1.0)); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -5e+153], N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -2.25e-20], N[(N[(b * b), $MachinePrecision] * N[(4.0 + N[(a * -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.25e-213], -1.0, If[LessEqual[a, 1.05e-165], t$95$0, If[LessEqual[a, 3e-9], -1.0, If[LessEqual[a, 1.15e+101], t$95$0, N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -5 \cdot 10^{+153}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right)\\
\mathbf{elif}\;a \leq -2.25 \cdot 10^{-20}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right)\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-213}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-165}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq 3 \cdot 10^{-9}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{+101}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right)\right)\\
\end{array}
\end{array}
if a < -5.00000000000000018e153Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified0.0%
fma-def0.0%
add-sqr-sqrt0.0%
hypot-udef0.0%
hypot-udef0.0%
pow-prod-down0.0%
pow-prod-up0.0%
metadata-eval0.0%
add-cube-cbrt0.0%
unpow-prod-down0.0%
pow20.0%
Applied egg-rr0.0%
*-commutative0.0%
metadata-eval0.0%
pow-sqr0.0%
sqr-pow0.0%
unpow20.0%
metadata-eval0.0%
cube-unmult0.0%
metadata-eval0.0%
unpow20.0%
pow-sqr0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in a around inf 0.0%
distribute-lft-out0.0%
*-lft-identity0.0%
cube-mult0.0%
unpow20.0%
distribute-rgt-in0.0%
distribute-rgt-in0.0%
*-lft-identity0.0%
unpow20.0%
unpow20.0%
cube-mult0.0%
Simplified0.0%
Taylor expanded in a around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -5.00000000000000018e153 < a < -2.2500000000000001e-20Initial program 62.5%
associate--l+62.5%
fma-def62.5%
Simplified81.1%
fma-def81.1%
add-sqr-sqrt81.1%
hypot-udef81.1%
hypot-udef81.1%
pow-prod-down81.1%
pow-prod-up81.4%
metadata-eval81.4%
add-cube-cbrt79.7%
unpow-prod-down79.6%
pow279.6%
Applied egg-rr79.6%
*-commutative79.6%
metadata-eval79.6%
pow-sqr79.6%
sqr-pow79.7%
unpow279.7%
metadata-eval79.7%
cube-unmult79.7%
metadata-eval79.7%
unpow279.7%
pow-sqr79.6%
metadata-eval79.6%
Simplified79.6%
Taylor expanded in b around inf 32.7%
*-commutative32.7%
*-commutative32.7%
associate-*r*32.7%
unpow232.7%
*-commutative32.7%
+-commutative32.7%
distribute-lft-in32.7%
metadata-eval32.7%
associate-*r*32.7%
metadata-eval32.7%
Simplified32.7%
if -2.2500000000000001e-20 < a < 1.24999999999999994e-213 or 1.04999999999999997e-165 < a < 2.99999999999999998e-9Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 60.0%
associate--l+60.0%
associate-*r*60.0%
unpow260.0%
Simplified60.0%
Taylor expanded in a around 0 60.0%
if 1.24999999999999994e-213 < a < 1.04999999999999997e-165 or 2.99999999999999998e-9 < a < 1.1500000000000001e101Initial program 84.8%
associate--l+84.8%
fma-def84.8%
Simplified84.8%
fma-def84.8%
add-sqr-sqrt84.8%
hypot-udef84.8%
hypot-udef84.8%
pow-prod-down84.8%
pow-prod-up85.0%
metadata-eval85.0%
add-cube-cbrt83.9%
unpow-prod-down83.8%
pow283.8%
Applied egg-rr83.8%
*-commutative83.8%
metadata-eval83.8%
pow-sqr83.7%
sqr-pow83.6%
unpow283.6%
metadata-eval83.6%
cube-unmult83.6%
metadata-eval83.6%
unpow283.6%
pow-sqr83.8%
metadata-eval83.8%
Simplified83.8%
Taylor expanded in b around inf 21.9%
*-commutative21.9%
*-commutative21.9%
associate-*r*21.9%
unpow221.9%
*-commutative21.9%
+-commutative21.9%
distribute-lft-in21.9%
metadata-eval21.9%
associate-*r*21.9%
metadata-eval21.9%
Simplified21.9%
Taylor expanded in a around 0 38.0%
if 1.1500000000000001e101 < a Initial program 70.3%
associate--l+70.3%
fma-def70.3%
Simplified70.3%
fma-def70.3%
add-sqr-sqrt70.3%
hypot-udef70.3%
hypot-udef70.3%
pow-prod-down70.3%
pow-prod-up70.3%
metadata-eval70.3%
add-cube-cbrt70.3%
unpow-prod-down70.3%
pow270.3%
Applied egg-rr70.3%
*-commutative70.3%
metadata-eval70.3%
pow-sqr70.3%
sqr-pow70.3%
unpow270.3%
metadata-eval70.3%
cube-unmult70.3%
metadata-eval70.3%
unpow270.3%
pow-sqr70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in a around inf 100.0%
distribute-lft-out100.0%
*-lft-identity100.0%
cube-mult100.0%
unpow2100.0%
distribute-rgt-in100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
unpow2100.0%
unpow2100.0%
cube-mult100.0%
Simplified100.0%
cube-mult100.0%
distribute-rgt1-in100.0%
Applied egg-rr100.0%
Final simplification63.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a 4.0))) (t_1 (* (* b b) 4.0)))
(if (<= a -1.65e+153)
t_0
(if (<= a -5.1e-20)
t_1
(if (<= a 1.25e-213)
-1.0
(if (<= a 4.5e-165)
t_1
(if (<= a 2.9e-9) -1.0 (if (<= a 1.1e+123) t_1 t_0))))))))
double code(double a, double b) {
double t_0 = a * (a * 4.0);
double t_1 = (b * b) * 4.0;
double tmp;
if (a <= -1.65e+153) {
tmp = t_0;
} else if (a <= -5.1e-20) {
tmp = t_1;
} else if (a <= 1.25e-213) {
tmp = -1.0;
} else if (a <= 4.5e-165) {
tmp = t_1;
} else if (a <= 2.9e-9) {
tmp = -1.0;
} else if (a <= 1.1e+123) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (a * 4.0d0)
t_1 = (b * b) * 4.0d0
if (a <= (-1.65d+153)) then
tmp = t_0
else if (a <= (-5.1d-20)) then
tmp = t_1
else if (a <= 1.25d-213) then
tmp = -1.0d0
else if (a <= 4.5d-165) then
tmp = t_1
else if (a <= 2.9d-9) then
tmp = -1.0d0
else if (a <= 1.1d+123) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (a * 4.0);
double t_1 = (b * b) * 4.0;
double tmp;
if (a <= -1.65e+153) {
tmp = t_0;
} else if (a <= -5.1e-20) {
tmp = t_1;
} else if (a <= 1.25e-213) {
tmp = -1.0;
} else if (a <= 4.5e-165) {
tmp = t_1;
} else if (a <= 2.9e-9) {
tmp = -1.0;
} else if (a <= 1.1e+123) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * 4.0) t_1 = (b * b) * 4.0 tmp = 0 if a <= -1.65e+153: tmp = t_0 elif a <= -5.1e-20: tmp = t_1 elif a <= 1.25e-213: tmp = -1.0 elif a <= 4.5e-165: tmp = t_1 elif a <= 2.9e-9: tmp = -1.0 elif a <= 1.1e+123: tmp = t_1 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * 4.0)) t_1 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -1.65e+153) tmp = t_0; elseif (a <= -5.1e-20) tmp = t_1; elseif (a <= 1.25e-213) tmp = -1.0; elseif (a <= 4.5e-165) tmp = t_1; elseif (a <= 2.9e-9) tmp = -1.0; elseif (a <= 1.1e+123) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * 4.0); t_1 = (b * b) * 4.0; tmp = 0.0; if (a <= -1.65e+153) tmp = t_0; elseif (a <= -5.1e-20) tmp = t_1; elseif (a <= 1.25e-213) tmp = -1.0; elseif (a <= 4.5e-165) tmp = t_1; elseif (a <= 2.9e-9) tmp = -1.0; elseif (a <= 1.1e+123) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -1.65e+153], t$95$0, If[LessEqual[a, -5.1e-20], t$95$1, If[LessEqual[a, 1.25e-213], -1.0, If[LessEqual[a, 4.5e-165], t$95$1, If[LessEqual[a, 2.9e-9], -1.0, If[LessEqual[a, 1.1e+123], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot 4\right)\\
t_1 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -1.65 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq -5.1 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-213}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 2.9 \cdot 10^{-9}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if a < -1.64999999999999997e153 or 1.09999999999999996e123 < a Initial program 33.8%
associate--l+33.8%
fma-def33.8%
Simplified33.8%
fma-def33.8%
add-sqr-sqrt33.8%
hypot-udef33.8%
hypot-udef33.8%
pow-prod-down33.8%
pow-prod-up33.8%
metadata-eval33.8%
add-cube-cbrt33.8%
unpow-prod-down33.8%
pow233.8%
Applied egg-rr33.8%
*-commutative33.8%
metadata-eval33.8%
pow-sqr33.8%
sqr-pow33.8%
unpow233.8%
metadata-eval33.8%
cube-unmult33.8%
metadata-eval33.8%
unpow233.8%
pow-sqr33.8%
metadata-eval33.8%
Simplified33.8%
Taylor expanded in a around inf 47.1%
distribute-lft-out47.1%
*-lft-identity47.1%
cube-mult47.1%
unpow247.1%
distribute-rgt-in47.1%
distribute-rgt-in47.1%
*-lft-identity47.1%
unpow247.1%
unpow247.1%
cube-mult47.1%
Simplified47.1%
Taylor expanded in a around 0 93.2%
unpow293.2%
*-commutative93.2%
associate-*r*93.2%
*-commutative93.2%
Simplified93.2%
if -1.64999999999999997e153 < a < -5.10000000000000019e-20 or 1.24999999999999994e-213 < a < 4.49999999999999992e-165 or 2.89999999999999991e-9 < a < 1.09999999999999996e123Initial program 72.5%
associate--l+72.5%
fma-def72.5%
Simplified81.6%
fma-def81.6%
add-sqr-sqrt81.6%
hypot-udef81.6%
hypot-udef81.6%
pow-prod-down81.6%
pow-prod-up81.8%
metadata-eval81.8%
add-cube-cbrt80.5%
unpow-prod-down80.4%
pow280.4%
Applied egg-rr80.4%
*-commutative80.4%
metadata-eval80.4%
pow-sqr80.4%
sqr-pow80.4%
unpow280.4%
metadata-eval80.4%
cube-unmult80.4%
metadata-eval80.4%
unpow280.4%
pow-sqr80.4%
metadata-eval80.4%
Simplified80.4%
Taylor expanded in b around inf 25.9%
*-commutative25.9%
*-commutative25.9%
associate-*r*25.9%
unpow225.9%
*-commutative25.9%
+-commutative25.9%
distribute-lft-in25.9%
metadata-eval25.9%
associate-*r*25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in a around 0 32.4%
if -5.10000000000000019e-20 < a < 1.24999999999999994e-213 or 4.49999999999999992e-165 < a < 2.89999999999999991e-9Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 60.0%
associate--l+60.0%
associate-*r*60.0%
unpow260.0%
Simplified60.0%
Taylor expanded in a around 0 60.0%
Final simplification59.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a 4.0))) (t_1 (* (* b b) 4.0)))
(if (<= a -6.8e+153)
t_0
(if (<= a -5.1e-20)
(* (* b b) (* a -12.0))
(if (<= a 1.25e-213)
-1.0
(if (<= a 1.05e-165)
t_1
(if (<= a 1.82e-9) -1.0 (if (<= a 1.1e+123) t_1 t_0))))))))
double code(double a, double b) {
double t_0 = a * (a * 4.0);
double t_1 = (b * b) * 4.0;
double tmp;
if (a <= -6.8e+153) {
tmp = t_0;
} else if (a <= -5.1e-20) {
tmp = (b * b) * (a * -12.0);
} else if (a <= 1.25e-213) {
tmp = -1.0;
} else if (a <= 1.05e-165) {
tmp = t_1;
} else if (a <= 1.82e-9) {
tmp = -1.0;
} else if (a <= 1.1e+123) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (a * 4.0d0)
t_1 = (b * b) * 4.0d0
if (a <= (-6.8d+153)) then
tmp = t_0
else if (a <= (-5.1d-20)) then
tmp = (b * b) * (a * (-12.0d0))
else if (a <= 1.25d-213) then
tmp = -1.0d0
else if (a <= 1.05d-165) then
tmp = t_1
else if (a <= 1.82d-9) then
tmp = -1.0d0
else if (a <= 1.1d+123) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (a * 4.0);
double t_1 = (b * b) * 4.0;
double tmp;
if (a <= -6.8e+153) {
tmp = t_0;
} else if (a <= -5.1e-20) {
tmp = (b * b) * (a * -12.0);
} else if (a <= 1.25e-213) {
tmp = -1.0;
} else if (a <= 1.05e-165) {
tmp = t_1;
} else if (a <= 1.82e-9) {
tmp = -1.0;
} else if (a <= 1.1e+123) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * 4.0) t_1 = (b * b) * 4.0 tmp = 0 if a <= -6.8e+153: tmp = t_0 elif a <= -5.1e-20: tmp = (b * b) * (a * -12.0) elif a <= 1.25e-213: tmp = -1.0 elif a <= 1.05e-165: tmp = t_1 elif a <= 1.82e-9: tmp = -1.0 elif a <= 1.1e+123: tmp = t_1 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * 4.0)) t_1 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -6.8e+153) tmp = t_0; elseif (a <= -5.1e-20) tmp = Float64(Float64(b * b) * Float64(a * -12.0)); elseif (a <= 1.25e-213) tmp = -1.0; elseif (a <= 1.05e-165) tmp = t_1; elseif (a <= 1.82e-9) tmp = -1.0; elseif (a <= 1.1e+123) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * 4.0); t_1 = (b * b) * 4.0; tmp = 0.0; if (a <= -6.8e+153) tmp = t_0; elseif (a <= -5.1e-20) tmp = (b * b) * (a * -12.0); elseif (a <= 1.25e-213) tmp = -1.0; elseif (a <= 1.05e-165) tmp = t_1; elseif (a <= 1.82e-9) tmp = -1.0; elseif (a <= 1.1e+123) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -6.8e+153], t$95$0, If[LessEqual[a, -5.1e-20], N[(N[(b * b), $MachinePrecision] * N[(a * -12.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.25e-213], -1.0, If[LessEqual[a, 1.05e-165], t$95$1, If[LessEqual[a, 1.82e-9], -1.0, If[LessEqual[a, 1.1e+123], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot 4\right)\\
t_1 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -6.8 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq -5.1 \cdot 10^{-20}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot -12\right)\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-213}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.82 \cdot 10^{-9}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if a < -6.7999999999999995e153 or 1.09999999999999996e123 < a Initial program 33.8%
associate--l+33.8%
fma-def33.8%
Simplified33.8%
fma-def33.8%
add-sqr-sqrt33.8%
hypot-udef33.8%
hypot-udef33.8%
pow-prod-down33.8%
pow-prod-up33.8%
metadata-eval33.8%
add-cube-cbrt33.8%
unpow-prod-down33.8%
pow233.8%
Applied egg-rr33.8%
*-commutative33.8%
metadata-eval33.8%
pow-sqr33.8%
sqr-pow33.8%
unpow233.8%
metadata-eval33.8%
cube-unmult33.8%
metadata-eval33.8%
unpow233.8%
pow-sqr33.8%
metadata-eval33.8%
Simplified33.8%
Taylor expanded in a around inf 47.1%
distribute-lft-out47.1%
*-lft-identity47.1%
cube-mult47.1%
unpow247.1%
distribute-rgt-in47.1%
distribute-rgt-in47.1%
*-lft-identity47.1%
unpow247.1%
unpow247.1%
cube-mult47.1%
Simplified47.1%
Taylor expanded in a around 0 93.2%
unpow293.2%
*-commutative93.2%
associate-*r*93.2%
*-commutative93.2%
Simplified93.2%
if -6.7999999999999995e153 < a < -5.10000000000000019e-20Initial program 62.5%
associate--l+62.5%
fma-def62.5%
Simplified81.1%
fma-def81.1%
add-sqr-sqrt81.1%
hypot-udef81.1%
hypot-udef81.1%
pow-prod-down81.1%
pow-prod-up81.4%
metadata-eval81.4%
add-cube-cbrt79.7%
unpow-prod-down79.6%
pow279.6%
Applied egg-rr79.6%
*-commutative79.6%
metadata-eval79.6%
pow-sqr79.6%
sqr-pow79.7%
unpow279.7%
metadata-eval79.7%
cube-unmult79.7%
metadata-eval79.7%
unpow279.7%
pow-sqr79.6%
metadata-eval79.6%
Simplified79.6%
Taylor expanded in b around inf 32.7%
*-commutative32.7%
*-commutative32.7%
associate-*r*32.7%
unpow232.7%
*-commutative32.7%
+-commutative32.7%
distribute-lft-in32.7%
metadata-eval32.7%
associate-*r*32.7%
metadata-eval32.7%
Simplified32.7%
Taylor expanded in a around inf 32.6%
*-commutative32.6%
Simplified32.6%
if -5.10000000000000019e-20 < a < 1.24999999999999994e-213 or 1.04999999999999997e-165 < a < 1.8199999999999999e-9Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 60.0%
associate--l+60.0%
associate-*r*60.0%
unpow260.0%
Simplified60.0%
Taylor expanded in a around 0 60.0%
if 1.24999999999999994e-213 < a < 1.04999999999999997e-165 or 1.8199999999999999e-9 < a < 1.09999999999999996e123Initial program 82.0%
associate--l+82.0%
fma-def82.0%
Simplified82.0%
fma-def82.0%
add-sqr-sqrt82.0%
hypot-udef82.0%
hypot-udef82.0%
pow-prod-down82.0%
pow-prod-up82.2%
metadata-eval82.2%
add-cube-cbrt81.2%
unpow-prod-down81.2%
pow281.2%
Applied egg-rr81.2%
*-commutative81.2%
metadata-eval81.2%
pow-sqr81.1%
sqr-pow81.0%
unpow281.0%
metadata-eval81.0%
cube-unmult81.0%
metadata-eval81.0%
unpow281.0%
pow-sqr81.2%
metadata-eval81.2%
Simplified81.2%
Taylor expanded in b around inf 19.5%
*-commutative19.5%
*-commutative19.5%
associate-*r*19.5%
unpow219.5%
*-commutative19.5%
+-commutative19.5%
distribute-lft-in19.5%
metadata-eval19.5%
associate-*r*19.5%
metadata-eval19.5%
Simplified19.5%
Taylor expanded in a around 0 36.4%
Final simplification60.1%
(FPCore (a b)
:precision binary64
(if (<= a -6.2e+153)
(* a (* a 4.0))
(if (<= a 3.4e+102)
(+ -1.0 (* (* b b) (+ (* b b) 4.0)))
(* 4.0 (* (* a a) (+ a 1.0))))))
double code(double a, double b) {
double tmp;
if (a <= -6.2e+153) {
tmp = a * (a * 4.0);
} else if (a <= 3.4e+102) {
tmp = -1.0 + ((b * b) * ((b * b) + 4.0));
} else {
tmp = 4.0 * ((a * a) * (a + 1.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-6.2d+153)) then
tmp = a * (a * 4.0d0)
else if (a <= 3.4d+102) then
tmp = (-1.0d0) + ((b * b) * ((b * b) + 4.0d0))
else
tmp = 4.0d0 * ((a * a) * (a + 1.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -6.2e+153) {
tmp = a * (a * 4.0);
} else if (a <= 3.4e+102) {
tmp = -1.0 + ((b * b) * ((b * b) + 4.0));
} else {
tmp = 4.0 * ((a * a) * (a + 1.0));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -6.2e+153: tmp = a * (a * 4.0) elif a <= 3.4e+102: tmp = -1.0 + ((b * b) * ((b * b) + 4.0)) else: tmp = 4.0 * ((a * a) * (a + 1.0)) return tmp
function code(a, b) tmp = 0.0 if (a <= -6.2e+153) tmp = Float64(a * Float64(a * 4.0)); elseif (a <= 3.4e+102) tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0))); else tmp = Float64(4.0 * Float64(Float64(a * a) * Float64(a + 1.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -6.2e+153) tmp = a * (a * 4.0); elseif (a <= 3.4e+102) tmp = -1.0 + ((b * b) * ((b * b) + 4.0)); else tmp = 4.0 * ((a * a) * (a + 1.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -6.2e+153], N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.4e+102], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.2 \cdot 10^{+153}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right)\\
\mathbf{elif}\;a \leq 3.4 \cdot 10^{+102}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right)\right)\\
\end{array}
\end{array}
if a < -6.2e153Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified0.0%
fma-def0.0%
add-sqr-sqrt0.0%
hypot-udef0.0%
hypot-udef0.0%
pow-prod-down0.0%
pow-prod-up0.0%
metadata-eval0.0%
add-cube-cbrt0.0%
unpow-prod-down0.0%
pow20.0%
Applied egg-rr0.0%
*-commutative0.0%
metadata-eval0.0%
pow-sqr0.0%
sqr-pow0.0%
unpow20.0%
metadata-eval0.0%
cube-unmult0.0%
metadata-eval0.0%
unpow20.0%
pow-sqr0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in a around inf 0.0%
distribute-lft-out0.0%
*-lft-identity0.0%
cube-mult0.0%
unpow20.0%
distribute-rgt-in0.0%
distribute-rgt-in0.0%
*-lft-identity0.0%
unpow20.0%
unpow20.0%
cube-mult0.0%
Simplified0.0%
Taylor expanded in a around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -6.2e153 < a < 3.4e102Initial program 87.8%
associate--l+87.8%
fma-def87.8%
Simplified92.2%
fma-def92.2%
add-sqr-sqrt92.2%
hypot-udef92.2%
hypot-udef92.2%
pow-prod-down92.2%
pow-prod-up92.3%
metadata-eval92.3%
expm1-log1p-u90.1%
expm1-udef90.1%
Applied egg-rr90.1%
Taylor expanded in a around 0 97.2%
unpow297.2%
Simplified97.2%
Taylor expanded in a around 0 78.9%
associate-+r-78.9%
sqr-pow78.8%
metadata-eval78.8%
pow278.8%
metadata-eval78.8%
pow278.8%
distribute-rgt-out78.8%
Applied egg-rr78.8%
if 3.4e102 < a Initial program 70.3%
associate--l+70.3%
fma-def70.3%
Simplified70.3%
fma-def70.3%
add-sqr-sqrt70.3%
hypot-udef70.3%
hypot-udef70.3%
pow-prod-down70.3%
pow-prod-up70.3%
metadata-eval70.3%
add-cube-cbrt70.3%
unpow-prod-down70.3%
pow270.3%
Applied egg-rr70.3%
*-commutative70.3%
metadata-eval70.3%
pow-sqr70.3%
sqr-pow70.3%
unpow270.3%
metadata-eval70.3%
cube-unmult70.3%
metadata-eval70.3%
unpow270.3%
pow-sqr70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in a around inf 100.0%
distribute-lft-out100.0%
*-lft-identity100.0%
cube-mult100.0%
unpow2100.0%
distribute-rgt-in100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
unpow2100.0%
unpow2100.0%
cube-mult100.0%
Simplified100.0%
cube-mult100.0%
distribute-rgt1-in100.0%
Applied egg-rr100.0%
Final simplification84.9%
(FPCore (a b) :precision binary64 (if (or (<= a -5.1e-20) (not (<= a 3e-9))) (* a (* a 4.0)) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -5.1e-20) || !(a <= 3e-9)) {
tmp = a * (a * 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-5.1d-20)) .or. (.not. (a <= 3d-9))) then
tmp = a * (a * 4.0d0)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -5.1e-20) || !(a <= 3e-9)) {
tmp = a * (a * 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -5.1e-20) or not (a <= 3e-9): tmp = a * (a * 4.0) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -5.1e-20) || !(a <= 3e-9)) tmp = Float64(a * Float64(a * 4.0)); else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -5.1e-20) || ~((a <= 3e-9))) tmp = a * (a * 4.0); else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -5.1e-20], N[Not[LessEqual[a, 3e-9]], $MachinePrecision]], N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.1 \cdot 10^{-20} \lor \neg \left(a \leq 3 \cdot 10^{-9}\right):\\
\;\;\;\;a \cdot \left(a \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -5.10000000000000019e-20 or 2.99999999999999998e-9 < a Initial program 52.0%
associate--l+52.0%
fma-def52.0%
Simplified57.5%
fma-def57.5%
add-sqr-sqrt57.5%
hypot-udef57.5%
hypot-udef57.5%
pow-prod-down57.5%
pow-prod-up57.6%
metadata-eval57.6%
add-cube-cbrt56.9%
unpow-prod-down56.9%
pow256.9%
Applied egg-rr56.9%
*-commutative56.9%
metadata-eval56.9%
pow-sqr56.8%
sqr-pow56.8%
unpow256.8%
metadata-eval56.8%
cube-unmult56.8%
metadata-eval56.8%
unpow256.8%
pow-sqr56.9%
metadata-eval56.9%
Simplified56.9%
Taylor expanded in a around inf 27.3%
distribute-lft-out27.3%
*-lft-identity27.3%
cube-mult27.3%
unpow227.3%
distribute-rgt-in27.3%
distribute-rgt-in27.3%
*-lft-identity27.3%
unpow227.3%
unpow227.3%
cube-mult27.3%
Simplified27.3%
Taylor expanded in a around 0 47.1%
unpow247.1%
*-commutative47.1%
associate-*r*47.1%
*-commutative47.1%
Simplified47.1%
if -5.10000000000000019e-20 < a < 2.99999999999999998e-9Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 55.4%
associate--l+55.4%
associate-*r*55.4%
unpow255.4%
Simplified55.4%
Taylor expanded in a around 0 55.4%
Final simplification50.7%
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
return -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -1.0d0
end function
public static double code(double a, double b) {
return -1.0;
}
def code(a, b): return -1.0
function code(a, b) return -1.0 end
function tmp = code(a, b) tmp = -1.0; end
code[a_, b_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 72.9%
associate--l+72.9%
fma-def72.9%
Simplified76.1%
Taylor expanded in b around 0 52.6%
associate--l+52.6%
associate-*r*52.6%
unpow252.6%
Simplified52.6%
Taylor expanded in a around 0 24.6%
Final simplification24.6%
herbie shell --seed 2023172
(FPCore (a b)
:name "Bouland and Aaronson, Equation (25)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))