
(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 11 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 (+ (- (+ (+ 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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= z -4.2e+120) (not (<= z 1.06e+117)))
(+ t_1 (+ x (- z (* z (log t)))))
(+ (+ x 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 ((z <= -4.2e+120) || !(z <= 1.06e+117)) {
tmp = t_1 + (x + (z - (z * log(t))));
} else {
tmp = (x + 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 ((z <= (-4.2d+120)) .or. (.not. (z <= 1.06d+117))) then
tmp = t_1 + (x + (z - (z * log(t))))
else
tmp = (x + 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 ((z <= -4.2e+120) || !(z <= 1.06e+117)) {
tmp = t_1 + (x + (z - (z * Math.log(t))));
} else {
tmp = (x + y) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if (z <= -4.2e+120) or not (z <= 1.06e+117): tmp = t_1 + (x + (z - (z * math.log(t)))) else: tmp = (x + 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 ((z <= -4.2e+120) || !(z <= 1.06e+117)) tmp = Float64(t_1 + Float64(x + Float64(z - Float64(z * log(t))))); else tmp = Float64(Float64(x + 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 ((z <= -4.2e+120) || ~((z <= 1.06e+117))) tmp = t_1 + (x + (z - (z * log(t)))); else tmp = (x + 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[Or[LessEqual[z, -4.2e+120], N[Not[LessEqual[z, 1.06e+117]], $MachinePrecision]], N[(t$95$1 + N[(x + N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+120} \lor \neg \left(z \leq 1.06 \cdot 10^{+117}\right):\\
\;\;\;\;t\_1 + \left(x + \left(z - z \cdot \log t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + t\_1\\
\end{array}
\end{array}
if z < -4.2000000000000001e120 or 1.06e117 < z Initial program 99.7%
Taylor expanded in y around 0 91.0%
associate--l+91.1%
Simplified91.1%
if -4.2000000000000001e120 < z < 1.06e117Initial program 100.0%
Taylor expanded in z around 0 95.6%
+-commutative95.6%
Simplified95.6%
Final simplification94.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= z -7.2e+148) (not (<= z 3.4e+153)))
(+ t_1 (* z (- 1.0 (log t))))
(+ (+ x 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 ((z <= -7.2e+148) || !(z <= 3.4e+153)) {
tmp = t_1 + (z * (1.0 - log(t)));
} else {
tmp = (x + 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 ((z <= (-7.2d+148)) .or. (.not. (z <= 3.4d+153))) then
tmp = t_1 + (z * (1.0d0 - log(t)))
else
tmp = (x + 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 ((z <= -7.2e+148) || !(z <= 3.4e+153)) {
tmp = t_1 + (z * (1.0 - Math.log(t)));
} else {
tmp = (x + y) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if (z <= -7.2e+148) or not (z <= 3.4e+153): tmp = t_1 + (z * (1.0 - math.log(t))) else: tmp = (x + 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 ((z <= -7.2e+148) || !(z <= 3.4e+153)) tmp = Float64(t_1 + Float64(z * Float64(1.0 - log(t)))); else tmp = Float64(Float64(x + 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 ((z <= -7.2e+148) || ~((z <= 3.4e+153))) tmp = t_1 + (z * (1.0 - log(t))); else tmp = (x + 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[Or[LessEqual[z, -7.2e+148], N[Not[LessEqual[z, 3.4e+153]], $MachinePrecision]], N[(t$95$1 + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+148} \lor \neg \left(z \leq 3.4 \cdot 10^{+153}\right):\\
\;\;\;\;t\_1 + z \cdot \left(1 - \log t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + t\_1\\
\end{array}
\end{array}
if z < -7.20000000000000013e148 or 3.3999999999999997e153 < z Initial program 99.7%
Taylor expanded in z around -inf 87.7%
Taylor expanded in t around inf 87.7%
log-rec87.7%
sub-neg87.7%
Simplified87.7%
if -7.20000000000000013e148 < z < 3.3999999999999997e153Initial program 100.0%
Taylor expanded in z around 0 94.6%
+-commutative94.6%
Simplified94.6%
Final simplification92.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (<= z -4.1e+151)
(+ t_1 (* z (- 1.0 (log t))))
(if (<= z 4.6e+195)
(+ (+ x y) t_1)
(+ (+ x (- z (* z (log t)))) (* a b))))))
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 <= -4.1e+151) {
tmp = t_1 + (z * (1.0 - log(t)));
} else if (z <= 4.6e+195) {
tmp = (x + y) + t_1;
} else {
tmp = (x + (z - (z * log(t)))) + (a * b);
}
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 <= (-4.1d+151)) then
tmp = t_1 + (z * (1.0d0 - log(t)))
else if (z <= 4.6d+195) then
tmp = (x + y) + t_1
else
tmp = (x + (z - (z * log(t)))) + (a * b)
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 <= -4.1e+151) {
tmp = t_1 + (z * (1.0 - Math.log(t)));
} else if (z <= 4.6e+195) {
tmp = (x + y) + t_1;
} else {
tmp = (x + (z - (z * Math.log(t)))) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b tmp = 0 if z <= -4.1e+151: tmp = t_1 + (z * (1.0 - math.log(t))) elif z <= 4.6e+195: tmp = (x + y) + t_1 else: tmp = (x + (z - (z * math.log(t)))) + (a * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if (z <= -4.1e+151) tmp = Float64(t_1 + Float64(z * Float64(1.0 - log(t)))); elseif (z <= 4.6e+195) tmp = Float64(Float64(x + y) + t_1); else tmp = Float64(Float64(x + Float64(z - Float64(z * log(t)))) + Float64(a * b)); 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 <= -4.1e+151) tmp = t_1 + (z * (1.0 - log(t))); elseif (z <= 4.6e+195) tmp = (x + y) + t_1; else tmp = (x + (z - (z * log(t)))) + (a * b); 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[z, -4.1e+151], N[(t$95$1 + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+195], N[(N[(x + y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(x + N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+151}:\\
\;\;\;\;t\_1 + z \cdot \left(1 - \log t\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+195}:\\
\;\;\;\;\left(x + y\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(x + \left(z - z \cdot \log t\right)\right) + a \cdot b\\
\end{array}
\end{array}
if z < -4.0999999999999998e151Initial program 99.7%
Taylor expanded in z around -inf 86.7%
Taylor expanded in t around inf 86.7%
log-rec86.7%
sub-neg86.7%
Simplified86.7%
if -4.0999999999999998e151 < z < 4.6000000000000002e195Initial program 100.0%
Taylor expanded in z around 0 93.7%
+-commutative93.7%
Simplified93.7%
if 4.6000000000000002e195 < z Initial program 99.6%
Taylor expanded in y around 0 93.2%
associate--l+93.2%
Simplified93.2%
Taylor expanded in a around inf 90.8%
*-commutative19.0%
Simplified90.8%
Final simplification92.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (log t))))
(if (<= z -5e+120)
(+ (+ z (- y t_1)) (* a b))
(if (<= z 4.6e+195)
(+ (+ x y) (* (- a 0.5) b))
(+ (+ x (- z t_1)) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * log(t);
double tmp;
if (z <= -5e+120) {
tmp = (z + (y - t_1)) + (a * b);
} else if (z <= 4.6e+195) {
tmp = (x + y) + ((a - 0.5) * b);
} else {
tmp = (x + (z - t_1)) + (a * b);
}
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 = z * log(t)
if (z <= (-5d+120)) then
tmp = (z + (y - t_1)) + (a * b)
else if (z <= 4.6d+195) then
tmp = (x + y) + ((a - 0.5d0) * b)
else
tmp = (x + (z - t_1)) + (a * b)
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 = z * Math.log(t);
double tmp;
if (z <= -5e+120) {
tmp = (z + (y - t_1)) + (a * b);
} else if (z <= 4.6e+195) {
tmp = (x + y) + ((a - 0.5) * b);
} else {
tmp = (x + (z - t_1)) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * math.log(t) tmp = 0 if z <= -5e+120: tmp = (z + (y - t_1)) + (a * b) elif z <= 4.6e+195: tmp = (x + y) + ((a - 0.5) * b) else: tmp = (x + (z - t_1)) + (a * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * log(t)) tmp = 0.0 if (z <= -5e+120) tmp = Float64(Float64(z + Float64(y - t_1)) + Float64(a * b)); elseif (z <= 4.6e+195) tmp = Float64(Float64(x + y) + Float64(Float64(a - 0.5) * b)); else tmp = Float64(Float64(x + Float64(z - t_1)) + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * log(t); tmp = 0.0; if (z <= -5e+120) tmp = (z + (y - t_1)) + (a * b); elseif (z <= 4.6e+195) tmp = (x + y) + ((a - 0.5) * b); else tmp = (x + (z - t_1)) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+120], N[(N[(z + N[(y - t$95$1), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+195], N[(N[(x + y), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(z - t$95$1), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \log t\\
\mathbf{if}\;z \leq -5 \cdot 10^{+120}:\\
\;\;\;\;\left(z + \left(y - t\_1\right)\right) + a \cdot b\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+195}:\\
\;\;\;\;\left(x + y\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x + \left(z - t\_1\right)\right) + a \cdot b\\
\end{array}
\end{array}
if z < -5.00000000000000019e120Initial program 99.7%
Taylor expanded in x around 0 94.8%
+-commutative94.8%
associate--l+94.8%
Simplified94.8%
Taylor expanded in a around inf 88.3%
*-commutative32.9%
Simplified88.3%
if -5.00000000000000019e120 < z < 4.6000000000000002e195Initial program 100.0%
Taylor expanded in z around 0 94.3%
+-commutative94.3%
Simplified94.3%
if 4.6000000000000002e195 < z Initial program 99.6%
Taylor expanded in y around 0 93.2%
associate--l+93.2%
Simplified93.2%
Taylor expanded in a around inf 90.8%
*-commutative19.0%
Simplified90.8%
Final simplification92.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (log t))) (t_2 (* (- a 0.5) b))) (if (<= x -1.8e+28) (+ t_2 (+ x (- z t_1))) (+ t_2 (+ z (- y t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * log(t);
double t_2 = (a - 0.5) * b;
double tmp;
if (x <= -1.8e+28) {
tmp = t_2 + (x + (z - t_1));
} else {
tmp = t_2 + (z + (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) :: t_2
real(8) :: tmp
t_1 = z * log(t)
t_2 = (a - 0.5d0) * b
if (x <= (-1.8d+28)) then
tmp = t_2 + (x + (z - t_1))
else
tmp = t_2 + (z + (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 = z * Math.log(t);
double t_2 = (a - 0.5) * b;
double tmp;
if (x <= -1.8e+28) {
tmp = t_2 + (x + (z - t_1));
} else {
tmp = t_2 + (z + (y - t_1));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * math.log(t) t_2 = (a - 0.5) * b tmp = 0 if x <= -1.8e+28: tmp = t_2 + (x + (z - t_1)) else: tmp = t_2 + (z + (y - t_1)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * log(t)) t_2 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if (x <= -1.8e+28) tmp = Float64(t_2 + Float64(x + Float64(z - t_1))); else tmp = Float64(t_2 + Float64(z + Float64(y - t_1))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * log(t); t_2 = (a - 0.5) * b; tmp = 0.0; if (x <= -1.8e+28) tmp = t_2 + (x + (z - t_1)); else tmp = t_2 + (z + (y - t_1)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[x, -1.8e+28], N[(t$95$2 + N[(x + N[(z - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(z + N[(y - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \log t\\
t_2 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+28}:\\
\;\;\;\;t\_2 + \left(x + \left(z - t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(z + \left(y - t\_1\right)\right)\\
\end{array}
\end{array}
if x < -1.8e28Initial program 99.8%
Taylor expanded in y around 0 86.4%
associate--l+86.4%
Simplified86.4%
if -1.8e28 < x Initial program 99.9%
Taylor expanded in x around 0 88.0%
+-commutative88.0%
associate--l+88.0%
Simplified88.0%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -3.2e-21) (not (<= a 3.1e+23))) (+ y (* a b)) (+ y (* b -0.5))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -3.2e-21) || !(a <= 3.1e+23)) {
tmp = y + (a * b);
} else {
tmp = 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 <= (-3.2d-21)) .or. (.not. (a <= 3.1d+23))) then
tmp = y + (a * b)
else
tmp = 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 <= -3.2e-21) || !(a <= 3.1e+23)) {
tmp = y + (a * b);
} else {
tmp = y + (b * -0.5);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -3.2e-21) or not (a <= 3.1e+23): tmp = y + (a * b) else: tmp = y + (b * -0.5) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -3.2e-21) || !(a <= 3.1e+23)) tmp = Float64(y + Float64(a * b)); else tmp = Float64(y + Float64(b * -0.5)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -3.2e-21) || ~((a <= 3.1e+23))) tmp = y + (a * b); else tmp = y + (b * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -3.2e-21], N[Not[LessEqual[a, 3.1e+23]], $MachinePrecision]], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(y + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-21} \lor \neg \left(a \leq 3.1 \cdot 10^{+23}\right):\\
\;\;\;\;y + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;y + b \cdot -0.5\\
\end{array}
\end{array}
if a < -3.2000000000000002e-21 or 3.09999999999999971e23 < a Initial program 99.9%
Taylor expanded in y around inf 62.8%
Taylor expanded in a around inf 62.7%
*-commutative62.7%
Simplified62.7%
if -3.2000000000000002e-21 < a < 3.09999999999999971e23Initial program 99.8%
Taylor expanded in y around inf 53.1%
Taylor expanded in a around 0 53.1%
Final simplification57.6%
(FPCore (x y z t a b) :precision binary64 (if (<= y 1.48e+103) (+ x (* (- a 0.5) b)) (+ y (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= 1.48e+103) {
tmp = x + ((a - 0.5) * b);
} else {
tmp = y + (a * b);
}
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 (y <= 1.48d+103) then
tmp = x + ((a - 0.5d0) * b)
else
tmp = y + (a * b)
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 (y <= 1.48e+103) {
tmp = x + ((a - 0.5) * b);
} else {
tmp = y + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= 1.48e+103: tmp = x + ((a - 0.5) * b) else: tmp = y + (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= 1.48e+103) tmp = Float64(x + Float64(Float64(a - 0.5) * b)); else tmp = Float64(y + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= 1.48e+103) tmp = x + ((a - 0.5) * b); else tmp = y + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 1.48e+103], N[(x + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.48 \cdot 10^{+103}:\\
\;\;\;\;x + \left(a - 0.5\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;y + a \cdot b\\
\end{array}
\end{array}
if y < 1.48000000000000009e103Initial program 99.9%
Taylor expanded in x around inf 61.8%
if 1.48000000000000009e103 < y Initial program 99.9%
Taylor expanded in y around inf 71.4%
Taylor expanded in a around inf 67.2%
*-commutative67.2%
Simplified67.2%
Final simplification62.8%
(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 63.5%
if 5.2e14 < y Initial program 99.9%
Taylor expanded in y around inf 66.9%
Final simplification64.3%
(FPCore (x y z t a b) :precision binary64 (+ (+ x y) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (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 = (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 (x + y) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (x + y) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(x + y) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (x + y) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x + y), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) + \left(a - 0.5\right) \cdot b
\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 (+ y (* b -0.5)))
double code(double x, double y, double z, double t, double a, double b) {
return y + (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 = y + (b * (-0.5d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return y + (b * -0.5);
}
def code(x, y, z, t, a, b): return y + (b * -0.5)
function code(x, y, z, t, a, b) return Float64(y + Float64(b * -0.5)) end
function tmp = code(x, y, z, t, a, b) tmp = y + (b * -0.5); end
code[x_, y_, z_, t_, a_, b_] := N[(y + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + b \cdot -0.5
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 57.7%
Taylor expanded in a around 0 37.9%
Final simplification37.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
:alt
(+ (+ (+ 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)))