
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 1/2) (log x)) x) 91893853320467/100000000000000)
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x)))double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 1/2), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 1/2) (log x)) x) 91893853320467/100000000000000)
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x)))double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 1/2), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(- (* (- x 1/2) (log x)) x)
91893853320467/100000000000000)))
(if (<=
x
14499999999999998720272738994373587179286645250166295040728605556879842875184063487747636105150035135758427588878949939476246172727771136)
(+
t_0
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x))
(+
t_0
(134-z0z1z2z3z4
1
(/ z x)
(-
(* z (- y -7936500793651/10000000000000000))
13888888888889/5000000000000000)
83333333333333/1000000000000000
(/ -1 x))))))\begin{array}{l}
t_0 := \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\\
\mathbf{if}\;x \leq 14499999999999998720272738994373587179286645250166295040728605556879842875184063487747636105150035135758427588878949939476246172727771136:\\
\;\;\;\;t\_0 + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \mathsf{134\_z0z1z2z3z4}\left(1, \left(\frac{z}{x}\right), \left(z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right), \frac{83333333333333}{1000000000000000}, \left(\frac{-1}{x}\right)\right)\\
\end{array}
if x < 1.4499999999999999e136Initial program 93.7%
if 1.4499999999999999e136 < x Initial program 93.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
mult-flipN/A
frac-2negN/A
frac-2negN/A
remove-double-negN/A
lift-+.f64N/A
add-flipN/A
div-subN/A
remove-double-negN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-neg-frac2N/A
Applied rewrites78.5%
(FPCore (x y z)
:precision binary64
(if (<=
x
1449999999999999992460678196288629153054020930222251832223387052753289011020174947123066913981252566629499979477761704400760581292442970358410575888164338643648836751836661491932116579591574117208504300150387150920068806070988869032355037184)
(+
(+ (- (* (- x 1/2) (log x)) x) 91893853320467/100000000000000)
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x))
(+
(*
(+
1
(/ (- (* (log x) (- x 1/2)) x) 91893853320467/100000000000000))
91893853320467/100000000000000)
(/ 83333333333333/1000000000000000 x))))double code(double x, double y, double z) {
double tmp;
if (x <= 1.45e+240) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((1.0 + (((log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.45d+240) then
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else
tmp = ((1.0d0 + (((log(x) * (x - 0.5d0)) - x) / 0.91893853320467d0)) * 0.91893853320467d0) + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.45e+240) {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((1.0 + (((Math.log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.45e+240: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) else: tmp = ((1.0 + (((math.log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.45e+240) tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(log(x) * Float64(x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.45e+240) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); else tmp = ((1.0 + (((log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1449999999999999992460678196288629153054020930222251832223387052753289011020174947123066913981252566629499979477761704400760581292442970358410575888164338643648836751836661491932116579591574117208504300150387150920068806070988869032355037184], N[(N[(N[(N[(N[(x - 1/2), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1 + N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 1/2), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / 91893853320467/100000000000000), $MachinePrecision]), $MachinePrecision] * 91893853320467/100000000000000), $MachinePrecision] + N[(83333333333333/1000000000000000 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 1449999999999999992460678196288629153054020930222251832223387052753289011020174947123066913981252566629499979477761704400760581292442970358410575888164338643648836751836661491932116579591574117208504300150387150920068806070988869032355037184:\\
\;\;\;\;\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{\log x \cdot \left(x - \frac{1}{2}\right) - x}{\frac{91893853320467}{100000000000000}}\right) \cdot \frac{91893853320467}{100000000000000} + \frac{\frac{83333333333333}{1000000000000000}}{x}\\
\end{array}
if x < 1.45e240Initial program 93.7%
if 1.45e240 < x Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites57.4%
(FPCore (x y z)
:precision binary64
(if (<=
x
4200000000000000291073617592167745876312847934514011129242422538996295031764355890434553731035472059531777210246775006765987958916798452501690195630869952371250925690567080429988001482765576850862064528907126853598896138331579566803386368)
(-
(- (* (- (log x) 1) x) -91893853320467/100000000000000)
(/
(-
-83333333333333/1000000000000000
(*
(-
(* (- y -7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z))
x))
(+
(*
(+
1
(/ (- (* (log x) (- x 1/2)) x) 91893853320467/100000000000000))
91893853320467/100000000000000)
(/ 83333333333333/1000000000000000 x))))double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+237) {
tmp = (((log(x) - 1.0) * x) - -0.91893853320467) - ((-0.083333333333333 - ((((y - -0.0007936500793651) * z) - 0.0027777777777778) * z)) / x);
} else {
tmp = ((1.0 + (((log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.2d+237) then
tmp = (((log(x) - 1.0d0) * x) - (-0.91893853320467d0)) - (((-0.083333333333333d0) - ((((y - (-0.0007936500793651d0)) * z) - 0.0027777777777778d0) * z)) / x)
else
tmp = ((1.0d0 + (((log(x) * (x - 0.5d0)) - x) / 0.91893853320467d0)) * 0.91893853320467d0) + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+237) {
tmp = (((Math.log(x) - 1.0) * x) - -0.91893853320467) - ((-0.083333333333333 - ((((y - -0.0007936500793651) * z) - 0.0027777777777778) * z)) / x);
} else {
tmp = ((1.0 + (((Math.log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.2e+237: tmp = (((math.log(x) - 1.0) * x) - -0.91893853320467) - ((-0.083333333333333 - ((((y - -0.0007936500793651) * z) - 0.0027777777777778) * z)) / x) else: tmp = ((1.0 + (((math.log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.2e+237) tmp = Float64(Float64(Float64(Float64(log(x) - 1.0) * x) - -0.91893853320467) - Float64(Float64(-0.083333333333333 - Float64(Float64(Float64(Float64(y - -0.0007936500793651) * z) - 0.0027777777777778) * z)) / x)); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(log(x) * Float64(x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.2e+237) tmp = (((log(x) - 1.0) * x) - -0.91893853320467) - ((-0.083333333333333 - ((((y - -0.0007936500793651) * z) - 0.0027777777777778) * z)) / x); else tmp = ((1.0 + (((log(x) * (x - 0.5)) - x) / 0.91893853320467)) * 0.91893853320467) + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4200000000000000291073617592167745876312847934514011129242422538996295031764355890434553731035472059531777210246775006765987958916798452501690195630869952371250925690567080429988001482765576850862064528907126853598896138331579566803386368], N[(N[(N[(N[(N[Log[x], $MachinePrecision] - 1), $MachinePrecision] * x), $MachinePrecision] - -91893853320467/100000000000000), $MachinePrecision] - N[(N[(-83333333333333/1000000000000000 - N[(N[(N[(N[(y - -7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1 + N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 1/2), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / 91893853320467/100000000000000), $MachinePrecision]), $MachinePrecision] * 91893853320467/100000000000000), $MachinePrecision] + N[(83333333333333/1000000000000000 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 4200000000000000291073617592167745876312847934514011129242422538996295031764355890434553731035472059531777210246775006765987958916798452501690195630869952371250925690567080429988001482765576850862064528907126853598896138331579566803386368:\\
\;\;\;\;\left(\left(\log x - 1\right) \cdot x - \frac{-91893853320467}{100000000000000}\right) - \frac{\frac{-83333333333333}{1000000000000000} - \left(\left(y - \frac{-7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{\log x \cdot \left(x - \frac{1}{2}\right) - x}{\frac{91893853320467}{100000000000000}}\right) \cdot \frac{91893853320467}{100000000000000} + \frac{\frac{83333333333333}{1000000000000000}}{x}\\
\end{array}
if x < 4.2000000000000003e237Initial program 93.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6492.8%
Applied rewrites92.8%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites92.8%
if 4.2000000000000003e237 < x Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites57.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(- (* (- x 1/2) (log x)) x)
91893853320467/100000000000000))
(t_1
(+
t_0
(/
(+
(* (- (* y z) 13888888888889/5000000000000000) z)
83333333333333/1000000000000000)
x))))
(if (<=
(+ y 7936500793651/10000000000000000)
-1152921504606847/288230376151711744)
t_1
(if (<=
(+ y 7936500793651/10000000000000000)
7320129949063641/9223372036854775808)
(+
t_0
(/
(+
(*
(-
(* 7936500793651/10000000000000000 z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x))
t_1))))double code(double x, double y, double z) {
double t_0 = (((x - 0.5) * log(x)) - x) + 0.91893853320467;
double t_1 = t_0 + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if ((y + 0.0007936500793651) <= -0.004) {
tmp = t_1;
} else if ((y + 0.0007936500793651) <= 0.0007936500793651004) {
tmp = t_0 + (((((0.0007936500793651 * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0
t_1 = t_0 + (((((y * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
if ((y + 0.0007936500793651d0) <= (-0.004d0)) then
tmp = t_1
else if ((y + 0.0007936500793651d0) <= 0.0007936500793651004d0) then
tmp = t_0 + (((((0.0007936500793651d0 * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((x - 0.5) * Math.log(x)) - x) + 0.91893853320467;
double t_1 = t_0 + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if ((y + 0.0007936500793651) <= -0.004) {
tmp = t_1;
} else if ((y + 0.0007936500793651) <= 0.0007936500793651004) {
tmp = t_0 + (((((0.0007936500793651 * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (((x - 0.5) * math.log(x)) - x) + 0.91893853320467 t_1 = t_0 + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) tmp = 0 if (y + 0.0007936500793651) <= -0.004: tmp = t_1 elif (y + 0.0007936500793651) <= 0.0007936500793651004: tmp = t_0 + (((((0.0007936500793651 * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) t_1 = Float64(t_0 + Float64(Float64(Float64(Float64(Float64(y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) tmp = 0.0 if (Float64(y + 0.0007936500793651) <= -0.004) tmp = t_1; elseif (Float64(y + 0.0007936500793651) <= 0.0007936500793651004) tmp = Float64(t_0 + Float64(Float64(Float64(Float64(Float64(0.0007936500793651 * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((x - 0.5) * log(x)) - x) + 0.91893853320467; t_1 = t_0 + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); tmp = 0.0; if ((y + 0.0007936500793651) <= -0.004) tmp = t_1; elseif ((y + 0.0007936500793651) <= 0.0007936500793651004) tmp = t_0 + (((((0.0007936500793651 * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(x - 1/2), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(N[(N[(N[(N[(y * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y + 7936500793651/10000000000000000), $MachinePrecision], -1152921504606847/288230376151711744], t$95$1, If[LessEqual[N[(y + 7936500793651/10000000000000000), $MachinePrecision], 7320129949063641/9223372036854775808], N[(t$95$0 + N[(N[(N[(N[(N[(7936500793651/10000000000000000 * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\\
t_1 := t\_0 + \frac{\left(y \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{if}\;y + \frac{7936500793651}{10000000000000000} \leq \frac{-1152921504606847}{288230376151711744}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y + \frac{7936500793651}{10000000000000000} \leq \frac{7320129949063641}{9223372036854775808}:\\
\;\;\;\;t\_0 + \frac{\left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) < -0.0040000000000000001 or 7.9365007936510045e-4 < (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) Initial program 93.7%
Taylor expanded in y around inf
lower-*.f6483.0%
Applied rewrites83.0%
if -0.0040000000000000001 < (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) < 7.9365007936510045e-4Initial program 93.7%
Taylor expanded in y around 0
Applied rewrites78.1%
(FPCore (x y z)
:precision binary64
(if (<= x 230000000000000)
(+
(+ 91893853320467/100000000000000 (* -1/2 (log x)))
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x))
(+
(+ (- (* (- x 1/2) (log x)) x) 91893853320467/100000000000000)
(/
(+
(* (- (* y z) 13888888888889/5000000000000000) z)
83333333333333/1000000000000000)
x))))double code(double x, double y, double z) {
double tmp;
if (x <= 2.3e+14) {
tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 2.3d+14) then
tmp = (0.91893853320467d0 + ((-0.5d0) * log(x))) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (((((y * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2.3e+14) {
tmp = (0.91893853320467 + (-0.5 * Math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2.3e+14: tmp = (0.91893853320467 + (-0.5 * math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2.3e+14) tmp = Float64(Float64(0.91893853320467 + Float64(-0.5 * log(x))) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2.3e+14) tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((((y * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 230000000000000], N[(N[(91893853320467/100000000000000 + N[(-1/2 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x - 1/2), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision] + N[(N[(N[(N[(N[(y * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 230000000000000:\\
\;\;\;\;\left(\frac{91893853320467}{100000000000000} + \frac{-1}{2} \cdot \log x\right) + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(y \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\end{array}
if x < 2.3e14Initial program 93.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
if 2.3e14 < x Initial program 93.7%
Taylor expanded in y around inf
lower-*.f6483.0%
Applied rewrites83.0%
(FPCore (x y z)
:precision binary64
(if (<= x 4199999999999999909983484408708288647004160)
(+
(+ 91893853320467/100000000000000 (* -1/2 (log x)))
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x))
(+
(+ (* x (- (* -1 (log (/ 1 x))) 1)) 91893853320467/100000000000000)
(/ 83333333333333/1000000000000000 x))))double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((x * ((-1.0 * log((1.0 / x))) - 1.0)) + 0.91893853320467) + (0.083333333333333 / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.2d+42) then
tmp = (0.91893853320467d0 + ((-0.5d0) * log(x))) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else
tmp = ((x * (((-1.0d0) * log((1.0d0 / x))) - 1.0d0)) + 0.91893853320467d0) + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = (0.91893853320467 + (-0.5 * Math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((x * ((-1.0 * Math.log((1.0 / x))) - 1.0)) + 0.91893853320467) + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.2e+42: tmp = (0.91893853320467 + (-0.5 * math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) else: tmp = ((x * ((-1.0 * math.log((1.0 / x))) - 1.0)) + 0.91893853320467) + (0.083333333333333 / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.2e+42) tmp = Float64(Float64(0.91893853320467 + Float64(-0.5 * log(x))) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = Float64(Float64(Float64(x * Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0)) + 0.91893853320467) + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.2e+42) tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); else tmp = ((x * ((-1.0 * log((1.0 / x))) - 1.0)) + 0.91893853320467) + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4199999999999999909983484408708288647004160], N[(N[(91893853320467/100000000000000 + N[(-1/2 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(N[(-1 * N[Log[N[(1 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision] + N[(83333333333333/1000000000000000 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 4199999999999999909983484408708288647004160:\\
\;\;\;\;\left(\frac{91893853320467}{100000000000000} + \frac{-1}{2} \cdot \log x\right) + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\frac{83333333333333}{1000000000000000}}{x}\\
\end{array}
if x < 4.1999999999999999e42Initial program 93.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
if 4.1999999999999999e42 < x Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6456.6%
Applied rewrites56.6%
(FPCore (x y z)
:precision binary64
(if (<= x 4199999999999999909983484408708288647004160)
(+
(+ 91893853320467/100000000000000 (* -1/2 (log x)))
(/
(+
(*
(-
(* (+ y 7936500793651/10000000000000000) z)
13888888888889/5000000000000000)
z)
83333333333333/1000000000000000)
x))
(-
(+
91893853320467/100000000000000
(+
(* 83333333333333/1000000000000000 (/ 1 x))
(* (log x) (- x 1/2))))
x)))double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (log(x) * (x - 0.5)))) - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.2d+42) then
tmp = (0.91893853320467d0 + ((-0.5d0) * log(x))) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else
tmp = (0.91893853320467d0 + ((0.083333333333333d0 * (1.0d0 / x)) + (log(x) * (x - 0.5d0)))) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = (0.91893853320467 + (-0.5 * Math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (Math.log(x) * (x - 0.5)))) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.2e+42: tmp = (0.91893853320467 + (-0.5 * math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) else: tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (math.log(x) * (x - 0.5)))) - x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.2e+42) tmp = Float64(Float64(0.91893853320467 + Float64(-0.5 * log(x))) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(log(x) * Float64(x - 0.5)))) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.2e+42) tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); else tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (log(x) * (x - 0.5)))) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4199999999999999909983484408708288647004160], N[(N[(91893853320467/100000000000000 + N[(-1/2 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 7936500793651/10000000000000000), $MachinePrecision] * z), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] + 83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(91893853320467/100000000000000 + N[(N[(83333333333333/1000000000000000 * N[(1 / x), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 4199999999999999909983484408708288647004160:\\
\;\;\;\;\left(\frac{91893853320467}{100000000000000} + \frac{-1}{2} \cdot \log x\right) + \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x\\
\end{array}
if x < 4.1999999999999999e42Initial program 93.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.9%
Applied rewrites62.9%
if 4.1999999999999999e42 < x Initial program 93.7%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6457.4%
Applied rewrites57.4%
(FPCore (x y z)
:precision binary64
(if (<= x 4199999999999999909983484408708288647004160)
(/
(-
(*
(-
(* z (- y -7936500793651/10000000000000000))
13888888888889/5000000000000000)
z)
-83333333333333/1000000000000000)
x)
(+
(+ (- (* (- x 1/2) (log x)) x) 91893853320467/100000000000000)
(/ 83333333333333/1000000000000000 x))))double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x;
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (0.083333333333333 / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.2d+42) then
tmp = ((((z * (y - (-0.0007936500793651d0))) - 0.0027777777777778d0) * z) - (-0.083333333333333d0)) / x
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x;
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.2e+42: tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.2e+42) tmp = Float64(Float64(Float64(Float64(Float64(z * Float64(y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.2e+42) tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x; else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4199999999999999909983484408708288647004160], N[(N[(N[(N[(N[(z * N[(y - -7936500793651/10000000000000000), $MachinePrecision]), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] - -83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(x - 1/2), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 91893853320467/100000000000000), $MachinePrecision] + N[(83333333333333/1000000000000000 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 4199999999999999909983484408708288647004160:\\
\;\;\;\;\frac{\left(z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z - \frac{-83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\frac{83333333333333}{1000000000000000}}{x}\\
\end{array}
if x < 4.1999999999999999e42Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites41.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6463.3%
Applied rewrites63.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6463.3%
Applied rewrites63.3%
if 4.1999999999999999e42 < x Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
(FPCore (x y z)
:precision binary64
(if (<= x 4199999999999999909983484408708288647004160)
(/
(-
(*
(-
(* z (- y -7936500793651/10000000000000000))
13888888888889/5000000000000000)
z)
-83333333333333/1000000000000000)
x)
(-
(+
91893853320467/100000000000000
(+
(* 83333333333333/1000000000000000 (/ 1 x))
(* (log x) (- x 1/2))))
x)))double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x;
} else {
tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (log(x) * (x - 0.5)))) - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.2d+42) then
tmp = ((((z * (y - (-0.0007936500793651d0))) - 0.0027777777777778d0) * z) - (-0.083333333333333d0)) / x
else
tmp = (0.91893853320467d0 + ((0.083333333333333d0 * (1.0d0 / x)) + (log(x) * (x - 0.5d0)))) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x;
} else {
tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (Math.log(x) * (x - 0.5)))) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.2e+42: tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x else: tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (math.log(x) * (x - 0.5)))) - x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.2e+42) tmp = Float64(Float64(Float64(Float64(Float64(z * Float64(y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(log(x) * Float64(x - 0.5)))) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.2e+42) tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x; else tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + (log(x) * (x - 0.5)))) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4199999999999999909983484408708288647004160], N[(N[(N[(N[(N[(z * N[(y - -7936500793651/10000000000000000), $MachinePrecision]), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] - -83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision], N[(N[(91893853320467/100000000000000 + N[(N[(83333333333333/1000000000000000 * N[(1 / x), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 4199999999999999909983484408708288647004160:\\
\;\;\;\;\frac{\left(z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z - \frac{-83333333333333}{1000000000000000}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x\\
\end{array}
if x < 4.1999999999999999e42Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites41.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6463.3%
Applied rewrites63.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6463.3%
Applied rewrites63.3%
if 4.1999999999999999e42 < x Initial program 93.7%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6457.4%
Applied rewrites57.4%
(FPCore (x y z)
:precision binary64
(/
(-
(*
(-
(* z (- y -7936500793651/10000000000000000))
13888888888889/5000000000000000)
z)
-83333333333333/1000000000000000)
x))double code(double x, double y, double z) {
return ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((z * (y - (-0.0007936500793651d0))) - 0.0027777777777778d0) * z) - (-0.083333333333333d0)) / x
end function
public static double code(double x, double y, double z) {
return ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x;
}
def code(x, y, z): return ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(z * Float64(y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x) end
function tmp = code(x, y, z) tmp = ((((z * (y - -0.0007936500793651)) - 0.0027777777777778) * z) - -0.083333333333333) / x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(z * N[(y - -7936500793651/10000000000000000), $MachinePrecision]), $MachinePrecision] - 13888888888889/5000000000000000), $MachinePrecision] * z), $MachinePrecision] - -83333333333333/1000000000000000), $MachinePrecision] / x), $MachinePrecision]
\frac{\left(z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z - \frac{-83333333333333}{1000000000000000}}{x}
Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.4%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites41.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6463.3%
Applied rewrites63.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6463.3%
Applied rewrites63.3%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
(+ (+ (- (* (- x 1/2) (log x)) x) 91893853320467/100000000000000) (/ (+ (* (- (* (+ y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) 83333333333333/1000000000000000) x)))