
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 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) * (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) * (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) * (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) * (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(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) * (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[(3.0 + a), $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(3 + a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 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) (+ 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) * (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) * (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) * (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) * (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(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) * (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[(3.0 + a), $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(3 + a\right)\right)\right) - 1
\end{array}
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))))
(if (<= t_0 INFINITY)
(+ t_0 -1.0)
(+ (* (pow a 2.0) (+ (* 2.0 (pow b 2.0)) (* a (- a 4.0)))) -1.0))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = (pow(a, 2.0) * ((2.0 * pow(b, 2.0)) + (a * (a - 4.0)))) + -1.0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = (Math.pow(a, 2.0) * ((2.0 * Math.pow(b, 2.0)) + (a * (a - 4.0)))) + -1.0;
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0)))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = (math.pow(a, 2.0) * ((2.0 * math.pow(b, 2.0)) + (a * (a - 4.0)))) + -1.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(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64(Float64((a ^ 2.0) * Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a - 4.0)))) + -1.0); end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0)))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = ((a ^ 2.0) * ((2.0 * (b ^ 2.0)) + (a * (a - 4.0)))) + -1.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[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\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(a + 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} \cdot \left(2 \cdot {b}^{2} + a \cdot \left(a - 4\right)\right) + -1\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) Initial program 0.0%
associate--l+0.0%
fma-define0.0%
sqr-neg0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
fma-define0.0%
sqr-neg0.0%
Simplified6.6%
Taylor expanded in b around 0 6.6%
fma-define6.6%
unpow26.6%
unpow26.6%
swap-sqr6.6%
unpow26.6%
*-commutative6.6%
Simplified6.6%
unpow26.6%
associate-*r*6.6%
*-commutative6.6%
Applied egg-rr6.6%
Taylor expanded in a around inf 42.1%
mul-1-neg42.1%
Simplified42.1%
Taylor expanded in a around 0 100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.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 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.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 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.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 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.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(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.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 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.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[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.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(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\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)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) Initial program 0.0%
associate--l+0.0%
fma-define0.0%
sqr-neg0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
fma-define0.0%
sqr-neg0.0%
Simplified6.6%
Taylor expanded in a around inf 91.4%
Final simplification97.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (- a 4.0) (pow a 3.0))))
(if (<= b 3.8e-147)
t_0
(if (<= b 3.8e-138)
-1.0
(if (<= b 4.2e-69)
t_0
(if (<= b 1.65e-43) -1.0 (if (<= b 2250.0) t_0 (pow b 4.0))))))))
double code(double a, double b) {
double t_0 = (a - 4.0) * pow(a, 3.0);
double tmp;
if (b <= 3.8e-147) {
tmp = t_0;
} else if (b <= 3.8e-138) {
tmp = -1.0;
} else if (b <= 4.2e-69) {
tmp = t_0;
} else if (b <= 1.65e-43) {
tmp = -1.0;
} else if (b <= 2250.0) {
tmp = t_0;
} else {
tmp = pow(b, 4.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 = (a - 4.0d0) * (a ** 3.0d0)
if (b <= 3.8d-147) then
tmp = t_0
else if (b <= 3.8d-138) then
tmp = -1.0d0
else if (b <= 4.2d-69) then
tmp = t_0
else if (b <= 1.65d-43) then
tmp = -1.0d0
else if (b <= 2250.0d0) then
tmp = t_0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (a - 4.0) * Math.pow(a, 3.0);
double tmp;
if (b <= 3.8e-147) {
tmp = t_0;
} else if (b <= 3.8e-138) {
tmp = -1.0;
} else if (b <= 4.2e-69) {
tmp = t_0;
} else if (b <= 1.65e-43) {
tmp = -1.0;
} else if (b <= 2250.0) {
tmp = t_0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): t_0 = (a - 4.0) * math.pow(a, 3.0) tmp = 0 if b <= 3.8e-147: tmp = t_0 elif b <= 3.8e-138: tmp = -1.0 elif b <= 4.2e-69: tmp = t_0 elif b <= 1.65e-43: tmp = -1.0 elif b <= 2250.0: tmp = t_0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) t_0 = Float64(Float64(a - 4.0) * (a ^ 3.0)) tmp = 0.0 if (b <= 3.8e-147) tmp = t_0; elseif (b <= 3.8e-138) tmp = -1.0; elseif (b <= 4.2e-69) tmp = t_0; elseif (b <= 1.65e-43) tmp = -1.0; elseif (b <= 2250.0) tmp = t_0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) t_0 = (a - 4.0) * (a ^ 3.0); tmp = 0.0; if (b <= 3.8e-147) tmp = t_0; elseif (b <= 3.8e-138) tmp = -1.0; elseif (b <= 4.2e-69) tmp = t_0; elseif (b <= 1.65e-43) tmp = -1.0; elseif (b <= 2250.0) tmp = t_0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(a - 4.0), $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3.8e-147], t$95$0, If[LessEqual[b, 3.8e-138], -1.0, If[LessEqual[b, 4.2e-69], t$95$0, If[LessEqual[b, 1.65e-43], -1.0, If[LessEqual[b, 2250.0], t$95$0, N[Power[b, 4.0], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(a - 4\right) \cdot {a}^{3}\\
\mathbf{if}\;b \leq 3.8 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-138}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 1.65 \cdot 10^{-43}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 2250:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 3.80000000000000028e-147 or 3.8000000000000002e-138 < b < 4.1999999999999999e-69 or 1.65000000000000008e-43 < b < 2250Initial program 71.6%
associate--l+71.6%
fma-define71.6%
sqr-neg71.6%
fma-define71.6%
distribute-rgt-in71.6%
sqr-neg71.6%
distribute-rgt-in71.6%
fma-define71.6%
sqr-neg71.6%
Simplified72.6%
Taylor expanded in a around inf 50.4%
associate-*r/50.4%
metadata-eval50.4%
Simplified50.4%
Taylor expanded in a around 0 50.3%
if 3.80000000000000028e-147 < b < 3.8000000000000002e-138 or 4.1999999999999999e-69 < b < 1.65000000000000008e-43Initial program 100.0%
associate--l+100.0%
fma-define100.0%
sqr-neg100.0%
fma-define100.0%
distribute-rgt-in100.0%
sqr-neg100.0%
distribute-rgt-in100.0%
fma-define100.0%
sqr-neg100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
fma-define100.0%
unpow2100.0%
unpow2100.0%
swap-sqr100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 100.0%
if 2250 < b Initial program 63.9%
associate--l+63.9%
fma-define63.9%
sqr-neg63.9%
fma-define63.9%
distribute-rgt-in63.9%
sqr-neg63.9%
distribute-rgt-in63.9%
fma-define63.9%
sqr-neg63.9%
Simplified68.6%
Taylor expanded in b around inf 91.1%
Final simplification61.5%
(FPCore (a b)
:precision binary64
(if (<= b 5.9e-148)
(pow a 4.0)
(if (<= b 2.2e-138)
-1.0
(if (<= b 3.1e-94)
(pow a 4.0)
(if (<= b 1.4e-5) -1.0 (if (<= b 2250.0) (pow a 4.0) (pow b 4.0)))))))
double code(double a, double b) {
double tmp;
if (b <= 5.9e-148) {
tmp = pow(a, 4.0);
} else if (b <= 2.2e-138) {
tmp = -1.0;
} else if (b <= 3.1e-94) {
tmp = pow(a, 4.0);
} else if (b <= 1.4e-5) {
tmp = -1.0;
} else if (b <= 2250.0) {
tmp = pow(a, 4.0);
} else {
tmp = 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 (b <= 5.9d-148) then
tmp = a ** 4.0d0
else if (b <= 2.2d-138) then
tmp = -1.0d0
else if (b <= 3.1d-94) then
tmp = a ** 4.0d0
else if (b <= 1.4d-5) then
tmp = -1.0d0
else if (b <= 2250.0d0) then
tmp = a ** 4.0d0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 5.9e-148) {
tmp = Math.pow(a, 4.0);
} else if (b <= 2.2e-138) {
tmp = -1.0;
} else if (b <= 3.1e-94) {
tmp = Math.pow(a, 4.0);
} else if (b <= 1.4e-5) {
tmp = -1.0;
} else if (b <= 2250.0) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 5.9e-148: tmp = math.pow(a, 4.0) elif b <= 2.2e-138: tmp = -1.0 elif b <= 3.1e-94: tmp = math.pow(a, 4.0) elif b <= 1.4e-5: tmp = -1.0 elif b <= 2250.0: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 5.9e-148) tmp = a ^ 4.0; elseif (b <= 2.2e-138) tmp = -1.0; elseif (b <= 3.1e-94) tmp = a ^ 4.0; elseif (b <= 1.4e-5) tmp = -1.0; elseif (b <= 2250.0) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 5.9e-148) tmp = a ^ 4.0; elseif (b <= 2.2e-138) tmp = -1.0; elseif (b <= 3.1e-94) tmp = a ^ 4.0; elseif (b <= 1.4e-5) tmp = -1.0; elseif (b <= 2250.0) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 5.9e-148], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 2.2e-138], -1.0, If[LessEqual[b, 3.1e-94], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 1.4e-5], -1.0, If[LessEqual[b, 2250.0], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.9 \cdot 10^{-148}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-138}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{-94}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{-5}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 2250:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 5.90000000000000016e-148 or 2.1999999999999999e-138 < b < 3.0999999999999998e-94 or 1.39999999999999998e-5 < b < 2250Initial program 70.6%
associate--l+70.6%
fma-define70.6%
sqr-neg70.6%
fma-define70.6%
distribute-rgt-in70.6%
sqr-neg70.6%
distribute-rgt-in70.6%
fma-define70.6%
sqr-neg70.6%
Simplified71.8%
Taylor expanded in a around inf 49.4%
if 5.90000000000000016e-148 < b < 2.1999999999999999e-138 or 3.0999999999999998e-94 < b < 1.39999999999999998e-5Initial program 88.5%
associate--l+88.5%
fma-define88.5%
sqr-neg88.5%
fma-define88.5%
distribute-rgt-in88.5%
sqr-neg88.5%
distribute-rgt-in88.5%
fma-define88.5%
sqr-neg88.5%
Simplified88.5%
Taylor expanded in b around 0 88.9%
fma-define88.9%
unpow288.9%
unpow288.9%
swap-sqr88.9%
unpow288.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in a around 0 61.5%
Taylor expanded in b around 0 61.5%
if 2250 < b Initial program 63.9%
associate--l+63.9%
fma-define63.9%
sqr-neg63.9%
fma-define63.9%
distribute-rgt-in63.9%
sqr-neg63.9%
distribute-rgt-in63.9%
fma-define63.9%
sqr-neg63.9%
Simplified68.6%
Taylor expanded in b around inf 91.1%
(FPCore (a b)
:precision binary64
(if (<= a -3.4e+76)
(pow a 4.0)
(if (<= a -7e-16)
(pow b 4.0)
(if (<= a 156.0)
(+ (* (pow b 2.0) 12.0) -1.0)
(* (pow a 4.0) (+ (+ 2.0 (/ -4.0 a)) -1.0))))))
double code(double a, double b) {
double tmp;
if (a <= -3.4e+76) {
tmp = pow(a, 4.0);
} else if (a <= -7e-16) {
tmp = pow(b, 4.0);
} else if (a <= 156.0) {
tmp = (pow(b, 2.0) * 12.0) + -1.0;
} else {
tmp = pow(a, 4.0) * ((2.0 + (-4.0 / 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 <= (-3.4d+76)) then
tmp = a ** 4.0d0
else if (a <= (-7d-16)) then
tmp = b ** 4.0d0
else if (a <= 156.0d0) then
tmp = ((b ** 2.0d0) * 12.0d0) + (-1.0d0)
else
tmp = (a ** 4.0d0) * ((2.0d0 + ((-4.0d0) / a)) + (-1.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -3.4e+76) {
tmp = Math.pow(a, 4.0);
} else if (a <= -7e-16) {
tmp = Math.pow(b, 4.0);
} else if (a <= 156.0) {
tmp = (Math.pow(b, 2.0) * 12.0) + -1.0;
} else {
tmp = Math.pow(a, 4.0) * ((2.0 + (-4.0 / a)) + -1.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -3.4e+76: tmp = math.pow(a, 4.0) elif a <= -7e-16: tmp = math.pow(b, 4.0) elif a <= 156.0: tmp = (math.pow(b, 2.0) * 12.0) + -1.0 else: tmp = math.pow(a, 4.0) * ((2.0 + (-4.0 / a)) + -1.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -3.4e+76) tmp = a ^ 4.0; elseif (a <= -7e-16) tmp = b ^ 4.0; elseif (a <= 156.0) tmp = Float64(Float64((b ^ 2.0) * 12.0) + -1.0); else tmp = Float64((a ^ 4.0) * Float64(Float64(2.0 + Float64(-4.0 / a)) + -1.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -3.4e+76) tmp = a ^ 4.0; elseif (a <= -7e-16) tmp = b ^ 4.0; elseif (a <= 156.0) tmp = ((b ^ 2.0) * 12.0) + -1.0; else tmp = (a ^ 4.0) * ((2.0 + (-4.0 / a)) + -1.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -3.4e+76], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, -7e-16], N[Power[b, 4.0], $MachinePrecision], If[LessEqual[a, 156.0], N[(N[(N[Power[b, 2.0], $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(N[(2.0 + N[(-4.0 / a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+76}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq -7 \cdot 10^{-16}:\\
\;\;\;\;{b}^{4}\\
\mathbf{elif}\;a \leq 156:\\
\;\;\;\;{b}^{2} \cdot 12 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(\left(2 + \frac{-4}{a}\right) + -1\right)\\
\end{array}
\end{array}
if a < -3.3999999999999997e76Initial program 51.9%
associate--l+51.9%
fma-define51.9%
sqr-neg51.9%
fma-define51.9%
distribute-rgt-in51.9%
sqr-neg51.9%
distribute-rgt-in51.9%
fma-define51.9%
sqr-neg51.9%
Simplified51.9%
Taylor expanded in a around inf 100.0%
if -3.3999999999999997e76 < a < -7.00000000000000035e-16Initial program 64.5%
associate--l+64.5%
fma-define64.5%
sqr-neg64.5%
fma-define64.5%
distribute-rgt-in64.5%
sqr-neg64.5%
distribute-rgt-in64.5%
fma-define64.5%
sqr-neg64.5%
Simplified64.5%
Taylor expanded in b around inf 61.7%
if -7.00000000000000035e-16 < a < 156Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in b around 0 63.0%
fma-define63.0%
unpow263.0%
unpow263.0%
swap-sqr79.5%
unpow279.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in a around 0 79.5%
if 156 < a Initial program 36.1%
associate--l+36.1%
fma-define36.1%
sqr-neg36.1%
fma-define36.1%
distribute-rgt-in36.1%
sqr-neg36.1%
distribute-rgt-in36.1%
fma-define36.1%
sqr-neg36.1%
Simplified43.3%
Taylor expanded in a around inf 88.9%
associate-*r/88.9%
metadata-eval88.9%
Simplified88.9%
expm1-log1p-u88.9%
sub-neg88.9%
distribute-neg-frac88.9%
metadata-eval88.9%
Applied egg-rr88.9%
expm1-undefine88.9%
sub-neg88.9%
log1p-undefine88.9%
rem-exp-log88.9%
associate-+r+88.9%
metadata-eval88.9%
metadata-eval88.9%
Simplified88.9%
Final simplification84.8%
(FPCore (a b)
:precision binary64
(if (<= a -8e+75)
(pow a 4.0)
(if (<= a -7e-16)
(pow b 4.0)
(if (<= a 330.0)
(+ (* (pow b 2.0) 12.0) -1.0)
(* (pow a 4.0) (- 1.0 (/ 4.0 a)))))))
double code(double a, double b) {
double tmp;
if (a <= -8e+75) {
tmp = pow(a, 4.0);
} else if (a <= -7e-16) {
tmp = pow(b, 4.0);
} else if (a <= 330.0) {
tmp = (pow(b, 2.0) * 12.0) + -1.0;
} else {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-8d+75)) then
tmp = a ** 4.0d0
else if (a <= (-7d-16)) then
tmp = b ** 4.0d0
else if (a <= 330.0d0) then
tmp = ((b ** 2.0d0) * 12.0d0) + (-1.0d0)
else
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -8e+75) {
tmp = Math.pow(a, 4.0);
} else if (a <= -7e-16) {
tmp = Math.pow(b, 4.0);
} else if (a <= 330.0) {
tmp = (Math.pow(b, 2.0) * 12.0) + -1.0;
} else {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -8e+75: tmp = math.pow(a, 4.0) elif a <= -7e-16: tmp = math.pow(b, 4.0) elif a <= 330.0: tmp = (math.pow(b, 2.0) * 12.0) + -1.0 else: tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) return tmp
function code(a, b) tmp = 0.0 if (a <= -8e+75) tmp = a ^ 4.0; elseif (a <= -7e-16) tmp = b ^ 4.0; elseif (a <= 330.0) tmp = Float64(Float64((b ^ 2.0) * 12.0) + -1.0); else tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -8e+75) tmp = a ^ 4.0; elseif (a <= -7e-16) tmp = b ^ 4.0; elseif (a <= 330.0) tmp = ((b ^ 2.0) * 12.0) + -1.0; else tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -8e+75], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, -7e-16], N[Power[b, 4.0], $MachinePrecision], If[LessEqual[a, 330.0], N[(N[(N[Power[b, 2.0], $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+75}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq -7 \cdot 10^{-16}:\\
\;\;\;\;{b}^{4}\\
\mathbf{elif}\;a \leq 330:\\
\;\;\;\;{b}^{2} \cdot 12 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\end{array}
\end{array}
if a < -7.99999999999999941e75Initial program 51.9%
associate--l+51.9%
fma-define51.9%
sqr-neg51.9%
fma-define51.9%
distribute-rgt-in51.9%
sqr-neg51.9%
distribute-rgt-in51.9%
fma-define51.9%
sqr-neg51.9%
Simplified51.9%
Taylor expanded in a around inf 100.0%
if -7.99999999999999941e75 < a < -7.00000000000000035e-16Initial program 64.5%
associate--l+64.5%
fma-define64.5%
sqr-neg64.5%
fma-define64.5%
distribute-rgt-in64.5%
sqr-neg64.5%
distribute-rgt-in64.5%
fma-define64.5%
sqr-neg64.5%
Simplified64.5%
Taylor expanded in b around inf 61.7%
if -7.00000000000000035e-16 < a < 330Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in b around 0 63.0%
fma-define63.0%
unpow263.0%
unpow263.0%
swap-sqr79.5%
unpow279.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in a around 0 79.5%
if 330 < a Initial program 36.1%
associate--l+36.1%
fma-define36.1%
sqr-neg36.1%
fma-define36.1%
distribute-rgt-in36.1%
sqr-neg36.1%
distribute-rgt-in36.1%
fma-define36.1%
sqr-neg36.1%
Simplified43.3%
Taylor expanded in a around inf 88.9%
associate-*r/88.9%
metadata-eval88.9%
Simplified88.9%
Final simplification84.8%
(FPCore (a b)
:precision binary64
(if (<= a -7.5e+75)
(pow a 4.0)
(if (<= a -6.4e-16)
(pow b 4.0)
(if (<= a 330.0)
(+ (* (pow b 2.0) 12.0) -1.0)
(* (- a 4.0) (pow a 3.0))))))
double code(double a, double b) {
double tmp;
if (a <= -7.5e+75) {
tmp = pow(a, 4.0);
} else if (a <= -6.4e-16) {
tmp = pow(b, 4.0);
} else if (a <= 330.0) {
tmp = (pow(b, 2.0) * 12.0) + -1.0;
} else {
tmp = (a - 4.0) * pow(a, 3.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-7.5d+75)) then
tmp = a ** 4.0d0
else if (a <= (-6.4d-16)) then
tmp = b ** 4.0d0
else if (a <= 330.0d0) then
tmp = ((b ** 2.0d0) * 12.0d0) + (-1.0d0)
else
tmp = (a - 4.0d0) * (a ** 3.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -7.5e+75) {
tmp = Math.pow(a, 4.0);
} else if (a <= -6.4e-16) {
tmp = Math.pow(b, 4.0);
} else if (a <= 330.0) {
tmp = (Math.pow(b, 2.0) * 12.0) + -1.0;
} else {
tmp = (a - 4.0) * Math.pow(a, 3.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -7.5e+75: tmp = math.pow(a, 4.0) elif a <= -6.4e-16: tmp = math.pow(b, 4.0) elif a <= 330.0: tmp = (math.pow(b, 2.0) * 12.0) + -1.0 else: tmp = (a - 4.0) * math.pow(a, 3.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -7.5e+75) tmp = a ^ 4.0; elseif (a <= -6.4e-16) tmp = b ^ 4.0; elseif (a <= 330.0) tmp = Float64(Float64((b ^ 2.0) * 12.0) + -1.0); else tmp = Float64(Float64(a - 4.0) * (a ^ 3.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -7.5e+75) tmp = a ^ 4.0; elseif (a <= -6.4e-16) tmp = b ^ 4.0; elseif (a <= 330.0) tmp = ((b ^ 2.0) * 12.0) + -1.0; else tmp = (a - 4.0) * (a ^ 3.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -7.5e+75], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, -6.4e-16], N[Power[b, 4.0], $MachinePrecision], If[LessEqual[a, 330.0], N[(N[(N[Power[b, 2.0], $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(a - 4.0), $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{+75}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq -6.4 \cdot 10^{-16}:\\
\;\;\;\;{b}^{4}\\
\mathbf{elif}\;a \leq 330:\\
\;\;\;\;{b}^{2} \cdot 12 + -1\\
\mathbf{else}:\\
\;\;\;\;\left(a - 4\right) \cdot {a}^{3}\\
\end{array}
\end{array}
if a < -7.4999999999999995e75Initial program 51.9%
associate--l+51.9%
fma-define51.9%
sqr-neg51.9%
fma-define51.9%
distribute-rgt-in51.9%
sqr-neg51.9%
distribute-rgt-in51.9%
fma-define51.9%
sqr-neg51.9%
Simplified51.9%
Taylor expanded in a around inf 100.0%
if -7.4999999999999995e75 < a < -6.40000000000000046e-16Initial program 64.5%
associate--l+64.5%
fma-define64.5%
sqr-neg64.5%
fma-define64.5%
distribute-rgt-in64.5%
sqr-neg64.5%
distribute-rgt-in64.5%
fma-define64.5%
sqr-neg64.5%
Simplified64.5%
Taylor expanded in b around inf 61.7%
if -6.40000000000000046e-16 < a < 330Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in b around 0 63.0%
fma-define63.0%
unpow263.0%
unpow263.0%
swap-sqr79.5%
unpow279.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in a around 0 79.5%
if 330 < a Initial program 36.1%
associate--l+36.1%
fma-define36.1%
sqr-neg36.1%
fma-define36.1%
distribute-rgt-in36.1%
sqr-neg36.1%
distribute-rgt-in36.1%
fma-define36.1%
sqr-neg36.1%
Simplified43.3%
Taylor expanded in a around inf 88.9%
associate-*r/88.9%
metadata-eval88.9%
Simplified88.9%
Taylor expanded in a around 0 88.9%
Final simplification84.8%
(FPCore (a b) :precision binary64 (if (<= b 58000000.0) (+ (* (pow a 2.0) (+ 4.0 (* a (- a 4.0)))) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if (b <= 58000000.0) {
tmp = (pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = 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 (b <= 58000000.0d0) then
tmp = ((a ** 2.0d0) * (4.0d0 + (a * (a - 4.0d0)))) + (-1.0d0)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 58000000.0) {
tmp = (Math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 58000000.0: tmp = (math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 58000000.0) tmp = Float64(Float64((a ^ 2.0) * Float64(4.0 + Float64(a * Float64(a - 4.0)))) + -1.0); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 58000000.0) tmp = ((a ^ 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 58000000.0], N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 58000000:\\
\;\;\;\;{a}^{2} \cdot \left(4 + a \cdot \left(a - 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 5.8e7Initial program 72.4%
associate--l+72.4%
fma-define72.4%
sqr-neg72.4%
fma-define72.4%
distribute-rgt-in72.4%
sqr-neg72.4%
distribute-rgt-in72.4%
fma-define72.4%
sqr-neg72.4%
Simplified73.5%
Taylor expanded in b around 0 55.8%
fma-define55.8%
unpow255.8%
unpow255.8%
swap-sqr66.2%
unpow266.2%
*-commutative66.2%
Simplified66.2%
unpow266.2%
associate-*r*66.2%
*-commutative66.2%
Applied egg-rr66.2%
Taylor expanded in b around 0 69.4%
Taylor expanded in a around 0 87.8%
Taylor expanded in b around 0 76.6%
if 5.8e7 < b Initial program 63.3%
associate--l+63.3%
fma-define63.3%
sqr-neg63.3%
fma-define63.3%
distribute-rgt-in63.3%
sqr-neg63.3%
distribute-rgt-in63.3%
fma-define63.3%
sqr-neg63.3%
Simplified68.1%
Taylor expanded in b around inf 92.5%
Final simplification80.5%
(FPCore (a b) :precision binary64 (if (or (<= a -1.4e-13) (not (<= a 2.85e-130))) (pow a 4.0) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -1.4e-13) || !(a <= 2.85e-130)) {
tmp = pow(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 <= (-1.4d-13)) .or. (.not. (a <= 2.85d-130))) then
tmp = 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 <= -1.4e-13) || !(a <= 2.85e-130)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -1.4e-13) or not (a <= 2.85e-130): tmp = math.pow(a, 4.0) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -1.4e-13) || !(a <= 2.85e-130)) tmp = a ^ 4.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -1.4e-13) || ~((a <= 2.85e-130))) tmp = a ^ 4.0; else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -1.4e-13], N[Not[LessEqual[a, 2.85e-130]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{-13} \lor \neg \left(a \leq 2.85 \cdot 10^{-130}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -1.4000000000000001e-13 or 2.8499999999999999e-130 < a Initial program 51.2%
associate--l+51.2%
fma-define51.2%
sqr-neg51.2%
fma-define51.2%
distribute-rgt-in51.2%
sqr-neg51.2%
distribute-rgt-in51.2%
fma-define51.2%
sqr-neg51.2%
Simplified54.4%
Taylor expanded in a around inf 77.3%
if -1.4000000000000001e-13 < a < 2.8499999999999999e-130Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in b around 0 59.4%
fma-define59.4%
unpow259.4%
unpow259.4%
swap-sqr78.4%
unpow278.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in a around 0 78.4%
Taylor expanded in b around 0 49.6%
Final simplification66.5%
(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 70.2%
associate--l+70.2%
fma-define70.2%
sqr-neg70.2%
fma-define70.2%
distribute-rgt-in70.2%
sqr-neg70.2%
distribute-rgt-in70.2%
fma-define70.2%
sqr-neg70.2%
Simplified72.2%
Taylor expanded in b around 0 49.5%
fma-define49.5%
unpow249.5%
unpow249.5%
swap-sqr61.6%
unpow261.6%
*-commutative61.6%
Simplified61.6%
Taylor expanded in a around 0 56.1%
Taylor expanded in b around 0 21.8%
herbie shell --seed 2024107
(FPCore (a b)
:name "Bouland and Aaronson, Equation (24)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))