
(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 9 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 (/ (+ x y) (- 1.0 (/ y z))))) (if (<= t_0 -4e-304) t_0 (if (<= t_0 0.0) (/ (* (+ y x) z) (- z y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if (t_0 <= -4e-304) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = ((y + x) * z) / (z - y);
} 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 = (x + y) / (1.0d0 - (y / z))
if (t_0 <= (-4d-304)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = ((y + x) * z) / (z - y)
else
tmp = t_0
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 tmp;
if (t_0 <= -4e-304) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = ((y + x) * z) / (z - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if t_0 <= -4e-304: tmp = t_0 elif t_0 <= 0.0: tmp = ((y + x) * z) / (z - y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) tmp = 0.0 if (t_0 <= -4e-304) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(y + x) * z) / Float64(z - y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) / (1.0 - (y / z)); tmp = 0.0; if (t_0 <= -4e-304) tmp = t_0; elseif (t_0 <= 0.0) tmp = ((y + x) * z) / (z - y); else tmp = t_0; 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]}, If[LessEqual[t$95$0, -4e-304], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-304}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\left(y + x\right) \cdot z}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -3.99999999999999988e-304 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.1%
if -3.99999999999999988e-304 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6476.8
Applied rewrites76.8%
(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 -4e-304) t_1 (if (<= t_0 0.0) (/ (* (+ y x) z) (- z y)) 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 <= -4e-304) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = ((y + x) * z) / (z - y);
} 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 <= (-4d-304)) then
tmp = t_1
else if (t_0 <= 0.0d0) then
tmp = ((y + x) * z) / (z - y)
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 <= -4e-304) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = ((y + x) * z) / (z - y);
} 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 <= -4e-304: tmp = t_1 elif t_0 <= 0.0: tmp = ((y + x) * z) / (z - y) 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 <= -4e-304) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(y + x) * z) / Float64(z - y)); 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 <= -4e-304) tmp = t_1; elseif (t_0 <= 0.0) tmp = ((y + x) * z) / (z - y); 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, -4e-304], t$95$1, If[LessEqual[t$95$0, 0.0], N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $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 -4 \cdot 10^{-304}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\left(y + x\right) \cdot z}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -3.99999999999999988e-304 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.1%
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.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.8
Applied rewrites88.8%
if -3.99999999999999988e-304 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6476.8
Applied rewrites76.8%
(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 -2e-156)
t_1
(if (<= t_0 5e-296) (* (/ (+ 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 <= -2e-156) {
tmp = t_1;
} else if (t_0 <= 5e-296) {
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 <= (-2d-156)) then
tmp = t_1
else if (t_0 <= 5d-296) 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 <= -2e-156) {
tmp = t_1;
} else if (t_0 <= 5e-296) {
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 <= -2e-156: tmp = t_1 elif t_0 <= 5e-296: 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 <= -2e-156) tmp = t_1; elseif (t_0 <= 5e-296) 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 <= -2e-156) tmp = t_1; elseif (t_0 <= 5e-296) 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, -2e-156], t$95$1, If[LessEqual[t$95$0, 5e-296], 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 -2 \cdot 10^{-156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-296}:\\
\;\;\;\;\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))) < -2.00000000000000008e-156 or 5.0000000000000003e-296 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.1%
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.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.8
Applied rewrites88.8%
if -2.00000000000000008e-156 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 5.0000000000000003e-296Initial program 88.1%
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.3
Applied rewrites92.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 -2e-284) t_1 (if (<= t_0 5e-296) (- 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 <= -2e-284) {
tmp = t_1;
} else if (t_0 <= 5e-296) {
tmp = -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 <= (-2d-284)) then
tmp = t_1
else if (t_0 <= 5d-296) then
tmp = -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 <= -2e-284) {
tmp = t_1;
} else if (t_0 <= 5e-296) {
tmp = -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 <= -2e-284: tmp = t_1 elif t_0 <= 5e-296: tmp = -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 <= -2e-284) tmp = t_1; elseif (t_0 <= 5e-296) tmp = Float64(-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 <= -2e-284) tmp = t_1; elseif (t_0 <= 5e-296) tmp = -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, -2e-284], t$95$1, If[LessEqual[t$95$0, 5e-296], (-z), 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 -2 \cdot 10^{-284}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-296}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -2.00000000000000007e-284 or 5.0000000000000003e-296 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.1%
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.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.8
Applied rewrites88.8%
if -2.00000000000000007e-284 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 5.0000000000000003e-296Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.4
Applied rewrites35.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (- z y))) (t_1 (* t_0 y)))
(if (<= y -1.8e+177)
(- z)
(if (<= y -1.48e+20)
t_1
(if (<= y -9.5e-63)
(* t_0 x)
(if (<= y 1.25e+59)
(/ (+ x y) 1.0)
(if (<= y 1.35e+213) t_1 (- z))))))))
double code(double x, double y, double z) {
double t_0 = z / (z - y);
double t_1 = t_0 * y;
double tmp;
if (y <= -1.8e+177) {
tmp = -z;
} else if (y <= -1.48e+20) {
tmp = t_1;
} else if (y <= -9.5e-63) {
tmp = t_0 * x;
} else if (y <= 1.25e+59) {
tmp = (x + y) / 1.0;
} else if (y <= 1.35e+213) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z / (z - y)
t_1 = t_0 * y
if (y <= (-1.8d+177)) then
tmp = -z
else if (y <= (-1.48d+20)) then
tmp = t_1
else if (y <= (-9.5d-63)) then
tmp = t_0 * x
else if (y <= 1.25d+59) then
tmp = (x + y) / 1.0d0
else if (y <= 1.35d+213) then
tmp = t_1
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (z - y);
double t_1 = t_0 * y;
double tmp;
if (y <= -1.8e+177) {
tmp = -z;
} else if (y <= -1.48e+20) {
tmp = t_1;
} else if (y <= -9.5e-63) {
tmp = t_0 * x;
} else if (y <= 1.25e+59) {
tmp = (x + y) / 1.0;
} else if (y <= 1.35e+213) {
tmp = t_1;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = z / (z - y) t_1 = t_0 * y tmp = 0 if y <= -1.8e+177: tmp = -z elif y <= -1.48e+20: tmp = t_1 elif y <= -9.5e-63: tmp = t_0 * x elif y <= 1.25e+59: tmp = (x + y) / 1.0 elif y <= 1.35e+213: tmp = t_1 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(z / Float64(z - y)) t_1 = Float64(t_0 * y) tmp = 0.0 if (y <= -1.8e+177) tmp = Float64(-z); elseif (y <= -1.48e+20) tmp = t_1; elseif (y <= -9.5e-63) tmp = Float64(t_0 * x); elseif (y <= 1.25e+59) tmp = Float64(Float64(x + y) / 1.0); elseif (y <= 1.35e+213) tmp = t_1; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (z - y); t_1 = t_0 * y; tmp = 0.0; if (y <= -1.8e+177) tmp = -z; elseif (y <= -1.48e+20) tmp = t_1; elseif (y <= -9.5e-63) tmp = t_0 * x; elseif (y <= 1.25e+59) tmp = (x + y) / 1.0; elseif (y <= 1.35e+213) tmp = t_1; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * y), $MachinePrecision]}, If[LessEqual[y, -1.8e+177], (-z), If[LessEqual[y, -1.48e+20], t$95$1, If[LessEqual[y, -9.5e-63], N[(t$95$0 * x), $MachinePrecision], If[LessEqual[y, 1.25e+59], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[y, 1.35e+213], t$95$1, (-z)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{z - y}\\
t_1 := t\_0 \cdot y\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+177}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.48 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-63}:\\
\;\;\;\;t\_0 \cdot x\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+59}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -1.80000000000000001e177 or 1.35e213 < y Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.4
Applied rewrites35.4%
if -1.80000000000000001e177 < y < -1.48e20 or 1.2499999999999999e59 < y < 1.35e213Initial program 88.1%
Taylor expanded in x around 0
Applied rewrites42.0%
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
*-lft-identityN/A
lift--.f64N/A
lower-/.f6442.5
Applied rewrites42.5%
if -1.48e20 < y < -9.50000000000000016e-63Initial program 88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
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
*-lft-identityN/A
lift--.f64N/A
lower-/.f6448.7
Applied rewrites48.7%
if -9.50000000000000016e-63 < y < 1.2499999999999999e59Initial program 88.1%
Taylor expanded in y around 0
Applied rewrites50.2%
(FPCore (x y z)
:precision binary64
(if (<= y -2.1e+23)
(- z)
(if (<= y -9.5e-63)
(* (/ z (- z y)) x)
(if (<= y 2.15e+83) (/ (+ x y) 1.0) (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.1e+23) {
tmp = -z;
} else if (y <= -9.5e-63) {
tmp = (z / (z - y)) * x;
} else if (y <= 2.15e+83) {
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 <= (-2.1d+23)) then
tmp = -z
else if (y <= (-9.5d-63)) then
tmp = (z / (z - y)) * x
else if (y <= 2.15d+83) 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 <= -2.1e+23) {
tmp = -z;
} else if (y <= -9.5e-63) {
tmp = (z / (z - y)) * x;
} else if (y <= 2.15e+83) {
tmp = (x + y) / 1.0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.1e+23: tmp = -z elif y <= -9.5e-63: tmp = (z / (z - y)) * x elif y <= 2.15e+83: tmp = (x + y) / 1.0 else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.1e+23) tmp = Float64(-z); elseif (y <= -9.5e-63) tmp = Float64(Float64(z / Float64(z - y)) * x); elseif (y <= 2.15e+83) 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 <= -2.1e+23) tmp = -z; elseif (y <= -9.5e-63) tmp = (z / (z - y)) * x; elseif (y <= 2.15e+83) tmp = (x + y) / 1.0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.1e+23], (-z), If[LessEqual[y, -9.5e-63], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 2.15e+83], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+23}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{z}{z - y} \cdot x\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -2.1000000000000001e23 or 2.15e83 < y Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.4
Applied rewrites35.4%
if -2.1000000000000001e23 < y < -9.50000000000000016e-63Initial program 88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
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
*-lft-identityN/A
lift--.f64N/A
lower-/.f6448.7
Applied rewrites48.7%
if -9.50000000000000016e-63 < y < 2.15e83Initial program 88.1%
Taylor expanded in y around 0
Applied rewrites50.2%
(FPCore (x y z) :precision binary64 (if (<= y -8.8e+89) (- z) (if (<= y 2.15e+83) (/ (+ x y) 1.0) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.8e+89) {
tmp = -z;
} else if (y <= 2.15e+83) {
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 <= (-8.8d+89)) then
tmp = -z
else if (y <= 2.15d+83) 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 <= -8.8e+89) {
tmp = -z;
} else if (y <= 2.15e+83) {
tmp = (x + y) / 1.0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.8e+89: tmp = -z elif y <= 2.15e+83: tmp = (x + y) / 1.0 else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.8e+89) tmp = Float64(-z); elseif (y <= 2.15e+83) 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 <= -8.8e+89) tmp = -z; elseif (y <= 2.15e+83) tmp = (x + y) / 1.0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.8e+89], (-z), If[LessEqual[y, 2.15e+83], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+89}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -8.8000000000000001e89 or 2.15e83 < y Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.4
Applied rewrites35.4%
if -8.8000000000000001e89 < y < 2.15e83Initial program 88.1%
Taylor expanded in y around 0
Applied rewrites50.2%
(FPCore (x y z) :precision binary64 (if (<= y -5.2e-62) (- z) (if (<= y 6.2e+82) (* 1.0 x) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e-62) {
tmp = -z;
} else if (y <= 6.2e+82) {
tmp = 1.0 * 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 <= (-5.2d-62)) then
tmp = -z
else if (y <= 6.2d+82) then
tmp = 1.0d0 * x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e-62) {
tmp = -z;
} else if (y <= 6.2e+82) {
tmp = 1.0 * x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.2e-62: tmp = -z elif y <= 6.2e+82: tmp = 1.0 * x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.2e-62) tmp = Float64(-z); elseif (y <= 6.2e+82) tmp = Float64(1.0 * x); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.2e-62) tmp = -z; elseif (y <= 6.2e+82) tmp = 1.0 * x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.2e-62], (-z), If[LessEqual[y, 6.2e+82], N[(1.0 * x), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-62}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+82}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -5.1999999999999999e-62 or 6.20000000000000065e82 < y Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.4
Applied rewrites35.4%
if -5.1999999999999999e-62 < y < 6.20000000000000065e82Initial program 88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
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
*-lft-identityN/A
lift--.f64N/A
lower-/.f6448.7
Applied rewrites48.7%
Taylor expanded in y around 0
Applied rewrites34.4%
(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.1%
Taylor expanded in y around inf
lower-*.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.4
Applied rewrites35.4%
herbie shell --seed 2025154
(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))))