
(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 14 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) (+ -1.0 t_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 = -1.0 + t_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 = -1.0 + t_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 = -1.0 + t_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(-1.0 + t_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 = -1.0 + t_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[(-1.0 + t$95$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:\\
\;\;\;\;-1 + t_0\\
\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 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 3 a))))) Initial program 0.0%
sub-neg0.0%
sqr-pow0.0%
sqr-pow0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
Simplified6.5%
Taylor expanded in a around inf 100.0%
Taylor expanded in a around inf 100.0%
Final simplification99.9%
(FPCore (a b) :precision binary64 (+ (+ (+ (+ (* 2.0 (* a (* b (* b a)))) (pow a 4.0)) (pow b 4.0)) (* 4.0 (* b (* b 3.0)))) -1.0))
double code(double a, double b) {
return ((((2.0 * (a * (b * (b * a)))) + pow(a, 4.0)) + pow(b, 4.0)) + (4.0 * (b * (b * 3.0)))) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((2.0d0 * (a * (b * (b * a)))) + (a ** 4.0d0)) + (b ** 4.0d0)) + (4.0d0 * (b * (b * 3.0d0)))) + (-1.0d0)
end function
public static double code(double a, double b) {
return ((((2.0 * (a * (b * (b * a)))) + Math.pow(a, 4.0)) + Math.pow(b, 4.0)) + (4.0 * (b * (b * 3.0)))) + -1.0;
}
def code(a, b): return ((((2.0 * (a * (b * (b * a)))) + math.pow(a, 4.0)) + math.pow(b, 4.0)) + (4.0 * (b * (b * 3.0)))) + -1.0
function code(a, b) return Float64(Float64(Float64(Float64(Float64(2.0 * Float64(a * Float64(b * Float64(b * a)))) + (a ^ 4.0)) + (b ^ 4.0)) + Float64(4.0 * Float64(b * Float64(b * 3.0)))) + -1.0) end
function tmp = code(a, b) tmp = ((((2.0 * (a * (b * (b * a)))) + (a ^ 4.0)) + (b ^ 4.0)) + (4.0 * (b * (b * 3.0)))) + -1.0; end
code[a_, b_] := N[(N[(N[(N[(N[(2.0 * N[(a * N[(b * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[(b * N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(2 \cdot \left(a \cdot \left(b \cdot \left(b \cdot a\right)\right)\right) + {a}^{4}\right) + {b}^{4}\right) + 4 \cdot \left(b \cdot \left(b \cdot 3\right)\right)\right) + -1
\end{array}
Initial program 75.6%
sub-neg75.6%
sqr-pow75.7%
sqr-pow75.6%
sqr-neg75.6%
distribute-rgt-in75.6%
sqr-neg75.6%
distribute-rgt-in75.6%
Simplified77.2%
Taylor expanded in a around 0 68.4%
associate-+r+68.4%
fma-def68.4%
unpow268.4%
unpow268.4%
Simplified68.4%
Taylor expanded in a around 0 86.7%
unpow286.7%
*-commutative86.7%
associate-*l*86.7%
Simplified86.7%
fma-udef86.7%
*-commutative86.7%
pow286.7%
pow286.7%
pow-prod-down99.2%
Applied egg-rr99.2%
unpow299.2%
associate-*r*99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (a b) :precision binary64 (if (or (<= a -2.4e+18) (not (<= a 115000.0))) (+ -1.0 (+ (* (* a (* b b)) (+ 4.0 (* 2.0 a))) (* (pow a 3.0) (+ a -4.0)))) (+ -1.0 (+ (pow b 4.0) (* b (* b 12.0))))))
double code(double a, double b) {
double tmp;
if ((a <= -2.4e+18) || !(a <= 115000.0)) {
tmp = -1.0 + (((a * (b * b)) * (4.0 + (2.0 * a))) + (pow(a, 3.0) * (a + -4.0)));
} else {
tmp = -1.0 + (pow(b, 4.0) + (b * (b * 12.0)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-2.4d+18)) .or. (.not. (a <= 115000.0d0))) then
tmp = (-1.0d0) + (((a * (b * b)) * (4.0d0 + (2.0d0 * a))) + ((a ** 3.0d0) * (a + (-4.0d0))))
else
tmp = (-1.0d0) + ((b ** 4.0d0) + (b * (b * 12.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -2.4e+18) || !(a <= 115000.0)) {
tmp = -1.0 + (((a * (b * b)) * (4.0 + (2.0 * a))) + (Math.pow(a, 3.0) * (a + -4.0)));
} else {
tmp = -1.0 + (Math.pow(b, 4.0) + (b * (b * 12.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -2.4e+18) or not (a <= 115000.0): tmp = -1.0 + (((a * (b * b)) * (4.0 + (2.0 * a))) + (math.pow(a, 3.0) * (a + -4.0))) else: tmp = -1.0 + (math.pow(b, 4.0) + (b * (b * 12.0))) return tmp
function code(a, b) tmp = 0.0 if ((a <= -2.4e+18) || !(a <= 115000.0)) tmp = Float64(-1.0 + Float64(Float64(Float64(a * Float64(b * b)) * Float64(4.0 + Float64(2.0 * a))) + Float64((a ^ 3.0) * Float64(a + -4.0)))); else tmp = Float64(-1.0 + Float64((b ^ 4.0) + Float64(b * Float64(b * 12.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -2.4e+18) || ~((a <= 115000.0))) tmp = -1.0 + (((a * (b * b)) * (4.0 + (2.0 * a))) + ((a ^ 3.0) * (a + -4.0))); else tmp = -1.0 + ((b ^ 4.0) + (b * (b * 12.0))); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -2.4e+18], N[Not[LessEqual[a, 115000.0]], $MachinePrecision]], N[(-1.0 + N[(N[(N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(4.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + N[(b * N[(b * 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+18} \lor \neg \left(a \leq 115000\right):\\
\;\;\;\;-1 + \left(\left(a \cdot \left(b \cdot b\right)\right) \cdot \left(4 + 2 \cdot a\right) + {a}^{3} \cdot \left(a + -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({b}^{4} + b \cdot \left(b \cdot 12\right)\right)\\
\end{array}
\end{array}
if a < -2.4e18 or 115000 < a Initial program 48.6%
sub-neg48.6%
sqr-pow48.7%
sqr-pow48.6%
sqr-neg48.6%
distribute-rgt-in48.6%
sqr-neg48.6%
distribute-rgt-in48.6%
Simplified52.0%
Taylor expanded in a around 0 46.3%
associate-+r+46.3%
fma-def46.3%
unpow246.3%
unpow246.3%
Simplified46.3%
Taylor expanded in a around inf 47.0%
+-commutative47.0%
associate-+r+47.0%
associate-+l+47.0%
*-commutative47.0%
unpow247.0%
associate-*l*47.0%
*-commutative47.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
fma-udef47.0%
associate-*l*47.0%
distribute-lft-out55.2%
Simplified89.1%
Taylor expanded in b around inf 98.2%
unpow298.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
if -2.4e18 < a < 115000Initial program 99.8%
sub-neg99.8%
sqr-pow99.8%
sqr-pow99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
Simplified99.8%
Taylor expanded in a around 0 91.8%
+-commutative91.8%
+-commutative91.8%
associate-+l+91.8%
unpow291.8%
unpow291.8%
associate-*r*91.8%
distribute-rgt-in98.5%
metadata-eval98.5%
distribute-lft-in98.5%
associate-*l*98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in a around 0 98.5%
unpow298.5%
*-commutative98.5%
associate-*l*98.5%
Simplified98.5%
Final simplification98.3%
(FPCore (a b) :precision binary64 (if (or (<= a -4e+18) (not (<= a 3.7e+59))) (pow a 4.0) (+ -1.0 (+ (pow b 4.0) (* b (* b (* 4.0 (+ a 3.0))))))))
double code(double a, double b) {
double tmp;
if ((a <= -4e+18) || !(a <= 3.7e+59)) {
tmp = pow(a, 4.0);
} else {
tmp = -1.0 + (pow(b, 4.0) + (b * (b * (4.0 * (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 <= (-4d+18)) .or. (.not. (a <= 3.7d+59))) then
tmp = a ** 4.0d0
else
tmp = (-1.0d0) + ((b ** 4.0d0) + (b * (b * (4.0d0 * (a + 3.0d0)))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -4e+18) || !(a <= 3.7e+59)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0 + (Math.pow(b, 4.0) + (b * (b * (4.0 * (a + 3.0)))));
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -4e+18) or not (a <= 3.7e+59): tmp = math.pow(a, 4.0) else: tmp = -1.0 + (math.pow(b, 4.0) + (b * (b * (4.0 * (a + 3.0))))) return tmp
function code(a, b) tmp = 0.0 if ((a <= -4e+18) || !(a <= 3.7e+59)) tmp = a ^ 4.0; else tmp = Float64(-1.0 + Float64((b ^ 4.0) + Float64(b * Float64(b * Float64(4.0 * Float64(a + 3.0)))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -4e+18) || ~((a <= 3.7e+59))) tmp = a ^ 4.0; else tmp = -1.0 + ((b ^ 4.0) + (b * (b * (4.0 * (a + 3.0))))); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -4e+18], N[Not[LessEqual[a, 3.7e+59]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + N[(b * N[(b * N[(4.0 * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4 \cdot 10^{+18} \lor \neg \left(a \leq 3.7 \cdot 10^{+59}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({b}^{4} + b \cdot \left(b \cdot \left(4 \cdot \left(a + 3\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < -4e18 or 3.69999999999999997e59 < a Initial program 43.0%
sub-neg43.0%
sqr-pow43.1%
sqr-pow43.0%
sqr-neg43.0%
distribute-rgt-in43.0%
sqr-neg43.0%
distribute-rgt-in43.0%
Simplified46.7%
Taylor expanded in a around inf 97.8%
Taylor expanded in a around inf 97.8%
if -4e18 < a < 3.69999999999999997e59Initial program 99.8%
sub-neg99.8%
sqr-pow99.8%
sqr-pow99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
Simplified99.8%
Taylor expanded in a around 0 89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l+89.8%
unpow289.8%
unpow289.8%
associate-*r*89.8%
distribute-rgt-in95.9%
metadata-eval95.9%
distribute-lft-in95.9%
associate-*l*95.9%
+-commutative95.9%
Simplified95.9%
Final simplification96.7%
(FPCore (a b) :precision binary64 (if (<= a -9.5e+25) (pow a 4.0) (if (<= a 1.7e+58) (+ -1.0 (+ (pow b 4.0) (* b (* b 12.0)))) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -9.5e+25) {
tmp = pow(a, 4.0);
} else if (a <= 1.7e+58) {
tmp = -1.0 + (pow(b, 4.0) + (b * (b * 12.0)));
} else {
tmp = pow(a, 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 <= (-9.5d+25)) then
tmp = a ** 4.0d0
else if (a <= 1.7d+58) then
tmp = (-1.0d0) + ((b ** 4.0d0) + (b * (b * 12.0d0)))
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -9.5e+25) {
tmp = Math.pow(a, 4.0);
} else if (a <= 1.7e+58) {
tmp = -1.0 + (Math.pow(b, 4.0) + (b * (b * 12.0)));
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -9.5e+25: tmp = math.pow(a, 4.0) elif a <= 1.7e+58: tmp = -1.0 + (math.pow(b, 4.0) + (b * (b * 12.0))) else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -9.5e+25) tmp = a ^ 4.0; elseif (a <= 1.7e+58) tmp = Float64(-1.0 + Float64((b ^ 4.0) + Float64(b * Float64(b * 12.0)))); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -9.5e+25) tmp = a ^ 4.0; elseif (a <= 1.7e+58) tmp = -1.0 + ((b ^ 4.0) + (b * (b * 12.0))); else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -9.5e+25], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1.7e+58], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + N[(b * N[(b * 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{+25}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{+58}:\\
\;\;\;\;-1 + \left({b}^{4} + b \cdot \left(b \cdot 12\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -9.5000000000000005e25 or 1.7e58 < a Initial program 43.0%
sub-neg43.0%
sqr-pow43.1%
sqr-pow43.0%
sqr-neg43.0%
distribute-rgt-in43.0%
sqr-neg43.0%
distribute-rgt-in43.0%
Simplified46.7%
Taylor expanded in a around inf 97.8%
Taylor expanded in a around inf 97.8%
if -9.5000000000000005e25 < a < 1.7e58Initial program 99.8%
sub-neg99.8%
sqr-pow99.8%
sqr-pow99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
Simplified99.8%
Taylor expanded in a around 0 89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l+89.8%
unpow289.8%
unpow289.8%
associate-*r*89.8%
distribute-rgt-in95.9%
metadata-eval95.9%
distribute-lft-in95.9%
associate-*l*95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in a around 0 95.9%
unpow295.9%
*-commutative95.9%
associate-*l*95.9%
Simplified95.9%
Final simplification96.7%
(FPCore (a b) :precision binary64 (if (<= a -5.6e+32) (pow a 4.0) (if (<= a 3.85e+59) (+ (pow b 4.0) -1.0) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -5.6e+32) {
tmp = pow(a, 4.0);
} else if (a <= 3.85e+59) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = pow(a, 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 <= (-5.6d+32)) then
tmp = a ** 4.0d0
else if (a <= 3.85d+59) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -5.6e+32) {
tmp = Math.pow(a, 4.0);
} else if (a <= 3.85e+59) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -5.6e+32: tmp = math.pow(a, 4.0) elif a <= 3.85e+59: tmp = math.pow(b, 4.0) + -1.0 else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -5.6e+32) tmp = a ^ 4.0; elseif (a <= 3.85e+59) tmp = Float64((b ^ 4.0) + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -5.6e+32) tmp = a ^ 4.0; elseif (a <= 3.85e+59) tmp = (b ^ 4.0) + -1.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -5.6e+32], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 3.85e+59], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{+32}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 3.85 \cdot 10^{+59}:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -5.6e32 or 3.84999999999999993e59 < a Initial program 43.0%
sub-neg43.0%
sqr-pow43.1%
sqr-pow43.0%
sqr-neg43.0%
distribute-rgt-in43.0%
sqr-neg43.0%
distribute-rgt-in43.0%
Simplified46.7%
Taylor expanded in a around inf 97.8%
Taylor expanded in a around inf 97.8%
if -5.6e32 < a < 3.84999999999999993e59Initial program 99.8%
sub-neg99.8%
sqr-pow99.8%
sqr-pow99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
Simplified99.8%
Taylor expanded in b around inf 95.7%
Final simplification96.6%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5e+298) (+ (pow a 4.0) -1.0) (+ -1.0 (* (* b b) 12.0))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e+298) {
tmp = pow(a, 4.0) + -1.0;
} else {
tmp = -1.0 + ((b * b) * 12.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 5d+298) then
tmp = (a ** 4.0d0) + (-1.0d0)
else
tmp = (-1.0d0) + ((b * b) * 12.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 5e+298) {
tmp = Math.pow(a, 4.0) + -1.0;
} else {
tmp = -1.0 + ((b * b) * 12.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 5e+298: tmp = math.pow(a, 4.0) + -1.0 else: tmp = -1.0 + ((b * b) * 12.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e+298) tmp = Float64((a ^ 4.0) + -1.0); else tmp = Float64(-1.0 + Float64(Float64(b * b) * 12.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 5e+298) tmp = (a ^ 4.0) + -1.0; else tmp = -1.0 + ((b * b) * 12.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e+298], N[(N[Power[a, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{+298}:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\
\end{array}
\end{array}
if (*.f64 b b) < 5.0000000000000003e298Initial program 77.7%
sub-neg77.7%
sqr-pow77.7%
sqr-pow77.7%
sqr-neg77.7%
distribute-rgt-in77.7%
sqr-neg77.7%
distribute-rgt-in77.7%
Simplified78.7%
Taylor expanded in a around inf 79.8%
if 5.0000000000000003e298 < (*.f64 b b) Initial program 68.4%
sub-neg68.4%
sqr-pow68.4%
sqr-pow68.4%
sqr-neg68.4%
distribute-rgt-in68.4%
sqr-neg68.4%
distribute-rgt-in68.4%
Simplified71.9%
Taylor expanded in a around 0 64.9%
+-commutative64.9%
+-commutative64.9%
associate-+l+64.9%
unpow264.9%
unpow264.9%
associate-*r*64.9%
distribute-rgt-in80.7%
metadata-eval80.7%
distribute-lft-in80.7%
associate-*l*80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in b around 0 77.6%
unpow277.6%
*-commutative77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in a around 0 96.9%
unpow296.9%
Simplified96.9%
Final simplification83.6%
(FPCore (a b) :precision binary64 (if (or (<= a -1.65) (not (<= a 1.1e+42))) (pow a 4.0) (+ -1.0 (* 4.0 (* (* b b) (+ a 3.0))))))
double code(double a, double b) {
double tmp;
if ((a <= -1.65) || !(a <= 1.1e+42)) {
tmp = pow(a, 4.0);
} else {
tmp = -1.0 + (4.0 * ((b * b) * (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 <= (-1.65d0)) .or. (.not. (a <= 1.1d+42))) then
tmp = a ** 4.0d0
else
tmp = (-1.0d0) + (4.0d0 * ((b * b) * (a + 3.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -1.65) || !(a <= 1.1e+42)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -1.65) or not (a <= 1.1e+42): tmp = math.pow(a, 4.0) else: tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0))) return tmp
function code(a, b) tmp = 0.0 if ((a <= -1.65) || !(a <= 1.1e+42)) tmp = a ^ 4.0; else tmp = Float64(-1.0 + Float64(4.0 * Float64(Float64(b * b) * Float64(a + 3.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -1.65) || ~((a <= 1.1e+42))) tmp = a ^ 4.0; else tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0))); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -1.65], N[Not[LessEqual[a, 1.1e+42]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(-1.0 + N[(4.0 * N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.65 \lor \neg \left(a \leq 1.1 \cdot 10^{+42}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\
\end{array}
\end{array}
if a < -1.6499999999999999 or 1.1000000000000001e42 < a Initial program 46.0%
sub-neg46.0%
sqr-pow46.0%
sqr-pow46.0%
sqr-neg46.0%
distribute-rgt-in46.0%
sqr-neg46.0%
distribute-rgt-in46.0%
Simplified49.5%
Taylor expanded in a around inf 94.0%
Taylor expanded in a around inf 94.0%
if -1.6499999999999999 < a < 1.1000000000000001e42Initial program 99.8%
sub-neg99.8%
sqr-pow99.8%
sqr-pow99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
Simplified99.8%
Taylor expanded in a around 0 90.8%
+-commutative90.8%
+-commutative90.8%
associate-+l+90.8%
unpow290.8%
unpow290.8%
associate-*r*90.8%
distribute-rgt-in97.1%
metadata-eval97.1%
distribute-lft-in97.1%
associate-*l*97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in b around 0 73.5%
unpow273.5%
*-commutative73.5%
+-commutative73.5%
Simplified73.5%
Final simplification82.7%
(FPCore (a b) :precision binary64 (if (<= a -7e-10) (+ -1.0 (* (* b b) 12.0)) (+ -1.0 (* 4.0 (* (* b b) (+ a 3.0))))))
double code(double a, double b) {
double tmp;
if (a <= -7e-10) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + (4.0 * ((b * b) * (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 <= (-7d-10)) then
tmp = (-1.0d0) + ((b * b) * 12.0d0)
else
tmp = (-1.0d0) + (4.0d0 * ((b * b) * (a + 3.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -7e-10) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -7e-10: tmp = -1.0 + ((b * b) * 12.0) else: tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0))) return tmp
function code(a, b) tmp = 0.0 if (a <= -7e-10) tmp = Float64(-1.0 + Float64(Float64(b * b) * 12.0)); else tmp = Float64(-1.0 + Float64(4.0 * Float64(Float64(b * b) * Float64(a + 3.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -7e-10) tmp = -1.0 + ((b * b) * 12.0); else tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -7e-10], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(4.0 * N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{-10}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\
\mathbf{else}:\\
\;\;\;\;-1 + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\
\end{array}
\end{array}
if a < -6.99999999999999961e-10Initial program 68.1%
sub-neg68.1%
sqr-pow68.1%
sqr-pow68.1%
sqr-neg68.1%
distribute-rgt-in68.1%
sqr-neg68.1%
distribute-rgt-in68.1%
Simplified68.1%
Taylor expanded in a around 0 9.1%
+-commutative9.1%
+-commutative9.1%
associate-+l+9.1%
unpow29.1%
unpow29.1%
associate-*r*9.1%
distribute-rgt-in9.1%
metadata-eval9.1%
distribute-lft-in9.1%
associate-*l*9.1%
+-commutative9.1%
Simplified9.1%
Taylor expanded in b around 0 1.5%
unpow21.5%
*-commutative1.5%
+-commutative1.5%
Simplified1.5%
Taylor expanded in a around 0 19.9%
unpow219.9%
Simplified19.9%
if -6.99999999999999961e-10 < a Initial program 78.3%
sub-neg78.3%
sqr-pow78.3%
sqr-pow78.3%
sqr-neg78.3%
distribute-rgt-in78.3%
sqr-neg78.3%
distribute-rgt-in78.3%
Simplified80.4%
Taylor expanded in a around 0 77.5%
+-commutative77.5%
+-commutative77.5%
associate-+l+77.5%
unpow277.5%
unpow277.5%
associate-*r*77.5%
distribute-rgt-in82.3%
metadata-eval82.3%
distribute-lft-in82.3%
associate-*l*82.3%
+-commutative82.3%
Simplified82.3%
Taylor expanded in b around 0 64.1%
unpow264.1%
*-commutative64.1%
+-commutative64.1%
Simplified64.1%
Final simplification52.7%
(FPCore (a b) :precision binary64 (if (<= a -2.3e-6) (+ -1.0 (* (* a a) (+ 4.0 (* a -4.0)))) (+ -1.0 (* 4.0 (* (* b b) (+ a 3.0))))))
double code(double a, double b) {
double tmp;
if (a <= -2.3e-6) {
tmp = -1.0 + ((a * a) * (4.0 + (a * -4.0)));
} else {
tmp = -1.0 + (4.0 * ((b * b) * (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 <= (-2.3d-6)) then
tmp = (-1.0d0) + ((a * a) * (4.0d0 + (a * (-4.0d0))))
else
tmp = (-1.0d0) + (4.0d0 * ((b * b) * (a + 3.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -2.3e-6) {
tmp = -1.0 + ((a * a) * (4.0 + (a * -4.0)));
} else {
tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.3e-6: tmp = -1.0 + ((a * a) * (4.0 + (a * -4.0))) else: tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0))) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.3e-6) tmp = Float64(-1.0 + Float64(Float64(a * a) * Float64(4.0 + Float64(a * -4.0)))); else tmp = Float64(-1.0 + Float64(4.0 * Float64(Float64(b * b) * Float64(a + 3.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.3e-6) tmp = -1.0 + ((a * a) * (4.0 + (a * -4.0))); else tmp = -1.0 + (4.0 * ((b * b) * (a + 3.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.3e-6], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(4.0 * N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-6}:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot \left(4 + a \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\
\end{array}
\end{array}
if a < -2.3e-6Initial program 68.1%
sub-neg68.1%
sqr-pow68.1%
sqr-pow68.1%
sqr-neg68.1%
distribute-rgt-in68.1%
sqr-neg68.1%
distribute-rgt-in68.1%
Simplified68.1%
Taylor expanded in a around inf 95.2%
fma-def95.2%
fma-def95.2%
unpow295.2%
unpow295.2%
Simplified95.2%
Taylor expanded in a around 0 77.9%
+-commutative77.9%
+-commutative77.9%
unpow277.9%
fma-udef77.9%
*-commutative77.9%
unpow377.9%
unpow277.9%
associate-*l*77.9%
distribute-lft-out77.9%
unpow277.9%
Simplified77.9%
Taylor expanded in b around 0 72.0%
unpow272.0%
*-commutative72.0%
*-commutative72.0%
Simplified72.0%
if -2.3e-6 < a Initial program 78.3%
sub-neg78.3%
sqr-pow78.3%
sqr-pow78.3%
sqr-neg78.3%
distribute-rgt-in78.3%
sqr-neg78.3%
distribute-rgt-in78.3%
Simplified80.4%
Taylor expanded in a around 0 77.5%
+-commutative77.5%
+-commutative77.5%
associate-+l+77.5%
unpow277.5%
unpow277.5%
associate-*r*77.5%
distribute-rgt-in82.3%
metadata-eval82.3%
distribute-lft-in82.3%
associate-*l*82.3%
+-commutative82.3%
Simplified82.3%
Taylor expanded in b around 0 64.1%
unpow264.1%
*-commutative64.1%
+-commutative64.1%
Simplified64.1%
Final simplification66.2%
(FPCore (a b) :precision binary64 (if (<= a 9.6e-12) (+ -1.0 (* (* b b) 12.0)) (+ -1.0 (* b (* a (* b 4.0))))))
double code(double a, double b) {
double tmp;
if (a <= 9.6e-12) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + (b * (a * (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 <= 9.6d-12) then
tmp = (-1.0d0) + ((b * b) * 12.0d0)
else
tmp = (-1.0d0) + (b * (a * (b * 4.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= 9.6e-12) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + (b * (a * (b * 4.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= 9.6e-12: tmp = -1.0 + ((b * b) * 12.0) else: tmp = -1.0 + (b * (a * (b * 4.0))) return tmp
function code(a, b) tmp = 0.0 if (a <= 9.6e-12) tmp = Float64(-1.0 + Float64(Float64(b * b) * 12.0)); else tmp = Float64(-1.0 + Float64(b * Float64(a * Float64(b * 4.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= 9.6e-12) tmp = -1.0 + ((b * b) * 12.0); else tmp = -1.0 + (b * (a * (b * 4.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, 9.6e-12], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(b * N[(a * N[(b * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.6 \cdot 10^{-12}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\
\mathbf{else}:\\
\;\;\;\;-1 + b \cdot \left(a \cdot \left(b \cdot 4\right)\right)\\
\end{array}
\end{array}
if a < 9.59999999999999948e-12Initial program 88.9%
sub-neg88.9%
sqr-pow88.9%
sqr-pow88.9%
sqr-neg88.9%
distribute-rgt-in88.9%
sqr-neg88.9%
distribute-rgt-in88.9%
Simplified88.9%
Taylor expanded in a around 0 64.1%
+-commutative64.1%
+-commutative64.1%
associate-+l+64.1%
unpow264.1%
unpow264.1%
associate-*r*64.1%
distribute-rgt-in68.8%
metadata-eval68.8%
distribute-lft-in68.8%
associate-*l*68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in b around 0 50.2%
unpow250.2%
*-commutative50.2%
+-commutative50.2%
Simplified50.2%
Taylor expanded in a around 0 56.5%
unpow256.5%
Simplified56.5%
if 9.59999999999999948e-12 < a Initial program 35.8%
sub-neg35.8%
sqr-pow35.8%
sqr-pow35.8%
sqr-neg35.8%
distribute-rgt-in35.8%
sqr-neg35.8%
distribute-rgt-in35.8%
Simplified42.1%
Taylor expanded in a around 0 47.3%
+-commutative47.3%
+-commutative47.3%
associate-+l+47.3%
unpow247.3%
unpow247.3%
associate-*r*47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
distribute-lft-in47.3%
associate-*l*47.3%
+-commutative47.3%
Simplified47.3%
Taylor expanded in a around inf 41.3%
unpow241.3%
associate-*r*41.3%
associate-*r*41.3%
associate-*r*41.3%
*-commutative41.3%
associate-*l*41.3%
*-commutative41.3%
Simplified41.3%
Final simplification52.7%
(FPCore (a b) :precision binary64 (if (<= a 2e-15) (+ -1.0 (* (* b b) 12.0)) (+ -1.0 (* (* b b) (* a 4.0)))))
double code(double a, double b) {
double tmp;
if (a <= 2e-15) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + ((b * b) * (a * 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 <= 2d-15) then
tmp = (-1.0d0) + ((b * b) * 12.0d0)
else
tmp = (-1.0d0) + ((b * b) * (a * 4.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= 2e-15) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + ((b * b) * (a * 4.0));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= 2e-15: tmp = -1.0 + ((b * b) * 12.0) else: tmp = -1.0 + ((b * b) * (a * 4.0)) return tmp
function code(a, b) tmp = 0.0 if (a <= 2e-15) tmp = Float64(-1.0 + Float64(Float64(b * b) * 12.0)); else tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(a * 4.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= 2e-15) tmp = -1.0 + ((b * b) * 12.0); else tmp = -1.0 + ((b * b) * (a * 4.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, 2e-15], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2 \cdot 10^{-15}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(a \cdot 4\right)\\
\end{array}
\end{array}
if a < 2.0000000000000002e-15Initial program 88.9%
sub-neg88.9%
sqr-pow88.9%
sqr-pow88.9%
sqr-neg88.9%
distribute-rgt-in88.9%
sqr-neg88.9%
distribute-rgt-in88.9%
Simplified88.9%
Taylor expanded in a around 0 64.1%
+-commutative64.1%
+-commutative64.1%
associate-+l+64.1%
unpow264.1%
unpow264.1%
associate-*r*64.1%
distribute-rgt-in68.8%
metadata-eval68.8%
distribute-lft-in68.8%
associate-*l*68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in b around 0 50.2%
unpow250.2%
*-commutative50.2%
+-commutative50.2%
Simplified50.2%
Taylor expanded in a around 0 56.5%
unpow256.5%
Simplified56.5%
if 2.0000000000000002e-15 < a Initial program 35.8%
sub-neg35.8%
sqr-pow35.8%
sqr-pow35.8%
sqr-neg35.8%
distribute-rgt-in35.8%
sqr-neg35.8%
distribute-rgt-in35.8%
Simplified42.1%
Taylor expanded in a around 0 47.3%
+-commutative47.3%
+-commutative47.3%
associate-+l+47.3%
unpow247.3%
unpow247.3%
associate-*r*47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
distribute-lft-in47.3%
associate-*l*47.3%
+-commutative47.3%
Simplified47.3%
Taylor expanded in a around inf 41.3%
*-commutative41.3%
unpow241.3%
*-commutative41.3%
associate-*l*41.3%
Simplified41.3%
Final simplification52.7%
(FPCore (a b) :precision binary64 (+ -1.0 (* (* b b) 12.0)))
double code(double a, double b) {
return -1.0 + ((b * b) * 12.0);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (-1.0d0) + ((b * b) * 12.0d0)
end function
public static double code(double a, double b) {
return -1.0 + ((b * b) * 12.0);
}
def code(a, b): return -1.0 + ((b * b) * 12.0)
function code(a, b) return Float64(-1.0 + Float64(Float64(b * b) * 12.0)) end
function tmp = code(a, b) tmp = -1.0 + ((b * b) * 12.0); end
code[a_, b_] := N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + \left(b \cdot b\right) \cdot 12
\end{array}
Initial program 75.6%
sub-neg75.6%
sqr-pow75.7%
sqr-pow75.6%
sqr-neg75.6%
distribute-rgt-in75.6%
sqr-neg75.6%
distribute-rgt-in75.6%
Simplified77.2%
Taylor expanded in a around 0 59.9%
+-commutative59.9%
+-commutative59.9%
associate-+l+59.9%
unpow259.9%
unpow259.9%
associate-*r*59.9%
distribute-rgt-in63.4%
metadata-eval63.4%
distribute-lft-in63.4%
associate-*l*63.4%
+-commutative63.4%
Simplified63.4%
Taylor expanded in b around 0 48.0%
unpow248.0%
*-commutative48.0%
+-commutative48.0%
Simplified48.0%
Taylor expanded in a around 0 49.6%
unpow249.6%
Simplified49.6%
Final simplification49.6%
(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 75.6%
sub-neg75.6%
sqr-pow75.7%
sqr-pow75.6%
sqr-neg75.6%
distribute-rgt-in75.6%
sqr-neg75.6%
distribute-rgt-in75.6%
Simplified77.2%
Taylor expanded in a around inf 69.7%
Taylor expanded in a around 0 26.7%
Final simplification26.7%
herbie shell --seed 2023271
(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))