
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (+ (- (+ (log y) (log z)) t) (* (- a 0.5) (log t))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return ((log(y) + log(z)) - t) + ((a - 0.5) * log(t));
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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
code = ((log(y) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(y) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return ((math.log(y) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(Float64(log(y) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = ((log(y) + log(z)) - t) + ((a - 0.5) * log(t));
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\left(\left(\log y + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
log-lowering-log.f64N/A
log-lowering-log.f6466.9
Simplified66.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- a 0.5) (log t)))
(t_2 (+ t_1 (- (+ (log z) (log (+ y x))) t))))
(if (<= t_2 -1e+23)
(- (* a (log t)) t)
(if (<= t_2 2000.0)
(+ (log y) (- (fma (log t) -0.5 (log z)) t))
(- t_1 t)))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (a - 0.5) * log(t);
double t_2 = t_1 + ((log(z) + log((y + x))) - t);
double tmp;
if (t_2 <= -1e+23) {
tmp = (a * log(t)) - t;
} else if (t_2 <= 2000.0) {
tmp = log(y) + (fma(log(t), -0.5, log(z)) - t);
} else {
tmp = t_1 - t;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(a - 0.5) * log(t)) t_2 = Float64(t_1 + Float64(Float64(log(z) + log(Float64(y + x))) - t)) tmp = 0.0 if (t_2 <= -1e+23) tmp = Float64(Float64(a * log(t)) - t); elseif (t_2 <= 2000.0) tmp = Float64(log(y) + Float64(fma(log(t), -0.5, log(z)) - t)); else tmp = Float64(t_1 - t); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+23], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 2000.0], N[(N[Log[y], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * -0.5 + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot \log t\\
t_2 := t\_1 + \left(\left(\log z + \log \left(y + x\right)\right) - t\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+23}:\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{elif}\;t\_2 \leq 2000:\\
\;\;\;\;\log y + \left(\mathsf{fma}\left(\log t, -0.5, \log z\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < -9.9999999999999992e22Initial program 99.9%
+-commutativeN/A
flip3--N/A
associate-*l/N/A
div-invN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr55.6%
Taylor expanded in y around 0
--lowering--.f64N/A
Simplified40.5%
Taylor expanded in a around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6499.9
Simplified99.9%
if -9.9999999999999992e22 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 2e3Initial program 99.2%
Taylor expanded in x around 0
+-lowering-+.f64N/A
log-lowering-log.f64N/A
log-lowering-log.f6454.1
Simplified54.1%
Taylor expanded in a around 0
associate--l+N/A
+-lowering-+.f64N/A
log-lowering-log.f64N/A
--lowering--.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
log-lowering-log.f6454.1
Simplified54.1%
if 2e3 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6498.8
Simplified98.8%
Final simplification86.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log z) (log (+ y x)))))
(if (<= t_1 -700.0)
(- (* a (log t)) t)
(if (<= t_1 700.0)
(fma (+ a -0.5) (log t) (- (log (* y z)) t))
(- (* (- a 0.5) (log t)) t)))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log((y + x));
double tmp;
if (t_1 <= -700.0) {
tmp = (a * log(t)) - t;
} else if (t_1 <= 700.0) {
tmp = fma((a + -0.5), log(t), (log((y * z)) - t));
} else {
tmp = ((a - 0.5) * log(t)) - t;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(log(z) + log(Float64(y + x))) tmp = 0.0 if (t_1 <= -700.0) tmp = Float64(Float64(a * log(t)) - t); elseif (t_1 <= 700.0) tmp = fma(Float64(a + -0.5), log(t), Float64(log(Float64(y * z)) - t)); else tmp = Float64(Float64(Float64(a - 0.5) * log(t)) - t); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] + N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -700.0], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 700.0], N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \log z + \log \left(y + x\right)\\
\mathbf{if}\;t\_1 \leq -700:\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\mathsf{fma}\left(a + -0.5, \log t, \log \left(y \cdot z\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a - 0.5\right) \cdot \log t - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -700Initial program 99.9%
+-commutativeN/A
flip3--N/A
associate-*l/N/A
div-invN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr2.8%
Taylor expanded in y around 0
--lowering--.f64N/A
Simplified2.8%
Taylor expanded in a around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6484.0
Simplified84.0%
if -700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700Initial program 99.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
log-lowering-log.f64N/A
log-lowering-log.f6468.0
Simplified68.0%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
log-lowering-log.f64N/A
--lowering--.f64N/A
sum-logN/A
log-lowering-log.f64N/A
*-lowering-*.f6464.0
Applied egg-rr64.0%
if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6492.3
Simplified92.3%
Final simplification70.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 380.0) (fma (log t) (+ a -0.5) (+ (log z) (log (+ y x)))) (- (* a (log t)) t)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 380.0) {
tmp = fma(log(t), (a + -0.5), (log(z) + log((y + x))));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 380.0) tmp = fma(log(t), Float64(a + -0.5), Float64(log(z) + log(Float64(y + x)))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 380.0], N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 380:\\
\;\;\;\;\mathsf{fma}\left(\log t, a + -0.5, \log z + \log \left(y + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 380Initial program 99.3%
Taylor expanded in t around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f64N/A
log-lowering-log.f64N/A
+-commutativeN/A
+-lowering-+.f6497.2
Simplified97.2%
if 380 < t Initial program 99.9%
+-commutativeN/A
flip3--N/A
associate-*l/N/A
div-invN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr56.3%
Taylor expanded in y around 0
--lowering--.f64N/A
Simplified40.0%
Taylor expanded in a around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6499.2
Simplified99.2%
Final simplification98.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= (- a 0.5) -5e+39)
t_1
(if (<= (- a 0.5) 5000000000000.0) (- 0.0 t) t_1))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if ((a - 0.5) <= -5e+39) {
tmp = t_1;
} else if ((a - 0.5) <= 5000000000000.0) {
tmp = 0.0 - t;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = a * log(t)
if ((a - 0.5d0) <= (-5d+39)) then
tmp = t_1
else if ((a - 0.5d0) <= 5000000000000.0d0) then
tmp = 0.0d0 - t
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * Math.log(t);
double tmp;
if ((a - 0.5) <= -5e+39) {
tmp = t_1;
} else if ((a - 0.5) <= 5000000000000.0) {
tmp = 0.0 - t;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = a * math.log(t) tmp = 0 if (a - 0.5) <= -5e+39: tmp = t_1 elif (a - 0.5) <= 5000000000000.0: tmp = 0.0 - t else: tmp = t_1 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (Float64(a - 0.5) <= -5e+39) tmp = t_1; elseif (Float64(a - 0.5) <= 5000000000000.0) tmp = Float64(0.0 - t); else tmp = t_1; end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = a * log(t);
tmp = 0.0;
if ((a - 0.5) <= -5e+39)
tmp = t_1;
elseif ((a - 0.5) <= 5000000000000.0)
tmp = 0.0 - t;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a - 0.5), $MachinePrecision], -5e+39], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 5000000000000.0], N[(0.0 - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 5000000000000:\\
\;\;\;\;0 - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -5.00000000000000015e39 or 5e12 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6480.5
Simplified80.5%
if -5.00000000000000015e39 < (-.f64 a #s(literal 1/2 binary64)) < 5e12Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6457.4
Simplified57.4%
sub0-negN/A
neg-lowering-neg.f6457.4
Applied egg-rr57.4%
Final simplification66.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- (* (- a 0.5) (log t)) t))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return ((a - 0.5) * log(t)) - t;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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
code = ((a - 0.5d0) * log(t)) - t
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return ((a - 0.5) * Math.log(t)) - t;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return ((a - 0.5) * math.log(t)) - t
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(Float64(a - 0.5) * log(t)) - t) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = ((a - 0.5) * log(t)) - t;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\left(a - 0.5\right) \cdot \log t - t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6476.5
Simplified76.5%
Final simplification76.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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
code = (a * log(t)) - t
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return (a * math.log(t)) - t
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = (a * log(t)) - t;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
a \cdot \log t - t
\end{array}
Initial program 99.6%
+-commutativeN/A
flip3--N/A
associate-*l/N/A
div-invN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr58.5%
Taylor expanded in y around 0
--lowering--.f64N/A
Simplified38.1%
Taylor expanded in a around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6473.7
Simplified73.7%
Final simplification73.7%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- 0.0 t))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return 0.0 - t;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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
code = 0.0d0 - t
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return 0.0 - t;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return 0.0 - t
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(0.0 - t) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = 0.0 - t;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(0.0 - t), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
0 - t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6443.2
Simplified43.2%
sub0-negN/A
neg-lowering-neg.f6443.2
Applied egg-rr43.2%
Final simplification43.2%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
}
real(8) function code(x, y, z, t, a)
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
code = log((x + y)) + ((log(z) - t) + ((a - 0.5d0) * log(t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) + ((Math.log(z) - t) + ((a - 0.5) * Math.log(t)));
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(z) - t) + ((a - 0.5) * math.log(t)))
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(Float64(a - 0.5) * log(t)))) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)
\end{array}
herbie shell --seed 2024195
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (+ (log (+ x y)) (+ (- (log z) t) (* (- a 1/2) (log t)))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))