
(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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
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]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
Herbie found 13 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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
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]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
(FPCore (x y z t a) :precision binary64 (- (fma (log t) (- a 0.5) (log z)) (- t (log (+ y x)))))
double code(double x, double y, double z, double t, double a) {
return fma(log(t), (a - 0.5), log(z)) - (t - log((y + x)));
}
function code(x, y, z, t, a) return Float64(fma(log(t), Float64(a - 0.5), log(z)) - Float64(t - log(Float64(y + x)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(t - N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\log t, a - 0.5, \log z\right) - \left(t - \log \left(y + x\right)\right)
Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6%
Applied rewrites99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.00115) (+ (log z) (+ (log (+ x y)) (* (log t) (- a 0.5)))) (fma (- a 0.5) (log t) (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.00115) {
tmp = log(z) + (log((x + y)) + (log(t) * (a - 0.5)));
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.00115) tmp = Float64(log(z) + Float64(log(Float64(x + y)) + Float64(log(t) * Float64(a - 0.5)))); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.00115], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;t \leq 0.00115:\\
\;\;\;\;\log z + \left(\log \left(x + y\right) + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
if t < 0.00115Initial program 99.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6461.4%
Applied rewrites61.4%
if 0.00115 < t Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.2)
(- (- t) (* (- 0.5 a) (log t)))
(if (<= a 85.0)
(+ (- (+ (log (fmax x y)) (log z)) t) (* -0.5 (log t)))
(fma (- a 0.5) (log t) (- t)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.2) {
tmp = -t - ((0.5 - a) * log(t));
} else if (a <= 85.0) {
tmp = ((log(fmax(x, y)) + log(z)) - t) + (-0.5 * log(t));
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.2) tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); elseif (a <= 85.0) tmp = Float64(Float64(Float64(log(fmax(x, y)) + log(z)) - t) + Float64(-0.5 * log(t))); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.2], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 85.0], N[(N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.2:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{elif}\;a \leq 85:\\
\;\;\;\;\left(\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + -0.5 \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
if a < -2.2000000000000002Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites77.4%
if -2.2000000000000002 < a < 85Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
Taylor expanded in a around 0
Applied rewrites41.8%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
if 85 < a Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.2)
(- (- t) (* (- 0.5 a) (log t)))
(if (<= a 85.0)
(- (+ (log z) (- (log (fmax x y)) (log (sqrt t)))) t)
(fma (- a 0.5) (log t) (- t)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.2) {
tmp = -t - ((0.5 - a) * log(t));
} else if (a <= 85.0) {
tmp = (log(z) + (log(fmax(x, y)) - log(sqrt(t)))) - t;
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.2) tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); elseif (a <= 85.0) tmp = Float64(Float64(log(z) + Float64(log(fmax(x, y)) - log(sqrt(t)))) - t); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.2], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 85.0], N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] - N[Log[N[Sqrt[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.2:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{elif}\;a \leq 85:\\
\;\;\;\;\left(\log z + \left(\log \left(\mathsf{max}\left(x, y\right)\right) - \log \left(\sqrt{t}\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
if a < -2.2000000000000002Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites77.4%
if -2.2000000000000002 < a < 85Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lift-log.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
if 85 < a Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y)))
(t_2 (+ (- (+ t_1 (log z)) t) (* (- a 0.5) (log t)))))
(if (<= t_2 -200000.0)
(- (- t) (* (- 0.5 a) (log t)))
(if (<= t_2 1400.0)
(- (- t_1 (log (/ (sqrt t) z))) t)
(fma (- a 0.5) (log t) (- t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y));
double t_2 = ((t_1 + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_2 <= -200000.0) {
tmp = -t - ((0.5 - a) * log(t));
} else if (t_2 <= 1400.0) {
tmp = (t_1 - log((sqrt(t) / z))) - t;
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) t_2 = Float64(Float64(Float64(t_1 + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_2 <= -200000.0) tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); elseif (t_2 <= 1400.0) tmp = Float64(Float64(t_1 - log(Float64(sqrt(t) / z))) - t); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1400.0], N[(N[(t$95$1 - N[Log[N[(N[Sqrt[t], $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := \left(\left(t\_1 + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_2 \leq -200000:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{elif}\;t\_2 \leq 1400:\\
\;\;\;\;\left(t\_1 - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\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))) < -2e5Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites77.4%
if -2e5 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1400Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
Applied rewrites55.9%
if 1400 < (+.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
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
(if (<= t_1 -750.0)
(+ (- (log (/ (fmax x y) (sqrt t))) t) (log z))
(if (<= t_1 710.0)
(- (log (* z (fmax x y))) (fma (- 0.5 a) (log t) t))
(fma (- a 0.5) (log t) (- t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((fmin(x, y) + fmax(x, y))) + log(z);
double tmp;
if (t_1 <= -750.0) {
tmp = (log((fmax(x, y) / sqrt(t))) - t) + log(z);
} else if (t_1 <= 710.0) {
tmp = log((z * fmax(x, y))) - fma((0.5 - a), log(t), t);
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) tmp = 0.0 if (t_1 <= -750.0) tmp = Float64(Float64(log(Float64(fmax(x, y) / sqrt(t))) - t) + log(z)); elseif (t_1 <= 710.0) tmp = Float64(log(Float64(z * fmax(x, y))) - fma(Float64(0.5 - a), log(t), t)); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -750.0], N[(N[(N[Log[N[(N[Max[x, y], $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 710.0], N[(N[Log[N[(z * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;\left(\log \left(\frac{\mathsf{max}\left(x, y\right)}{\sqrt{t}}\right) - t\right) + \log z\\
\mathbf{elif}\;t\_1 \leq 710:\\
\;\;\;\;\log \left(z \cdot \mathsf{max}\left(x, y\right)\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites37.7%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites66.1%
Taylor expanded in x around 0
lower-*.f64N/A
Applied rewrites69.3%
sub-to-mult-rev69.3%
sub-negate-rev69.3%
fp-cancel-sign-sub-inv69.3%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-mult-revN/A
lift--.f64N/A
lift-log.f64N/A
Applied rewrites52.7%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(+
(- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
(* (- a 0.5) (log t)))))
(if (<= t_1 -200000.0)
(- (- t) (* (- 0.5 a) (log t)))
(if (<= t_1 1300.0)
(- (+ (log z) (- (log (/ (sqrt t) (fmax x y))))) t)
(fma (- a 0.5) (log t) (- t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_1 <= -200000.0) {
tmp = -t - ((0.5 - a) * log(t));
} else if (t_1 <= 1300.0) {
tmp = (log(z) + -log((sqrt(t) / fmax(x, y)))) - t;
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -200000.0) tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); elseif (t_1 <= 1300.0) tmp = Float64(Float64(log(z) + Float64(-log(Float64(sqrt(t) / fmax(x, y))))) - t); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1300.0], N[(N[(N[Log[z], $MachinePrecision] + (-N[Log[N[(N[Sqrt[t], $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -200000:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{elif}\;t\_1 \leq 1300:\\
\;\;\;\;\left(\log z + \left(-\log \left(\frac{\sqrt{t}}{\mathsf{max}\left(x, y\right)}\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\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))) < -2e5Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites77.4%
if -2e5 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1300Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-negate-revN/A
lower-neg.f64N/A
metadata-evalN/A
lift-log.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f6437.6%
Applied rewrites37.6%
if 1300 < (+.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
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(+
(- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
(* (- a 0.5) (log t)))))
(if (<= t_1 -200000.0)
(- (- t) (* (- 0.5 a) (log t)))
(if (<= t_1 1200.0)
(+ (- (log (/ (fmax x y) (sqrt t))) t) (log z))
(fma (- a 0.5) (log t) (- t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_1 <= -200000.0) {
tmp = -t - ((0.5 - a) * log(t));
} else if (t_1 <= 1200.0) {
tmp = (log((fmax(x, y) / sqrt(t))) - t) + log(z);
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -200000.0) tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); elseif (t_1 <= 1200.0) tmp = Float64(Float64(log(Float64(fmax(x, y) / sqrt(t))) - t) + log(z)); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1200.0], N[(N[(N[Log[N[(N[Max[x, y], $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -200000:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{elif}\;t\_1 \leq 1200:\\
\;\;\;\;\left(\log \left(\frac{\mathsf{max}\left(x, y\right)}{\sqrt{t}}\right) - t\right) + \log z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\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))) < -2e5Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites77.4%
if -2e5 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1200Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites37.7%
if 1200 < (+.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
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t)))))
(if (<= t_1 -200000.0)
(- (- t) (* (- 0.5 a) (log t)))
(if (<= t_1 700.0)
(- (log (/ (* (+ x y) z) (sqrt t))) t)
(fma (- a 0.5) (log t) (- t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_1 <= -200000.0) {
tmp = -t - ((0.5 - a) * log(t));
} else if (t_1 <= 700.0) {
tmp = log((((x + y) * z) / sqrt(t))) - t;
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -200000.0) tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); elseif (t_1 <= 700.0) tmp = Float64(log(Float64(Float64(Float64(x + y) * z) / sqrt(t))) - t); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700.0], N[(N[Log[N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -200000:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(\frac{\left(x + y\right) \cdot z}{\sqrt{t}}\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\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))) < -2e5Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites77.4%
if -2e5 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 700Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
lift-+.f64N/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+r-N/A
lift-log.f64N/A
lift-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-logN/A
*-commutativeN/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
diff-logN/A
lower-log.f64N/A
Applied rewrites44.7%
if 700 < (+.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
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a) :precision binary64 (fma (- a 0.5) (log t) (- t)))
double code(double x, double y, double z, double t, double a) {
return fma((a - 0.5), log(t), -t);
}
function code(x, y, z, t, a) return fma(Float64(a - 0.5), log(t), Float64(-t)) end
code[x_, y_, z_, t_, a_] := N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]
\mathsf{fma}\left(a - 0.5, \log t, -t\right)
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6477.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= a -2e+59)
t_1
(if (<= a 2e+14) (fma (log t) -0.5 (- t)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if (a <= -2e+59) {
tmp = t_1;
} else if (a <= 2e+14) {
tmp = fma(log(t), -0.5, -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (a <= -2e+59) tmp = t_1; elseif (a <= 2e+14) tmp = fma(log(t), -0.5, Float64(-t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2e+59], t$95$1, If[LessEqual[a, 2e+14], N[(N[Log[t], $MachinePrecision] * -0.5 + (-t)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a \leq -2 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(\log t, -0.5, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -1.9999999999999999e59 or 2e14 < a Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6437.9%
Applied rewrites37.9%
if -1.9999999999999999e59 < a < 2e14Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
Taylor expanded in a around 0
Applied rewrites41.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lower-fma.f6441.8%
Applied rewrites41.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.2e+38) (* a (log t)) (* 1.0 (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.2e+38) {
tmp = a * log(t);
} else {
tmp = 1.0 * -t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
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) :: tmp
if (t <= 2.2d+38) then
tmp = a * log(t)
else
tmp = 1.0d0 * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.2e+38) {
tmp = a * Math.log(t);
} else {
tmp = 1.0 * -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.2e+38: tmp = a * math.log(t) else: tmp = 1.0 * -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.2e+38) tmp = Float64(a * log(t)); else tmp = Float64(1.0 * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.2e+38) tmp = a * log(t); else tmp = 1.0 * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.2e+38], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(1.0 * (-t)), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;t \leq 2.2 \cdot 10^{+38}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(-t\right)\\
\end{array}
if t < 2.2000000000000001e38Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6437.9%
Applied rewrites37.9%
if 2.2000000000000001e38 < t Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites66.1%
Taylor expanded in t around inf
Applied rewrites39.0%
(FPCore (x y z t a) :precision binary64 (* 1.0 (- t)))
double code(double x, double y, double z, double t, double a) {
return 1.0 * -t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
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 = 1.0d0 * -t
end function
public static double code(double x, double y, double z, double t, double a) {
return 1.0 * -t;
}
def code(x, y, z, t, a): return 1.0 * -t
function code(x, y, z, t, a) return Float64(1.0 * Float64(-t)) end
function tmp = code(x, y, z, t, a) tmp = 1.0 * -t; end
code[x_, y_, z_, t_, a_] := N[(1.0 * (-t)), $MachinePrecision]
1 \cdot \left(-t\right)
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.4%
Applied rewrites77.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites66.1%
Taylor expanded in t around inf
Applied rewrites39.0%
herbie shell --seed 2025212
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))