
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
(FPCore (x y z t) :precision binary64 (+ (- (fma (log y) x (- y)) z) (log t)))
double code(double x, double y, double z, double t) {
return (fma(log(y), x, -y) - z) + log(t);
}
function code(x, y, z, t) return Float64(Float64(fma(log(y), x, Float64(-y)) - z) + log(t)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(\log y, x, -y\right) - z\right) + \log t
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Initial program 99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (log y) x (log t))))
(if (<= z -5200000000.0)
(- t_1 z)
(if (<= z 1.4e+50) (- t_1 y) (* (- 1.0 (/ (- y) z)) (- z))))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, log(t));
double tmp;
if (z <= -5200000000.0) {
tmp = t_1 - z;
} else if (z <= 1.4e+50) {
tmp = t_1 - y;
} else {
tmp = (1.0 - (-y / z)) * -z;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(log(y), x, log(t)) tmp = 0.0 if (z <= -5200000000.0) tmp = Float64(t_1 - z); elseif (z <= 1.4e+50) tmp = Float64(t_1 - y); else tmp = Float64(Float64(1.0 - Float64(Float64(-y) / z)) * Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5200000000.0], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[z, 1.4e+50], N[(t$95$1 - y), $MachinePrecision], N[(N[(1.0 - N[((-y) / z), $MachinePrecision]), $MachinePrecision] * (-z)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, \log t\right)\\
\mathbf{if}\;z \leq -5200000000:\\
\;\;\;\;t\_1 - z\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+50}:\\
\;\;\;\;t\_1 - y\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{-y}{z}\right) \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < -5.2e9Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6478.6
Applied rewrites78.6%
if -5.2e9 < z < 1.3999999999999999e50Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6496.9
Applied rewrites96.9%
if 1.3999999999999999e50 < z Initial program 99.9%
Taylor expanded in z around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6481.3
Applied rewrites81.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) z))) (if (<= x -5.5e+28) t_1 (if (<= x 25000.0) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - z;
double tmp;
if (x <= -5.5e+28) {
tmp = t_1;
} else if (x <= 25000.0) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = (log(y) * x) - z
if (x <= (-5.5d+28)) then
tmp = t_1
else if (x <= 25000.0d0) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) * x) - z;
double tmp;
if (x <= -5.5e+28) {
tmp = t_1;
} else if (x <= 25000.0) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - z tmp = 0 if x <= -5.5e+28: tmp = t_1 elif x <= 25000.0: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - z) tmp = 0.0 if (x <= -5.5e+28) tmp = t_1; elseif (x <= 25000.0) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - z; tmp = 0.0; if (x <= -5.5e+28) tmp = t_1; elseif (x <= 25000.0) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -5.5e+28], t$95$1, If[LessEqual[x, 25000.0], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - z\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 25000:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.5000000000000003e28 or 25000 < x Initial program 99.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6481.4
Applied rewrites81.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6481.2
Applied rewrites81.2%
if -5.5000000000000003e28 < x < 25000Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6498.1
Applied rewrites98.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) y))) (if (<= x -8.6e+21) t_1 (if (<= x 3.7e+29) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - y;
double tmp;
if (x <= -8.6e+21) {
tmp = t_1;
} else if (x <= 3.7e+29) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = (log(y) * x) - y
if (x <= (-8.6d+21)) then
tmp = t_1
else if (x <= 3.7d+29) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) * x) - y;
double tmp;
if (x <= -8.6e+21) {
tmp = t_1;
} else if (x <= 3.7e+29) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - y tmp = 0 if x <= -8.6e+21: tmp = t_1 elif x <= 3.7e+29: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - y) tmp = 0.0 if (x <= -8.6e+21) tmp = t_1; elseif (x <= 3.7e+29) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - y; tmp = 0.0; if (x <= -8.6e+21) tmp = t_1; elseif (x <= 3.7e+29) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -8.6e+21], t$95$1, If[LessEqual[x, 3.7e+29], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - y\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+29}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.6e21 or 3.69999999999999974e29 < x Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6480.0
Applied rewrites80.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6480.0
Applied rewrites80.0%
if -8.6e21 < x < 3.69999999999999974e29Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6497.4
Applied rewrites97.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) x))) (if (<= x -1.15e+29) t_1 (if (<= x 1.05e+33) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -1.15e+29) {
tmp = t_1;
} else if (x <= 1.05e+33) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = log(y) * x
if (x <= (-1.15d+29)) then
tmp = t_1
else if (x <= 1.05d+33) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double tmp;
if (x <= -1.15e+29) {
tmp = t_1;
} else if (x <= 1.05e+33) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -1.15e+29: tmp = t_1 elif x <= 1.05e+33: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -1.15e+29) tmp = t_1; elseif (x <= 1.05e+33) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -1.15e+29) tmp = t_1; elseif (x <= 1.05e+33) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.15e+29], t$95$1, If[LessEqual[x, 1.05e+33], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+33}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.1500000000000001e29 or 1.05e33 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6463.0
Applied rewrites63.0%
if -1.1500000000000001e29 < x < 1.05e33Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6497.1
Applied rewrites97.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -4e+222)
(- y)
(if (<= t_1 -10000000000000.0)
(* (- 1.0 (/ (- y) z)) (- z))
(if (<= t_1 5e+27) (- (log t) z) (* (log y) x))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double tmp;
if (t_1 <= -4e+222) {
tmp = -y;
} else if (t_1 <= -10000000000000.0) {
tmp = (1.0 - (-y / z)) * -z;
} else if (t_1 <= 5e+27) {
tmp = log(t) - z;
} else {
tmp = log(y) * x;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = (x * log(y)) - y
if (t_1 <= (-4d+222)) then
tmp = -y
else if (t_1 <= (-10000000000000.0d0)) then
tmp = (1.0d0 - (-y / z)) * -z
else if (t_1 <= 5d+27) then
tmp = log(t) - z
else
tmp = log(y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * Math.log(y)) - y;
double tmp;
if (t_1 <= -4e+222) {
tmp = -y;
} else if (t_1 <= -10000000000000.0) {
tmp = (1.0 - (-y / z)) * -z;
} else if (t_1 <= 5e+27) {
tmp = Math.log(t) - z;
} else {
tmp = Math.log(y) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y tmp = 0 if t_1 <= -4e+222: tmp = -y elif t_1 <= -10000000000000.0: tmp = (1.0 - (-y / z)) * -z elif t_1 <= 5e+27: tmp = math.log(t) - z else: tmp = math.log(y) * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) tmp = 0.0 if (t_1 <= -4e+222) tmp = Float64(-y); elseif (t_1 <= -10000000000000.0) tmp = Float64(Float64(1.0 - Float64(Float64(-y) / z)) * Float64(-z)); elseif (t_1 <= 5e+27) tmp = Float64(log(t) - z); else tmp = Float64(log(y) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - y; tmp = 0.0; if (t_1 <= -4e+222) tmp = -y; elseif (t_1 <= -10000000000000.0) tmp = (1.0 - (-y / z)) * -z; elseif (t_1 <= 5e+27) tmp = log(t) - z; else tmp = log(y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+222], (-y), If[LessEqual[t$95$1, -10000000000000.0], N[(N[(1.0 - N[((-y) / z), $MachinePrecision]), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[t$95$1, 5e+27], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+222}:\\
\;\;\;\;-y\\
\mathbf{elif}\;t\_1 \leq -10000000000000:\\
\;\;\;\;\left(1 - \frac{-y}{z}\right) \cdot \left(-z\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+27}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -4.0000000000000002e222Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6460.3
Applied rewrites60.3%
if -4.0000000000000002e222 < (-.f64 (*.f64 x (log.f64 y)) y) < -1e13Initial program 99.9%
Taylor expanded in z around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
Applied rewrites80.1%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6463.4
Applied rewrites63.4%
if -1e13 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.99999999999999979e27Initial program 100.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6497.2
Applied rewrites97.2%
Taylor expanded in x around 0
lift-log.f6493.4
Applied rewrites93.4%
if 4.99999999999999979e27 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6477.7
Applied rewrites77.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -5.5e+28)
t_1
(if (<= x -1.15e-127)
(- (log t) y)
(if (<= x 1.25e+16) (- (log t) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -5.5e+28) {
tmp = t_1;
} else if (x <= -1.15e-127) {
tmp = log(t) - y;
} else if (x <= 1.25e+16) {
tmp = log(t) - z;
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = log(y) * x
if (x <= (-5.5d+28)) then
tmp = t_1
else if (x <= (-1.15d-127)) then
tmp = log(t) - y
else if (x <= 1.25d+16) then
tmp = log(t) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double tmp;
if (x <= -5.5e+28) {
tmp = t_1;
} else if (x <= -1.15e-127) {
tmp = Math.log(t) - y;
} else if (x <= 1.25e+16) {
tmp = Math.log(t) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -5.5e+28: tmp = t_1 elif x <= -1.15e-127: tmp = math.log(t) - y elif x <= 1.25e+16: tmp = math.log(t) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -5.5e+28) tmp = t_1; elseif (x <= -1.15e-127) tmp = Float64(log(t) - y); elseif (x <= 1.25e+16) tmp = Float64(log(t) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -5.5e+28) tmp = t_1; elseif (x <= -1.15e-127) tmp = log(t) - y; elseif (x <= 1.25e+16) tmp = log(t) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -5.5e+28], t$95$1, If[LessEqual[x, -1.15e-127], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.25e+16], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-127}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+16}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.5000000000000003e28 or 1.25e16 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6461.9
Applied rewrites61.9%
if -5.5000000000000003e28 < x < -1.15000000000000009e-127Initial program 100.0%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6463.9
Applied rewrites63.9%
Taylor expanded in x around 0
lift-log.f6458.4
Applied rewrites58.4%
if -1.15000000000000009e-127 < x < 1.25e16Initial program 100.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6462.8
Applied rewrites62.8%
Taylor expanded in x around 0
lift-log.f6461.7
Applied rewrites61.7%
(FPCore (x y z t) :precision binary64 (if (<= z -5200000000.0) (- (log t) z) (if (<= z 7e+67) (- (log t) y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5200000000.0) {
tmp = log(t) - z;
} else if (z <= 7e+67) {
tmp = log(t) - y;
} else {
tmp = -z;
}
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)
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) :: tmp
if (z <= (-5200000000.0d0)) then
tmp = log(t) - z
else if (z <= 7d+67) then
tmp = log(t) - y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5200000000.0) {
tmp = Math.log(t) - z;
} else if (z <= 7e+67) {
tmp = Math.log(t) - y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5200000000.0: tmp = math.log(t) - z elif z <= 7e+67: tmp = math.log(t) - y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5200000000.0) tmp = Float64(log(t) - z); elseif (z <= 7e+67) tmp = Float64(log(t) - y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5200000000.0) tmp = log(t) - z; elseif (z <= 7e+67) tmp = log(t) - y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5200000000.0], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[z, 7e+67], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5200000000:\\
\;\;\;\;\log t - z\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+67}:\\
\;\;\;\;\log t - y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -5.2e9Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6478.6
Applied rewrites78.6%
Taylor expanded in x around 0
lift-log.f6458.3
Applied rewrites58.3%
if -5.2e9 < z < 7e67Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6496.0
Applied rewrites96.0%
Taylor expanded in x around 0
lift-log.f6459.1
Applied rewrites59.1%
if 7e67 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6466.1
Applied rewrites66.1%
(FPCore (x y z t) :precision binary64 (if (<= z -5200000000.0) (- z) (if (<= z 7e+67) (- (log t) y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5200000000.0) {
tmp = -z;
} else if (z <= 7e+67) {
tmp = log(t) - y;
} else {
tmp = -z;
}
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)
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) :: tmp
if (z <= (-5200000000.0d0)) then
tmp = -z
else if (z <= 7d+67) then
tmp = log(t) - y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5200000000.0) {
tmp = -z;
} else if (z <= 7e+67) {
tmp = Math.log(t) - y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5200000000.0: tmp = -z elif z <= 7e+67: tmp = math.log(t) - y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5200000000.0) tmp = Float64(-z); elseif (z <= 7e+67) tmp = Float64(log(t) - y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5200000000.0) tmp = -z; elseif (z <= 7e+67) tmp = log(t) - y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5200000000.0], (-z), If[LessEqual[z, 7e+67], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5200000000:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+67}:\\
\;\;\;\;\log t - y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -5.2e9 or 7e67 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6461.7
Applied rewrites61.7%
if -5.2e9 < z < 7e67Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6496.0
Applied rewrites96.0%
Taylor expanded in x around 0
lift-log.f6459.1
Applied rewrites59.1%
(FPCore (x y z t) :precision binary64 (if (<= z -5200000000.0) (- z) (if (<= z 7e+67) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5200000000.0) {
tmp = -z;
} else if (z <= 7e+67) {
tmp = -y;
} else {
tmp = -z;
}
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)
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) :: tmp
if (z <= (-5200000000.0d0)) then
tmp = -z
else if (z <= 7d+67) then
tmp = -y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5200000000.0) {
tmp = -z;
} else if (z <= 7e+67) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5200000000.0: tmp = -z elif z <= 7e+67: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5200000000.0) tmp = Float64(-z); elseif (z <= 7e+67) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5200000000.0) tmp = -z; elseif (z <= 7e+67) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5200000000.0], (-z), If[LessEqual[z, 7e+67], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5200000000:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+67}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -5.2e9 or 7e67 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6461.7
Applied rewrites61.7%
if -5.2e9 < z < 7e67Initial program 99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
return -y;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -y
end function
public static double code(double x, double y, double z, double t) {
return -y;
}
def code(x, y, z, t): return -y
function code(x, y, z, t) return Float64(-y) end
function tmp = code(x, y, z, t) tmp = -y; end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}
\\
-y
\end{array}
Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6429.5
Applied rewrites29.5%
herbie shell --seed 2025112
(FPCore (x y z t)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (- (* x (log y)) y) z) (log t)))