
(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]
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
Herbie found 9 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]
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<=
y
719999999999999990922812560065494956500148488933128463223546424600821760)
(+ (- t_1 z) (log t))
(if (<=
y
7999999999999999840027746779153609453350441543176068145509186494646179317019429803718315479439939518038208601448616296448)
(- (+ (log t) t_1) y)
(- (log t) (+ y z))))))double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (y <= 7.2e+71) {
tmp = (t_1 - z) + log(t);
} else if (y <= 8e+120) {
tmp = (log(t) + t_1) - y;
} 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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (y <= 7.2d+71) then
tmp = (t_1 - z) + log(t)
else if (y <= 8d+120) then
tmp = (log(t) + t_1) - y
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 t_1 = x * Math.log(y);
double tmp;
if (y <= 7.2e+71) {
tmp = (t_1 - z) + Math.log(t);
} else if (y <= 8e+120) {
tmp = (Math.log(t) + t_1) - y;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if y <= 7.2e+71: tmp = (t_1 - z) + math.log(t) elif y <= 8e+120: tmp = (math.log(t) + t_1) - y else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (y <= 7.2e+71) tmp = Float64(Float64(t_1 - z) + log(t)); elseif (y <= 8e+120) tmp = Float64(Float64(log(t) + t_1) - y); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (y <= 7.2e+71) tmp = (t_1 - z) + log(t); elseif (y <= 8e+120) tmp = (log(t) + t_1) - y; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 719999999999999990922812560065494956500148488933128463223546424600821760], N[(N[(t$95$1 - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7999999999999999840027746779153609453350441543176068145509186494646179317019429803718315479439939518038208601448616296448], N[(N[(N[Log[t], $MachinePrecision] + t$95$1), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;y \leq 719999999999999990922812560065494956500148488933128463223546424600821760:\\
\;\;\;\;\left(t\_1 - z\right) + \log t\\
\mathbf{elif}\;y \leq 7999999999999999840027746779153609453350441543176068145509186494646179317019429803718315479439939518038208601448616296448:\\
\;\;\;\;\left(\log t + t\_1\right) - y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
if y < 7.1999999999999999e71Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6471.3%
Applied rewrites71.3%
if 7.1999999999999999e71 < y < 7.9999999999999998e120Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6470.4%
Applied rewrites70.4%
if 7.9999999999999998e120 < y Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (+ (log t) (* x (log y))) y)))
(if (<=
x
-160000000000000003411267041512703499568201259402874391483893415936)
t_1
(if (<=
x
205000000000000000712752045580635333763662595444401860644264900033085951117885440)
(- (log t) (+ y z))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = (log(t) + (x * log(y))) - y;
double tmp;
if (x <= -1.6e+65) {
tmp = t_1;
} else if (x <= 2.05e+80) {
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(t) + (x * log(y))) - y
if (x <= (-1.6d+65)) then
tmp = t_1
else if (x <= 2.05d+80) 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(t) + (x * Math.log(y))) - y;
double tmp;
if (x <= -1.6e+65) {
tmp = t_1;
} else if (x <= 2.05e+80) {
tmp = Math.log(t) - (y + z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(t) + (x * math.log(y))) - y tmp = 0 if x <= -1.6e+65: tmp = t_1 elif x <= 2.05e+80: tmp = math.log(t) - (y + z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(t) + Float64(x * log(y))) - y) tmp = 0.0 if (x <= -1.6e+65) tmp = t_1; elseif (x <= 2.05e+80) tmp = Float64(log(t) - Float64(y + z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(t) + (x * log(y))) - y; tmp = 0.0; if (x <= -1.6e+65) tmp = t_1; elseif (x <= 2.05e+80) 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[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -160000000000000003411267041512703499568201259402874391483893415936], t$95$1, If[LessEqual[x, 205000000000000000712752045580635333763662595444401860644264900033085951117885440], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(\log t + x \cdot \log y\right) - y\\
\mathbf{if}\;x \leq -160000000000000003411267041512703499568201259402874391483893415936:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 205000000000000000712752045580635333763662595444401860644264900033085951117885440:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -1.6e65 or 2.05e80 < x Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6470.4%
Applied rewrites70.4%
if -1.6e65 < x < 2.05e80Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ (* x (log y)) z))))
(if (<=
x
-270000000000000018122005435148810426653307705375889715385990186589798761847755892638561432527845242977315312447781045472512060821564119056384)
t_1
(if (<=
x
10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104)
(- (log t) (+ y z))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = z * ((x * log(y)) / z);
double tmp;
if (x <= -2.7e+140) {
tmp = t_1;
} else if (x <= 1e+100) {
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 = z * ((x * log(y)) / z)
if (x <= (-2.7d+140)) then
tmp = t_1
else if (x <= 1d+100) 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 = z * ((x * Math.log(y)) / z);
double tmp;
if (x <= -2.7e+140) {
tmp = t_1;
} else if (x <= 1e+100) {
tmp = Math.log(t) - (y + z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * ((x * math.log(y)) / z) tmp = 0 if x <= -2.7e+140: tmp = t_1 elif x <= 1e+100: tmp = math.log(t) - (y + z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(Float64(x * log(y)) / z)) tmp = 0.0 if (x <= -2.7e+140) tmp = t_1; elseif (x <= 1e+100) tmp = Float64(log(t) - Float64(y + z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * ((x * log(y)) / z); tmp = 0.0; if (x <= -2.7e+140) tmp = t_1; elseif (x <= 1e+100) tmp = log(t) - (y + z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -270000000000000018122005435148810426653307705375889715385990186589798761847755892638561432527845242977315312447781045472512060821564119056384], t$95$1, If[LessEqual[x, 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := z \cdot \frac{x \cdot \log y}{z}\\
\mathbf{if}\;x \leq -270000000000000018122005435148810426653307705375889715385990186589798761847755892638561432527845242977315312447781045472512060821564119056384:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -2.7000000000000002e140 or 1e100 < x Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-/.f6479.8%
Applied rewrites79.8%
Taylor expanded in z around inf
Applied rewrites30.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-log.f6420.0%
Applied rewrites20.0%
if -2.7000000000000002e140 < x < 1e100Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
(FPCore (x y z t) :precision binary64 (- (log t) (+ y z)))
double code(double x, double y, double z, double t) {
return log(t) - (y + 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 = log(t) - (y + z)
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) - (y + z);
}
def code(x, y, z, t): return math.log(t) - (y + z)
function code(x, y, z, t) return Float64(log(t) - Float64(y + z)) end
function tmp = code(x, y, z, t) tmp = log(t) - (y + z); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]
\log t - \left(y + z\right)
Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
(FPCore (x y z t)
:precision binary64
(if (<=
y
280000000000000000321333304781609280627972100690964841222179916714808304467968)
(- (log t) z)
(- (log t) y)))double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.8e+77) {
tmp = log(t) - z;
} else {
tmp = log(t) - y;
}
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 <= 2.8d+77) then
tmp = log(t) - z
else
tmp = log(t) - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.8e+77) {
tmp = Math.log(t) - z;
} else {
tmp = Math.log(t) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.8e+77: tmp = math.log(t) - z else: tmp = math.log(t) - y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.8e+77) tmp = Float64(log(t) - z); else tmp = Float64(log(t) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.8e+77) tmp = log(t) - z; else tmp = log(t) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 280000000000000000321333304781609280627972100690964841222179916714808304467968], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq 280000000000000000321333304781609280627972100690964841222179916714808304467968:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\log t - y\\
\end{array}
if y < 2.8e77Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
Taylor expanded in y around 0
Applied rewrites43.0%
if 2.8e77 < y Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6470.4%
Applied rewrites70.4%
Taylor expanded in x around 0
lower-log.f6442.1%
Applied rewrites42.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -250000000000000011221428169518979196387328)
(* z -1)
(if (<=
z
189999999999999989608532542244330147673668766518374709649109067702331020071656162984364219905818102044713301325679389780922989584734916918217015296)
(- (log t) y)
(* z -1))))double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+41) {
tmp = z * -1.0;
} else if (z <= 1.9e+146) {
tmp = log(t) - y;
} else {
tmp = z * -1.0;
}
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 <= (-2.5d+41)) then
tmp = z * (-1.0d0)
else if (z <= 1.9d+146) then
tmp = log(t) - y
else
tmp = z * (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+41) {
tmp = z * -1.0;
} else if (z <= 1.9e+146) {
tmp = Math.log(t) - y;
} else {
tmp = z * -1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.5e+41: tmp = z * -1.0 elif z <= 1.9e+146: tmp = math.log(t) - y else: tmp = z * -1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e+41) tmp = Float64(z * -1.0); elseif (z <= 1.9e+146) tmp = Float64(log(t) - y); else tmp = Float64(z * -1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.5e+41) tmp = z * -1.0; elseif (z <= 1.9e+146) tmp = log(t) - y; else tmp = z * -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -250000000000000011221428169518979196387328], N[(z * -1), $MachinePrecision], If[LessEqual[z, 189999999999999989608532542244330147673668766518374709649109067702331020071656162984364219905818102044713301325679389780922989584734916918217015296], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], N[(z * -1), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -250000000000000011221428169518979196387328:\\
\;\;\;\;z \cdot -1\\
\mathbf{elif}\;z \leq 189999999999999989608532542244330147673668766518374709649109067702331020071656162984364219905818102044713301325679389780922989584734916918217015296:\\
\;\;\;\;\log t - y\\
\mathbf{else}:\\
\;\;\;\;z \cdot -1\\
\end{array}
if z < -2.5000000000000001e41 or 1.8999999999999999e146 < z Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-/.f6479.8%
Applied rewrites79.8%
Taylor expanded in z around inf
Applied rewrites30.4%
if -2.5000000000000001e41 < z < 1.8999999999999999e146Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6470.4%
Applied rewrites70.4%
Taylor expanded in x around 0
lower-log.f6442.1%
Applied rewrites42.1%
(FPCore (x y z t)
:precision binary64
(if (<=
y
280000000000000000321333304781609280627972100690964841222179916714808304467968)
(* z -1)
(* (/ (- y) z) z)))double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.8e+77) {
tmp = z * -1.0;
} 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 <= 2.8d+77) then
tmp = z * (-1.0d0)
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 <= 2.8e+77) {
tmp = z * -1.0;
} else {
tmp = (-y / z) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.8e+77: tmp = z * -1.0 else: tmp = (-y / z) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.8e+77) tmp = Float64(z * -1.0); 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 <= 2.8e+77) tmp = z * -1.0; else tmp = (-y / z) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 280000000000000000321333304781609280627972100690964841222179916714808304467968], N[(z * -1), $MachinePrecision], N[(N[((-y) / z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq 280000000000000000321333304781609280627972100690964841222179916714808304467968:\\
\;\;\;\;z \cdot -1\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{z} \cdot z\\
\end{array}
if y < 2.8e77Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-/.f6479.8%
Applied rewrites79.8%
Taylor expanded in z around inf
Applied rewrites30.4%
if 2.8e77 < y Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-/.f6479.8%
Applied rewrites79.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f6420.2%
Applied rewrites20.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6420.2%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-neg.f64N/A
lower-/.f6420.2%
Applied rewrites20.2%
(FPCore (x y z t) :precision binary64 (* z -1))
double code(double x, double y, double z, double t) {
return z * -1.0;
}
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 * (-1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return z * -1.0;
}
def code(x, y, z, t): return z * -1.0
function code(x, y, z, t) return Float64(z * -1.0) end
function tmp = code(x, y, z, t) tmp = z * -1.0; end
code[x_, y_, z_, t_] := N[(z * -1), $MachinePrecision]
z \cdot -1
Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-/.f6479.8%
Applied rewrites79.8%
Taylor expanded in z around inf
Applied rewrites30.4%
herbie shell --seed 2025271 -o generate:evaluate
(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)))