
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (+ y x) (- z y)) z)))
(if (<= y -5.3e-82)
t_0
(if (<= y 9.5e-16) (/ (+ x y) (- 1.0 (/ y z))) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y + x) / (z - y)) * z;
double tmp;
if (y <= -5.3e-82) {
tmp = t_0;
} else if (y <= 9.5e-16) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_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)
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) :: tmp
t_0 = ((y + x) / (z - y)) * z
if (y <= (-5.3d-82)) then
tmp = t_0
else if (y <= 9.5d-16) then
tmp = (x + y) / (1.0d0 - (y / z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y + x) / (z - y)) * z;
double tmp;
if (y <= -5.3e-82) {
tmp = t_0;
} else if (y <= 9.5e-16) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y + x) / (z - y)) * z tmp = 0 if y <= -5.3e-82: tmp = t_0 elif y <= 9.5e-16: tmp = (x + y) / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y + x) / Float64(z - y)) * z) tmp = 0.0 if (y <= -5.3e-82) tmp = t_0; elseif (y <= 9.5e-16) tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y + x) / (z - y)) * z; tmp = 0.0; if (y <= -5.3e-82) tmp = t_0; elseif (y <= 9.5e-16) tmp = (x + y) / (1.0 - (y / z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -5.3e-82], t$95$0, If[LessEqual[y, 9.5e-16], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y + x}{z - y} \cdot z\\
\mathbf{if}\;y \leq -5.3 \cdot 10^{-82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-16}:\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.29999999999999956e-82 or 9.5000000000000005e-16 < y Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
if -5.29999999999999956e-82 < y < 9.5000000000000005e-16Initial program 88.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))) (t_1 (* (/ z (- z y)) (+ y x))))
(if (<= t_0 -1e-223)
t_1
(if (<= t_0 2e-185) (* (/ (+ y x) (- z y)) z) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double t_1 = (z / (z - y)) * (y + x);
double tmp;
if (t_0 <= -1e-223) {
tmp = t_1;
} else if (t_0 <= 2e-185) {
tmp = ((y + x) / (z - 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)
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 + y) / (1.0d0 - (y / z))
t_1 = (z / (z - y)) * (y + x)
if (t_0 <= (-1d-223)) then
tmp = t_1
else if (t_0 <= 2d-185) then
tmp = ((y + x) / (z - y)) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double t_1 = (z / (z - y)) * (y + x);
double tmp;
if (t_0 <= -1e-223) {
tmp = t_1;
} else if (t_0 <= 2e-185) {
tmp = ((y + x) / (z - y)) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) t_1 = (z / (z - y)) * (y + x) tmp = 0 if t_0 <= -1e-223: tmp = t_1 elif t_0 <= 2e-185: tmp = ((y + x) / (z - y)) * z else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) t_1 = Float64(Float64(z / Float64(z - y)) * Float64(y + x)) tmp = 0.0 if (t_0 <= -1e-223) tmp = t_1; elseif (t_0 <= 2e-185) tmp = Float64(Float64(Float64(y + x) / Float64(z - y)) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) / (1.0 - (y / z)); t_1 = (z / (z - y)) * (y + x); tmp = 0.0; if (t_0 <= -1e-223) tmp = t_1; elseif (t_0 <= 2e-185) tmp = ((y + x) / (z - y)) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-223], t$95$1, If[LessEqual[t$95$0, 2e-185], N[(N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
t_1 := \frac{z}{z - y} \cdot \left(y + x\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-185}:\\
\;\;\;\;\frac{y + x}{z - y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -9.9999999999999997e-224 or 2e-185 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-flip-revN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6488.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
if -9.9999999999999997e-224 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 2e-185Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))) (t_1 (* (/ z (- z y)) (+ y x)))) (if (<= t_0 -1e-223) t_1 (if (<= t_0 5e-287) (* (/ y (- z y)) z) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double t_1 = (z / (z - y)) * (y + x);
double tmp;
if (t_0 <= -1e-223) {
tmp = t_1;
} else if (t_0 <= 5e-287) {
tmp = (y / (z - 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)
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 + y) / (1.0d0 - (y / z))
t_1 = (z / (z - y)) * (y + x)
if (t_0 <= (-1d-223)) then
tmp = t_1
else if (t_0 <= 5d-287) then
tmp = (y / (z - y)) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double t_1 = (z / (z - y)) * (y + x);
double tmp;
if (t_0 <= -1e-223) {
tmp = t_1;
} else if (t_0 <= 5e-287) {
tmp = (y / (z - y)) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) t_1 = (z / (z - y)) * (y + x) tmp = 0 if t_0 <= -1e-223: tmp = t_1 elif t_0 <= 5e-287: tmp = (y / (z - y)) * z else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) t_1 = Float64(Float64(z / Float64(z - y)) * Float64(y + x)) tmp = 0.0 if (t_0 <= -1e-223) tmp = t_1; elseif (t_0 <= 5e-287) tmp = Float64(Float64(y / Float64(z - y)) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) / (1.0 - (y / z)); t_1 = (z / (z - y)) * (y + x); tmp = 0.0; if (t_0 <= -1e-223) tmp = t_1; elseif (t_0 <= 5e-287) tmp = (y / (z - y)) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-223], t$95$1, If[LessEqual[t$95$0, 5e-287], N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
t_1 := \frac{z}{z - y} \cdot \left(y + x\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-287}:\\
\;\;\;\;\frac{y}{z - y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -9.9999999999999997e-224 or 5.00000000000000025e-287 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-flip-revN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6488.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
if -9.9999999999999997e-224 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 5.00000000000000025e-287Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around 0
Applied rewrites48.4%
(FPCore (x y z) :precision binary64 (if (<= x -3.7e-23) (/ x (- 1.0 (/ y z))) (if (<= x 2e-60) (* (/ y (- z y)) z) (* (/ x (- z y)) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.7e-23) {
tmp = x / (1.0 - (y / z));
} else if (x <= 2e-60) {
tmp = (y / (z - y)) * z;
} else {
tmp = (x / (z - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3.7d-23)) then
tmp = x / (1.0d0 - (y / z))
else if (x <= 2d-60) then
tmp = (y / (z - y)) * z
else
tmp = (x / (z - y)) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.7e-23) {
tmp = x / (1.0 - (y / z));
} else if (x <= 2e-60) {
tmp = (y / (z - y)) * z;
} else {
tmp = (x / (z - y)) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.7e-23: tmp = x / (1.0 - (y / z)) elif x <= 2e-60: tmp = (y / (z - y)) * z else: tmp = (x / (z - y)) * z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.7e-23) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (x <= 2e-60) tmp = Float64(Float64(y / Float64(z - y)) * z); else tmp = Float64(Float64(x / Float64(z - y)) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.7e-23) tmp = x / (1.0 - (y / z)); elseif (x <= 2e-60) tmp = (y / (z - y)) * z; else tmp = (x / (z - y)) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.7e-23], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e-60], N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-23}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{z - y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y} \cdot z\\
\end{array}
\end{array}
if x < -3.7000000000000003e-23Initial program 88.3%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.7
Applied rewrites49.7%
if -3.7000000000000003e-23 < x < 1.9999999999999999e-60Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around 0
Applied rewrites48.4%
if 1.9999999999999999e-60 < x Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6446.1
Applied rewrites46.1%
(FPCore (x y z) :precision binary64 (if (<= x -3.7e-23) (* (/ z (- z y)) x) (if (<= x 2e-60) (* (/ y (- z y)) z) (* (/ x (- z y)) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.7e-23) {
tmp = (z / (z - y)) * x;
} else if (x <= 2e-60) {
tmp = (y / (z - y)) * z;
} else {
tmp = (x / (z - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3.7d-23)) then
tmp = (z / (z - y)) * x
else if (x <= 2d-60) then
tmp = (y / (z - y)) * z
else
tmp = (x / (z - y)) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.7e-23) {
tmp = (z / (z - y)) * x;
} else if (x <= 2e-60) {
tmp = (y / (z - y)) * z;
} else {
tmp = (x / (z - y)) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.7e-23: tmp = (z / (z - y)) * x elif x <= 2e-60: tmp = (y / (z - y)) * z else: tmp = (x / (z - y)) * z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.7e-23) tmp = Float64(Float64(z / Float64(z - y)) * x); elseif (x <= 2e-60) tmp = Float64(Float64(y / Float64(z - y)) * z); else tmp = Float64(Float64(x / Float64(z - y)) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.7e-23) tmp = (z / (z - y)) * x; elseif (x <= 2e-60) tmp = (y / (z - y)) * z; else tmp = (x / (z - y)) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.7e-23], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2e-60], N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-23}:\\
\;\;\;\;\frac{z}{z - y} \cdot x\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{z - y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y} \cdot z\\
\end{array}
\end{array}
if x < -3.7000000000000003e-23Initial program 88.3%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.7
Applied rewrites49.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
*-lft-identityN/A
lift--.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
if -3.7000000000000003e-23 < x < 1.9999999999999999e-60Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around 0
Applied rewrites48.4%
if 1.9999999999999999e-60 < x Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6446.1
Applied rewrites46.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (- z y))))
(if (<= x -5.9e-24)
(* t_0 x)
(if (<= x 2e-60) (* t_0 y) (* (/ x (- z y)) z)))))
double code(double x, double y, double z) {
double t_0 = z / (z - y);
double tmp;
if (x <= -5.9e-24) {
tmp = t_0 * x;
} else if (x <= 2e-60) {
tmp = t_0 * y;
} else {
tmp = (x / (z - 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)
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) :: tmp
t_0 = z / (z - y)
if (x <= (-5.9d-24)) then
tmp = t_0 * x
else if (x <= 2d-60) then
tmp = t_0 * y
else
tmp = (x / (z - y)) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (z - y);
double tmp;
if (x <= -5.9e-24) {
tmp = t_0 * x;
} else if (x <= 2e-60) {
tmp = t_0 * y;
} else {
tmp = (x / (z - y)) * z;
}
return tmp;
}
def code(x, y, z): t_0 = z / (z - y) tmp = 0 if x <= -5.9e-24: tmp = t_0 * x elif x <= 2e-60: tmp = t_0 * y else: tmp = (x / (z - y)) * z return tmp
function code(x, y, z) t_0 = Float64(z / Float64(z - y)) tmp = 0.0 if (x <= -5.9e-24) tmp = Float64(t_0 * x); elseif (x <= 2e-60) tmp = Float64(t_0 * y); else tmp = Float64(Float64(x / Float64(z - y)) * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (z - y); tmp = 0.0; if (x <= -5.9e-24) tmp = t_0 * x; elseif (x <= 2e-60) tmp = t_0 * y; else tmp = (x / (z - y)) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.9e-24], N[(t$95$0 * x), $MachinePrecision], If[LessEqual[x, 2e-60], N[(t$95$0 * y), $MachinePrecision], N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{z - y}\\
\mathbf{if}\;x \leq -5.9 \cdot 10^{-24}:\\
\;\;\;\;t\_0 \cdot x\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-60}:\\
\;\;\;\;t\_0 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y} \cdot z\\
\end{array}
\end{array}
if x < -5.9000000000000002e-24Initial program 88.3%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.7
Applied rewrites49.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
*-lft-identityN/A
lift--.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
if -5.9000000000000002e-24 < x < 1.9999999999999999e-60Initial program 88.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-flip-revN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6488.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
Taylor expanded in x around 0
Applied rewrites41.2%
if 1.9999999999999999e-60 < x Initial program 88.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6446.1
Applied rewrites46.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.05e+83) (- z) (if (<= y 2.05e+14) (* (/ z (- z y)) x) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+83) {
tmp = -z;
} else if (y <= 2.05e+14) {
tmp = (z / (z - y)) * x;
} else {
tmp = -z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.05d+83)) then
tmp = -z
else if (y <= 2.05d+14) then
tmp = (z / (z - y)) * x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+83) {
tmp = -z;
} else if (y <= 2.05e+14) {
tmp = (z / (z - y)) * x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.05e+83: tmp = -z elif y <= 2.05e+14: tmp = (z / (z - y)) * x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.05e+83) tmp = Float64(-z); elseif (y <= 2.05e+14) tmp = Float64(Float64(z / Float64(z - y)) * x); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.05e+83) tmp = -z; elseif (y <= 2.05e+14) tmp = (z / (z - y)) * x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.05e+83], (-z), If[LessEqual[y, 2.05e+14], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+83}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+14}:\\
\;\;\;\;\frac{z}{z - y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -1.05000000000000001e83 or 2.05e14 < y Initial program 88.3%
Taylor expanded in y around inf
lower-*.f6433.8
Applied rewrites33.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6433.8
Applied rewrites33.8%
if -1.05000000000000001e83 < y < 2.05e14Initial program 88.3%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.7
Applied rewrites49.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
*-lft-identityN/A
lift--.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e+147) (- z) (if (<= y 1.9e+14) (/ (+ x y) 1.0) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+147) {
tmp = -z;
} else if (y <= 1.9e+14) {
tmp = (x + y) / 1.0;
} else {
tmp = -z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-3.8d+147)) then
tmp = -z
else if (y <= 1.9d+14) then
tmp = (x + y) / 1.0d0
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+147) {
tmp = -z;
} else if (y <= 1.9e+14) {
tmp = (x + y) / 1.0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+147: tmp = -z elif y <= 1.9e+14: tmp = (x + y) / 1.0 else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+147) tmp = Float64(-z); elseif (y <= 1.9e+14) tmp = Float64(Float64(x + y) / 1.0); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e+147) tmp = -z; elseif (y <= 1.9e+14) tmp = (x + y) / 1.0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+147], (-z), If[LessEqual[y, 1.9e+14], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+147}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+14}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.7999999999999997e147 or 1.9e14 < y Initial program 88.3%
Taylor expanded in y around inf
lower-*.f6433.8
Applied rewrites33.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6433.8
Applied rewrites33.8%
if -3.7999999999999997e147 < y < 1.9e14Initial program 88.3%
Taylor expanded in y around 0
Applied rewrites51.1%
(FPCore (x y z) :precision binary64 (if (<= y -4.4e-27) (- z) (if (<= y 45000000000.0) (/ x 1.0) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e-27) {
tmp = -z;
} else if (y <= 45000000000.0) {
tmp = x / 1.0;
} else {
tmp = -z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-4.4d-27)) then
tmp = -z
else if (y <= 45000000000.0d0) then
tmp = x / 1.0d0
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e-27) {
tmp = -z;
} else if (y <= 45000000000.0) {
tmp = x / 1.0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e-27: tmp = -z elif y <= 45000000000.0: tmp = x / 1.0 else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e-27) tmp = Float64(-z); elseif (y <= 45000000000.0) tmp = Float64(x / 1.0); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.4e-27) tmp = -z; elseif (y <= 45000000000.0) tmp = x / 1.0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e-27], (-z), If[LessEqual[y, 45000000000.0], N[(x / 1.0), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-27}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 45000000000:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -4.39999999999999974e-27 or 4.5e10 < y Initial program 88.3%
Taylor expanded in y around inf
lower-*.f6433.8
Applied rewrites33.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6433.8
Applied rewrites33.8%
if -4.39999999999999974e-27 < y < 4.5e10Initial program 88.3%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.7
Applied rewrites49.7%
Taylor expanded in y around 0
Applied rewrites35.1%
(FPCore (x y z) :precision binary64 (- z))
double code(double x, double y, double z) {
return -z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -z
end function
public static double code(double x, double y, double z) {
return -z;
}
def code(x, y, z): return -z
function code(x, y, z) return Float64(-z) end
function tmp = code(x, y, z) tmp = -z; end
code[x_, y_, z_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 88.3%
Taylor expanded in y around inf
lower-*.f6433.8
Applied rewrites33.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6433.8
Applied rewrites33.8%
herbie shell --seed 2025155
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
(/ (+ x y) (- 1.0 (/ y z))))