
(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}
Sampling outcomes in binary64 precision:
Herbie found 11 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 (log t)) (+ z y)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, log(t)) - (z + y);
}
function code(x, y, z, t) return Float64(fma(log(y), x, log(t)) - Float64(z + y)) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \log t\right) - \left(z + y\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
associate-+r-N/A
lower--.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -5e+174)
(+ (log t) (- y))
(if (<= t_1 -200000.0)
(* (- (/ (- y) z) 1.0) z)
(if (<= t_1 5e+32) (- (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 <= -5e+174) {
tmp = log(t) + -y;
} else if (t_1 <= -200000.0) {
tmp = ((-y / z) - 1.0) * z;
} else if (t_1 <= 5e+32) {
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 <= (-5d+174)) then
tmp = log(t) + -y
else if (t_1 <= (-200000.0d0)) then
tmp = ((-y / z) - 1.0d0) * z
else if (t_1 <= 5d+32) 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 <= -5e+174) {
tmp = Math.log(t) + -y;
} else if (t_1 <= -200000.0) {
tmp = ((-y / z) - 1.0) * z;
} else if (t_1 <= 5e+32) {
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 <= -5e+174: tmp = math.log(t) + -y elif t_1 <= -200000.0: tmp = ((-y / z) - 1.0) * z elif t_1 <= 5e+32: 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 <= -5e+174) tmp = Float64(log(t) + Float64(-y)); elseif (t_1 <= -200000.0) tmp = Float64(Float64(Float64(Float64(-y) / z) - 1.0) * z); elseif (t_1 <= 5e+32) 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 <= -5e+174) tmp = log(t) + -y; elseif (t_1 <= -200000.0) tmp = ((-y / z) - 1.0) * z; elseif (t_1 <= 5e+32) 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, -5e+174], N[(N[Log[t], $MachinePrecision] + (-y)), $MachinePrecision], If[LessEqual[t$95$1, -200000.0], N[(N[(N[((-y) / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$1, 5e+32], 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 -5 \cdot 10^{+174}:\\
\;\;\;\;\log t + \left(-y\right)\\
\mathbf{elif}\;t\_1 \leq -200000:\\
\;\;\;\;\left(\frac{-y}{z} - 1\right) \cdot z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+32}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -4.9999999999999997e174Initial program 99.8%
lift--.f64N/A
flip--N/A
fp-cancel-sub-sign-invN/A
div-addN/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites6.5%
Taylor expanded in z around 0
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites6.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f646.8
Applied rewrites92.8%
Taylor expanded in x around 0
Applied rewrites56.2%
if -4.9999999999999997e174 < (-.f64 (*.f64 x (log.f64 y)) y) < -2e5Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites89.7%
Taylor expanded in x around inf
Applied rewrites82.4%
Taylor expanded in y around inf
Applied rewrites70.3%
if -2e5 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.9999999999999997e32Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites98.5%
if 4.9999999999999997e32 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
associate-+r-N/A
lower--.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6472.3
Applied rewrites72.3%
Final simplification74.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -200000.0)
(* (- (/ (- y) z) 1.0) z)
(if (<= t_1 5e+32) (- (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 <= -200000.0) {
tmp = ((-y / z) - 1.0) * z;
} else if (t_1 <= 5e+32) {
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 <= (-200000.0d0)) then
tmp = ((-y / z) - 1.0d0) * z
else if (t_1 <= 5d+32) 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 <= -200000.0) {
tmp = ((-y / z) - 1.0) * z;
} else if (t_1 <= 5e+32) {
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 <= -200000.0: tmp = ((-y / z) - 1.0) * z elif t_1 <= 5e+32: 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 <= -200000.0) tmp = Float64(Float64(Float64(Float64(-y) / z) - 1.0) * z); elseif (t_1 <= 5e+32) 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 <= -200000.0) tmp = ((-y / z) - 1.0) * z; elseif (t_1 <= 5e+32) 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, -200000.0], N[(N[(N[((-y) / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$1, 5e+32], 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 -200000:\\
\;\;\;\;\left(\frac{-y}{z} - 1\right) \cdot z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+32}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e5Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites80.8%
Taylor expanded in x around inf
Applied rewrites71.3%
Taylor expanded in y around inf
Applied rewrites56.1%
if -2e5 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.9999999999999997e32Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites98.5%
if 4.9999999999999997e32 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
associate-+r-N/A
lower--.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6472.3
Applied rewrites72.3%
Final simplification70.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (log y) x (log t))))
(if (<= y 8.2e+67)
(- t_1 z)
(if (<= y 5.2e+131) (- t_1 y) (- (- (log t) y) z)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, log(t));
double tmp;
if (y <= 8.2e+67) {
tmp = t_1 - z;
} else if (y <= 5.2e+131) {
tmp = t_1 - y;
} else {
tmp = (log(t) - y) - z;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(log(y), x, log(t)) tmp = 0.0 if (y <= 8.2e+67) tmp = Float64(t_1 - z); elseif (y <= 5.2e+131) tmp = Float64(t_1 - y); else tmp = Float64(Float64(log(t) - y) - 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[y, 8.2e+67], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[y, 5.2e+131], N[(t$95$1 - y), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, \log t\right)\\
\mathbf{if}\;y \leq 8.2 \cdot 10^{+67}:\\
\;\;\;\;t\_1 - z\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+131}:\\
\;\;\;\;t\_1 - y\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\end{array}
\end{array}
if y < 8.19999999999999959e67Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
Applied rewrites94.0%
if 8.19999999999999959e67 < y < 5.2e131Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
Applied rewrites87.3%
if 5.2e131 < y Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-log.f6491.0
Applied rewrites91.0%
Final simplification92.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -7.4e+112)
(* (- (/ (* (log y) x) z) 1.0) z)
(if (<= z 0.12)
(- (fma (log y) x (log t)) y)
(* (- (* (/ (log y) z) x) 1.0) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e+112) {
tmp = (((log(y) * x) / z) - 1.0) * z;
} else if (z <= 0.12) {
tmp = fma(log(y), x, log(t)) - y;
} else {
tmp = (((log(y) / z) * x) - 1.0) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -7.4e+112) tmp = Float64(Float64(Float64(Float64(log(y) * x) / z) - 1.0) * z); elseif (z <= 0.12) tmp = Float64(fma(log(y), x, log(t)) - y); else tmp = Float64(Float64(Float64(Float64(log(y) / z) * x) - 1.0) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.4e+112], N[(N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 0.12], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[(N[(N[(N[Log[y], $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+112}:\\
\;\;\;\;\left(\frac{\log y \cdot x}{z} - 1\right) \cdot z\\
\mathbf{elif}\;z \leq 0.12:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\log y}{z} \cdot x - 1\right) \cdot z\\
\end{array}
\end{array}
if z < -7.40000000000000008e112Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites86.0%
if -7.40000000000000008e112 < z < 0.12Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
Applied rewrites96.0%
if 0.12 < z Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites96.1%
Taylor expanded in x around inf
Applied rewrites84.6%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (<= (- (* x (log y)) y) -200000.0) (* (- (/ (- y) z) 1.0) z) (- (log t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * log(y)) - y) <= -200000.0) {
tmp = ((-y / z) - 1.0) * z;
} else {
tmp = log(t) - 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 (((x * log(y)) - y) <= (-200000.0d0)) then
tmp = ((-y / z) - 1.0d0) * z
else
tmp = log(t) - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x * Math.log(y)) - y) <= -200000.0) {
tmp = ((-y / z) - 1.0) * z;
} else {
tmp = Math.log(t) - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * math.log(y)) - y) <= -200000.0: tmp = ((-y / z) - 1.0) * z else: tmp = math.log(t) - z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x * log(y)) - y) <= -200000.0) tmp = Float64(Float64(Float64(Float64(-y) / z) - 1.0) * z); else tmp = Float64(log(t) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * log(y)) - y) <= -200000.0) tmp = ((-y / z) - 1.0) * z; else tmp = log(t) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], -200000.0], N[(N[(N[((-y) / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot \log y - y \leq -200000:\\
\;\;\;\;\left(\frac{-y}{z} - 1\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\log t - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e5Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites80.8%
Taylor expanded in x around inf
Applied rewrites71.3%
Taylor expanded in y around inf
Applied rewrites56.1%
if -2e5 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites73.6%
Final simplification63.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -5.2e+193)
t_1
(if (<= x -1.1e+38)
(* (- (/ t_1 z) 1.0) z)
(if (<= x 3.5e+146) (- (- (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 <= -5.2e+193) {
tmp = t_1;
} else if (x <= -1.1e+38) {
tmp = ((t_1 / z) - 1.0) * z;
} else if (x <= 3.5e+146) {
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 <= (-5.2d+193)) then
tmp = t_1
else if (x <= (-1.1d+38)) then
tmp = ((t_1 / z) - 1.0d0) * z
else if (x <= 3.5d+146) 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 <= -5.2e+193) {
tmp = t_1;
} else if (x <= -1.1e+38) {
tmp = ((t_1 / z) - 1.0) * z;
} else if (x <= 3.5e+146) {
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 <= -5.2e+193: tmp = t_1 elif x <= -1.1e+38: tmp = ((t_1 / z) - 1.0) * z elif x <= 3.5e+146: 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 <= -5.2e+193) tmp = t_1; elseif (x <= -1.1e+38) tmp = Float64(Float64(Float64(t_1 / z) - 1.0) * z); elseif (x <= 3.5e+146) 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 <= -5.2e+193) tmp = t_1; elseif (x <= -1.1e+38) tmp = ((t_1 / z) - 1.0) * z; elseif (x <= 3.5e+146) 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, -5.2e+193], t$95$1, If[LessEqual[x, -1.1e+38], N[(N[(N[(t$95$1 / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 3.5e+146], 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 -5.2 \cdot 10^{+193}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{+38}:\\
\;\;\;\;\left(\frac{t\_1}{z} - 1\right) \cdot z\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+146}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.20000000000000026e193 or 3.5000000000000001e146 < x Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
associate-+r-N/A
lower--.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6475.8
Applied rewrites75.8%
if -5.20000000000000026e193 < x < -1.10000000000000003e38Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites79.1%
Taylor expanded in x around inf
Applied rewrites79.1%
Taylor expanded in x around inf
Applied rewrites73.1%
if -1.10000000000000003e38 < x < 3.5000000000000001e146Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-log.f6495.6
Applied rewrites95.6%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.6e+38) (not (<= x 3.5e+146))) (* (log y) x) (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.6e+38) || !(x <= 3.5e+146)) {
tmp = log(y) * x;
} else {
tmp = (log(t) - y) - 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 ((x <= (-1.6d+38)) .or. (.not. (x <= 3.5d+146))) then
tmp = log(y) * x
else
tmp = (log(t) - y) - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.6e+38) || !(x <= 3.5e+146)) {
tmp = Math.log(y) * x;
} else {
tmp = (Math.log(t) - y) - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.6e+38) or not (x <= 3.5e+146): tmp = math.log(y) * x else: tmp = (math.log(t) - y) - z return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.6e+38) || !(x <= 3.5e+146)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(log(t) - y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.6e+38) || ~((x <= 3.5e+146))) tmp = log(y) * x; else tmp = (log(t) - y) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.6e+38], N[Not[LessEqual[x, 3.5e+146]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{+38} \lor \neg \left(x \leq 3.5 \cdot 10^{+146}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\end{array}
\end{array}
if x < -1.59999999999999993e38 or 3.5000000000000001e146 < x Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
associate-+r-N/A
lower--.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6467.2
Applied rewrites67.2%
if -1.59999999999999993e38 < x < 3.5000000000000001e146Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-log.f6495.6
Applied rewrites95.6%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (<= y 1.9e+68) (- z) (* (/ (- y) z) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.9e+68) {
tmp = -z;
} else {
tmp = (-y / z) * 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 (y <= 1.9d+68) then
tmp = -z
else
tmp = (-y / z) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.9e+68) {
tmp = -z;
} else {
tmp = (-y / z) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.9e+68: tmp = -z else: tmp = (-y / z) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.9e+68) tmp = Float64(-z); else tmp = Float64(Float64(Float64(-y) / z) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.9e+68) tmp = -z; else tmp = (-y / z) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.9e+68], (-z), N[(N[((-y) / z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{+68}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{z} \cdot z\\
\end{array}
\end{array}
if y < 1.9e68Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6437.9
Applied rewrites37.9%
if 1.9e68 < y Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites72.8%
Taylor expanded in y around inf
Applied rewrites48.3%
Final simplification41.5%
(FPCore (x y z t) :precision binary64 (* (- (/ (- y) z) 1.0) z))
double code(double x, double y, double z, double t) {
return ((-y / z) - 1.0) * z;
}
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 / z) - 1.0d0) * z
end function
public static double code(double x, double y, double z, double t) {
return ((-y / z) - 1.0) * z;
}
def code(x, y, z, t): return ((-y / z) - 1.0) * z
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-y) / z) - 1.0) * z) end
function tmp = code(x, y, z, t) tmp = ((-y / z) - 1.0) * z; end
code[x_, y_, z_, t_] := N[(N[(N[((-y) / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{-y}{z} - 1\right) \cdot z
\end{array}
Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites84.9%
Taylor expanded in x around inf
Applied rewrites72.2%
Taylor expanded in y around inf
Applied rewrites48.9%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (- z))
double code(double x, double y, double z, double t) {
return -z;
}
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 = -z
end function
public static double code(double x, double y, double z, double t) {
return -z;
}
def code(x, y, z, t): return -z
function code(x, y, z, t) return Float64(-z) end
function tmp = code(x, y, z, t) tmp = -z; end
code[x_, y_, z_, t_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6430.7
Applied rewrites30.7%
Final simplification30.7%
herbie shell --seed 2025015
(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)))