
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (+ (+ (* z (- 1.0 (log t))) (+ x y)) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((z * (1.0 - log(t))) + (x + y)) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((z * (1.0d0 - log(t))) + (x + y)) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((z * (1.0 - Math.log(t))) + (x + y)) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return ((z * (1.0 - math.log(t))) + (x + y)) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(z * Float64(1.0 - log(t))) + Float64(x + y)) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((z * (1.0 - log(t))) + (x + y)) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \left(1 - \log t\right) + \left(x + y\right)\right) + \left(a - 0.5\right) \cdot b
\end{array}
Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
sub-neg99.9%
*-un-lft-identity99.9%
*-commutative99.9%
distribute-rgt-out--99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= z -2.35e+120) (not (<= z 5.4e+149)))
(+ t_1 (+ z (- y (* z (log t)))))
(+ t_1 (+ x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((z <= -2.35e+120) || !(z <= 5.4e+149)) {
tmp = t_1 + (z + (y - (z * log(t))));
} else {
tmp = t_1 + (x + y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if ((z <= (-2.35d+120)) .or. (.not. (z <= 5.4d+149))) then
tmp = t_1 + (z + (y - (z * log(t))))
else
tmp = t_1 + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((z <= -2.35e+120) || !(z <= 5.4e+149)) {
tmp = t_1 + (z + (y - (z * Math.log(t))));
} else {
tmp = t_1 + (x + y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if (z <= -2.35e+120) or not (z <= 5.4e+149): tmp = t_1 + (z + (y - (z * math.log(t)))) else: tmp = t_1 + (x + y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if ((z <= -2.35e+120) || !(z <= 5.4e+149)) tmp = Float64(t_1 + Float64(z + Float64(y - Float64(z * log(t))))); else tmp = Float64(t_1 + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if ((z <= -2.35e+120) || ~((z <= 5.4e+149))) tmp = t_1 + (z + (y - (z * log(t)))); else tmp = t_1 + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[z, -2.35e+120], N[Not[LessEqual[z, 5.4e+149]], $MachinePrecision]], N[(t$95$1 + N[(z + N[(y - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{+120} \lor \neg \left(z \leq 5.4 \cdot 10^{+149}\right):\\
\;\;\;\;t\_1 + \left(z + \left(y - z \cdot \log t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(x + y\right)\\
\end{array}
\end{array}
if z < -2.34999999999999997e120 or 5.4000000000000002e149 < z Initial program 99.7%
Taylor expanded in x around 0 94.6%
+-commutative94.6%
associate--l+94.6%
Simplified94.6%
if -2.34999999999999997e120 < z < 5.4000000000000002e149Initial program 100.0%
Taylor expanded in z around 0 95.2%
+-commutative95.2%
Simplified95.2%
Final simplification95.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= z -1.85e+148) (not (<= z 1.65e+151)))
(+ (* z (- 1.0 (log t))) t_1)
(+ t_1 (+ x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((z <= -1.85e+148) || !(z <= 1.65e+151)) {
tmp = (z * (1.0 - log(t))) + t_1;
} else {
tmp = t_1 + (x + y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if ((z <= (-1.85d+148)) .or. (.not. (z <= 1.65d+151))) then
tmp = (z * (1.0d0 - log(t))) + t_1
else
tmp = t_1 + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((z <= -1.85e+148) || !(z <= 1.65e+151)) {
tmp = (z * (1.0 - Math.log(t))) + t_1;
} else {
tmp = t_1 + (x + y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if (z <= -1.85e+148) or not (z <= 1.65e+151): tmp = (z * (1.0 - math.log(t))) + t_1 else: tmp = t_1 + (x + y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if ((z <= -1.85e+148) || !(z <= 1.65e+151)) tmp = Float64(Float64(z * Float64(1.0 - log(t))) + t_1); else tmp = Float64(t_1 + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if ((z <= -1.85e+148) || ~((z <= 1.65e+151))) tmp = (z * (1.0 - log(t))) + t_1; else tmp = t_1 + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[z, -1.85e+148], N[Not[LessEqual[z, 1.65e+151]], $MachinePrecision]], N[(N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 + N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+148} \lor \neg \left(z \leq 1.65 \cdot 10^{+151}\right):\\
\;\;\;\;z \cdot \left(1 - \log t\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(x + y\right)\\
\end{array}
\end{array}
if z < -1.8500000000000001e148 or 1.65000000000000012e151 < z Initial program 99.7%
Taylor expanded in x around 0 94.1%
+-commutative94.1%
associate--l+94.1%
Simplified94.1%
Taylor expanded in z around inf 87.9%
if -1.8500000000000001e148 < z < 1.65000000000000012e151Initial program 100.0%
Taylor expanded in z around 0 94.5%
+-commutative94.5%
Simplified94.5%
Final simplification92.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -4.2e+120) (not (<= z 3.5e+203))) (+ (* a b) (+ z (- y (* z (log t))))) (+ (* (- a 0.5) b) (+ x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.2e+120) || !(z <= 3.5e+203)) {
tmp = (a * b) + (z + (y - (z * log(t))));
} else {
tmp = ((a - 0.5) * b) + (x + y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-4.2d+120)) .or. (.not. (z <= 3.5d+203))) then
tmp = (a * b) + (z + (y - (z * log(t))))
else
tmp = ((a - 0.5d0) * b) + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.2e+120) || !(z <= 3.5e+203)) {
tmp = (a * b) + (z + (y - (z * Math.log(t))));
} else {
tmp = ((a - 0.5) * b) + (x + y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -4.2e+120) or not (z <= 3.5e+203): tmp = (a * b) + (z + (y - (z * math.log(t)))) else: tmp = ((a - 0.5) * b) + (x + y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -4.2e+120) || !(z <= 3.5e+203)) tmp = Float64(Float64(a * b) + Float64(z + Float64(y - Float64(z * log(t))))); else tmp = Float64(Float64(Float64(a - 0.5) * b) + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -4.2e+120) || ~((z <= 3.5e+203))) tmp = (a * b) + (z + (y - (z * log(t)))); else tmp = ((a - 0.5) * b) + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.2e+120], N[Not[LessEqual[z, 3.5e+203]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z + N[(y - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+120} \lor \neg \left(z \leq 3.5 \cdot 10^{+203}\right):\\
\;\;\;\;a \cdot b + \left(z + \left(y - z \cdot \log t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a - 0.5\right) \cdot b + \left(x + y\right)\\
\end{array}
\end{array}
if z < -4.2000000000000001e120 or 3.50000000000000031e203 < z Initial program 99.7%
Taylor expanded in x around 0 96.6%
+-commutative96.6%
associate--l+96.6%
Simplified96.6%
Taylor expanded in a around inf 91.6%
*-commutative22.7%
Simplified91.6%
if -4.2000000000000001e120 < z < 3.50000000000000031e203Initial program 99.9%
Taylor expanded in z around 0 93.8%
+-commutative93.8%
Simplified93.8%
Final simplification93.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ x y) -400000000.0) (+ (+ (* z (- 1.0 (log t))) (+ x y)) (* a b)) (+ (* (- a 0.5) b) (+ z (- y (* z (log t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= -400000000.0) {
tmp = ((z * (1.0 - log(t))) + (x + y)) + (a * b);
} else {
tmp = ((a - 0.5) * b) + (z + (y - (z * log(t))));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x + y) <= (-400000000.0d0)) then
tmp = ((z * (1.0d0 - log(t))) + (x + y)) + (a * b)
else
tmp = ((a - 0.5d0) * b) + (z + (y - (z * log(t))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= -400000000.0) {
tmp = ((z * (1.0 - Math.log(t))) + (x + y)) + (a * b);
} else {
tmp = ((a - 0.5) * b) + (z + (y - (z * Math.log(t))));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x + y) <= -400000000.0: tmp = ((z * (1.0 - math.log(t))) + (x + y)) + (a * b) else: tmp = ((a - 0.5) * b) + (z + (y - (z * math.log(t)))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= -400000000.0) tmp = Float64(Float64(Float64(z * Float64(1.0 - log(t))) + Float64(x + y)) + Float64(a * b)); else tmp = Float64(Float64(Float64(a - 0.5) * b) + Float64(z + Float64(y - Float64(z * log(t))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x + y) <= -400000000.0) tmp = ((z * (1.0 - log(t))) + (x + y)) + (a * b); else tmp = ((a - 0.5) * b) + (z + (y - (z * log(t)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -400000000.0], N[(N[(N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision] + N[(z + N[(y - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -400000000:\\
\;\;\;\;\left(z \cdot \left(1 - \log t\right) + \left(x + y\right)\right) + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(a - 0.5\right) \cdot b + \left(z + \left(y - z \cdot \log t\right)\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4e8Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
sub-neg99.9%
*-un-lft-identity99.9%
*-commutative99.9%
distribute-rgt-out--99.9%
Applied egg-rr99.9%
Taylor expanded in a around inf 91.7%
*-commutative49.9%
Simplified91.7%
if -4e8 < (+.f64 x y) Initial program 99.9%
Taylor expanded in x around 0 86.1%
+-commutative86.1%
associate--l+86.1%
Simplified86.1%
Final simplification88.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= t_1 -1e+122) (not (<= t_1 2e+98)))
(+ y t_1)
(+ (+ x y) (* b -0.5)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((t_1 <= -1e+122) || !(t_1 <= 2e+98)) {
tmp = y + t_1;
} else {
tmp = (x + y) + (b * -0.5);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if ((t_1 <= (-1d+122)) .or. (.not. (t_1 <= 2d+98))) then
tmp = y + t_1
else
tmp = (x + y) + (b * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((t_1 <= -1e+122) || !(t_1 <= 2e+98)) {
tmp = y + t_1;
} else {
tmp = (x + y) + (b * -0.5);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if (t_1 <= -1e+122) or not (t_1 <= 2e+98): tmp = y + t_1 else: tmp = (x + y) + (b * -0.5) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if ((t_1 <= -1e+122) || !(t_1 <= 2e+98)) tmp = Float64(y + t_1); else tmp = Float64(Float64(x + y) + Float64(b * -0.5)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if ((t_1 <= -1e+122) || ~((t_1 <= 2e+98))) tmp = y + t_1; else tmp = (x + y) + (b * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+122], N[Not[LessEqual[t$95$1, 2e+98]], $MachinePrecision]], N[(y + t$95$1), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+122} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+98}\right):\\
\;\;\;\;y + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + b \cdot -0.5\\
\end{array}
\end{array}
if (*.f64 (-.f64 a 1/2) b) < -1.00000000000000001e122 or 2e98 < (*.f64 (-.f64 a 1/2) b) Initial program 100.0%
Taylor expanded in y around inf 82.7%
if -1.00000000000000001e122 < (*.f64 (-.f64 a 1/2) b) < 2e98Initial program 99.8%
Taylor expanded in z around 0 70.6%
+-commutative70.6%
Simplified70.6%
Taylor expanded in a around 0 67.5%
Final simplification73.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -0.0004) (not (<= a 4.7e-39))) (+ (* a b) (+ x y)) (+ (+ x y) (* b -0.5))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -0.0004) || !(a <= 4.7e-39)) {
tmp = (a * b) + (x + y);
} else {
tmp = (x + y) + (b * -0.5);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-0.0004d0)) .or. (.not. (a <= 4.7d-39))) then
tmp = (a * b) + (x + y)
else
tmp = (x + y) + (b * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -0.0004) || !(a <= 4.7e-39)) {
tmp = (a * b) + (x + y);
} else {
tmp = (x + y) + (b * -0.5);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -0.0004) or not (a <= 4.7e-39): tmp = (a * b) + (x + y) else: tmp = (x + y) + (b * -0.5) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -0.0004) || !(a <= 4.7e-39)) tmp = Float64(Float64(a * b) + Float64(x + y)); else tmp = Float64(Float64(x + y) + Float64(b * -0.5)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -0.0004) || ~((a <= 4.7e-39))) tmp = (a * b) + (x + y); else tmp = (x + y) + (b * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -0.0004], N[Not[LessEqual[a, 4.7e-39]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0004 \lor \neg \left(a \leq 4.7 \cdot 10^{-39}\right):\\
\;\;\;\;a \cdot b + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + b \cdot -0.5\\
\end{array}
\end{array}
if a < -4.00000000000000019e-4 or 4.7000000000000002e-39 < a Initial program 99.9%
Taylor expanded in z around 0 77.3%
+-commutative77.3%
Simplified77.3%
Taylor expanded in a around inf 77.2%
*-commutative60.7%
Simplified77.2%
if -4.00000000000000019e-4 < a < 4.7000000000000002e-39Initial program 99.8%
Taylor expanded in z around 0 77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in a around 0 77.9%
Final simplification77.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1400000000.0) (not (<= a 4.7e-39))) (+ x (* a b)) (+ x (* b -0.5))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1400000000.0) || !(a <= 4.7e-39)) {
tmp = x + (a * b);
} else {
tmp = x + (b * -0.5);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-1400000000.0d0)) .or. (.not. (a <= 4.7d-39))) then
tmp = x + (a * b)
else
tmp = x + (b * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1400000000.0) || !(a <= 4.7e-39)) {
tmp = x + (a * b);
} else {
tmp = x + (b * -0.5);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1400000000.0) or not (a <= 4.7e-39): tmp = x + (a * b) else: tmp = x + (b * -0.5) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1400000000.0) || !(a <= 4.7e-39)) tmp = Float64(x + Float64(a * b)); else tmp = Float64(x + Float64(b * -0.5)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1400000000.0) || ~((a <= 4.7e-39))) tmp = x + (a * b); else tmp = x + (b * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1400000000.0], N[Not[LessEqual[a, 4.7e-39]], $MachinePrecision]], N[(x + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1400000000 \lor \neg \left(a \leq 4.7 \cdot 10^{-39}\right):\\
\;\;\;\;x + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x + b \cdot -0.5\\
\end{array}
\end{array}
if a < -1.4e9 or 4.7000000000000002e-39 < a Initial program 99.9%
Taylor expanded in x around inf 63.8%
Taylor expanded in a around inf 63.7%
*-commutative63.7%
Simplified63.7%
if -1.4e9 < a < 4.7000000000000002e-39Initial program 99.8%
Taylor expanded in x around inf 51.6%
Taylor expanded in a around 0 51.6%
Final simplification57.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- a 0.5) b))) (if (<= y 5.2e+14) (+ x t_1) (+ y t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if (y <= 5.2e+14) {
tmp = x + t_1;
} else {
tmp = y + t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a - 0.5d0) * b
if (y <= 5.2d+14) then
tmp = x + t_1
else
tmp = y + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if (y <= 5.2e+14) {
tmp = x + t_1;
} else {
tmp = y + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if y <= 5.2e+14: tmp = x + t_1 else: tmp = y + t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if (y <= 5.2e+14) tmp = Float64(x + t_1); else tmp = Float64(y + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; tmp = 0.0; if (y <= 5.2e+14) tmp = x + t_1; else tmp = y + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[y, 5.2e+14], N[(x + t$95$1), $MachinePrecision], N[(y + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;y \leq 5.2 \cdot 10^{+14}:\\
\;\;\;\;x + t\_1\\
\mathbf{else}:\\
\;\;\;\;y + t\_1\\
\end{array}
\end{array}
if y < 5.2e14Initial program 99.9%
Taylor expanded in x around inf 64.3%
if 5.2e14 < y Initial program 99.8%
Taylor expanded in y around inf 67.5%
Final simplification65.1%
(FPCore (x y z t a b) :precision binary64 (+ (* (- a 0.5) b) (+ x y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((a - 0.5) * b) + (x + y);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((a - 0.5d0) * b) + (x + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((a - 0.5) * b) + (x + y);
}
def code(x, y, z, t, a, b): return ((a - 0.5) * b) + (x + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(a - 0.5) * b) + Float64(x + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((a - 0.5) * b) + (x + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a - 0.5\right) \cdot b + \left(x + y\right)
\end{array}
Initial program 99.9%
Taylor expanded in z around 0 77.6%
+-commutative77.6%
Simplified77.6%
Final simplification77.6%
(FPCore (x y z t a b) :precision binary64 (+ x (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return x + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return x + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(x + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = x + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(a - 0.5\right) \cdot b
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 57.5%
Final simplification57.5%
(FPCore (x y z t a b) :precision binary64 (+ x (* b -0.5)))
double code(double x, double y, double z, double t, double a, double b) {
return x + (b * -0.5);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x + (b * (-0.5d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + (b * -0.5);
}
def code(x, y, z, t, a, b): return x + (b * -0.5)
function code(x, y, z, t, a, b) return Float64(x + Float64(b * -0.5)) end
function tmp = code(x, y, z, t, a, b) tmp = x + (b * -0.5); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + b \cdot -0.5
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 57.5%
Taylor expanded in a around 0 36.9%
Final simplification36.9%
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + y) + (((1.0 - pow(log(t), 2.0)) * z) / (1.0 + log(t)))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + y) + (((1.0d0 - (log(t) ** 2.0d0)) * z) / (1.0d0 + log(t)))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + y) + (((1.0 - Math.pow(Math.log(t), 2.0)) * z) / (1.0 + Math.log(t)))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return ((x + y) + (((1.0 - math.pow(math.log(t), 2.0)) * z) / (1.0 + math.log(t)))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + y) + Float64(Float64(Float64(1.0 - (log(t) ^ 2.0)) * z) / Float64(1.0 + log(t)))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + y) + (((1.0 - (log(t) ^ 2.0)) * z) / (1.0 + log(t)))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + y), $MachinePrecision] + N[(N[(N[(1.0 - N[Power[N[Log[t], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] / N[(1.0 + N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y\right) + \frac{\left(1 - {\log t}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b
\end{array}
herbie shell --seed 2024067
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))
(+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))