
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1 (/ 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 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x + y}{1 - \frac{y}{z}}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1 (/ 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 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x + y}{1 - \frac{y}{z}}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1 (/ y z))))
(t_1 (* (/ z (- z y)) (+ y x))))
(if (<=
t_0
-6237000967295999/311850048364799970571308236412006025948039259443040240859773006630814358104525635278899682108224328295209757319405077381870693435686499009490495593482004909425000886398607136955865268975681716747289586991334988123957939133612635998263883635695006899610487641699336881506618514879741251551232)
t_1
(if (<= t_0 0) (- (* (/ x (- z y)) z) (* (/ y (- y z)) 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-275) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = ((x / (z - y)) * z) - ((y / (y - z)) * 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-275)) then
tmp = t_1
else if (t_0 <= 0.0d0) then
tmp = ((x / (z - y)) * z) - ((y / (y - z)) * 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-275) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = ((x / (z - y)) * z) - ((y / (y - z)) * 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-275: tmp = t_1 elif t_0 <= 0.0: tmp = ((x / (z - y)) * z) - ((y / (y - z)) * 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-275) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(x / Float64(z - y)) * z) - Float64(Float64(y / Float64(y - z)) * 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-275) tmp = t_1; elseif (t_0 <= 0.0) tmp = ((x / (z - y)) * z) - ((y / (y - z)) * 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 - 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, -6237000967295999/311850048364799970571308236412006025948039259443040240859773006630814358104525635278899682108224328295209757319405077381870693435686499009490495593482004909425000886398607136955865268975681716747289586991334988123957939133612635998263883635695006899610487641699336881506618514879741251551232], t$95$1, If[LessEqual[t$95$0, 0], N[(N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - N[(N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\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 \frac{-6237000967295999}{311850048364799970571308236412006025948039259443040240859773006630814358104525635278899682108224328295209757319405077381870693435686499009490495593482004909425000886398607136955865268975681716747289586991334988123957939133612635998263883635695006899610487641699336881506618514879741251551232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{x}{z - y} \cdot z - \frac{y}{y - z} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.9999999999999999e-275 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.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
lower-/.f64N/A
*-lft-identityN/A
lower--.f6489.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.2%
Applied rewrites89.2%
if -1.9999999999999999e-275 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1 (/ y z))))
(t_1 (* (/ z (- z y)) (+ y x))))
(if (<=
t_0
-6237000967295999/311850048364799970571308236412006025948039259443040240859773006630814358104525635278899682108224328295209757319405077381870693435686499009490495593482004909425000886398607136955865268975681716747289586991334988123957939133612635998263883635695006899610487641699336881506618514879741251551232)
t_1
(if (<= t_0 0) (* (/ (+ 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-275) {
tmp = t_1;
} else if (t_0 <= 0.0) {
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-275)) then
tmp = t_1
else if (t_0 <= 0.0d0) 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-275) {
tmp = t_1;
} else if (t_0 <= 0.0) {
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-275: tmp = t_1 elif t_0 <= 0.0: 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-275) tmp = t_1; elseif (t_0 <= 0.0) 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-275) tmp = t_1; elseif (t_0 <= 0.0) 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 - 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, -6237000967295999/311850048364799970571308236412006025948039259443040240859773006630814358104525635278899682108224328295209757319405077381870693435686499009490495593482004909425000886398607136955865268975681716747289586991334988123957939133612635998263883635695006899610487641699336881506618514879741251551232], t$95$1, If[LessEqual[t$95$0, 0], N[(N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\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 \frac{-6237000967295999}{311850048364799970571308236412006025948039259443040240859773006630814358104525635278899682108224328295209757319405077381870693435686499009490495593482004909425000886398607136955865268975681716747289586991334988123957939133612635998263883635695006899610487641699336881506618514879741251551232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{y + x}{z - y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.9999999999999999e-275 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.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
lower-/.f64N/A
*-lft-identityN/A
lower--.f6489.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.2%
Applied rewrites89.2%
if -1.9999999999999999e-275 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 88.6%
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.5%
Applied rewrites92.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1 (/ y z))))
(t_1 (* (/ z (- z y)) (+ y x))))
(if (<=
t_0
-3511119404027961/351111940402796075728379920075981393284761128699669252487168127261196632432619068618571244770327218791250222421623815151677323767215657465806342637967722899175327916845440400930277772658683777577056802640791026892262013051450122815378736544025053197584668966180832613749896964723593195907881555331297312768)
t_1
(if (<= t_0 0) (- 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-290) {
tmp = t_1;
} else if (t_0 <= 0.0) {
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 <= (-1d-290)) then
tmp = t_1
else if (t_0 <= 0.0d0) 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 <= -1e-290) {
tmp = t_1;
} else if (t_0 <= 0.0) {
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 <= -1e-290: tmp = t_1 elif t_0 <= 0.0: 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 <= -1e-290) tmp = t_1; elseif (t_0 <= 0.0) 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 <= -1e-290) tmp = t_1; elseif (t_0 <= 0.0) 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 - 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, -3511119404027961/351111940402796075728379920075981393284761128699669252487168127261196632432619068618571244770327218791250222421623815151677323767215657465806342637967722899175327916845440400930277772658683777577056802640791026892262013051450122815378736544025053197584668966180832613749896964723593195907881555331297312768], t$95$1, If[LessEqual[t$95$0, 0], (-z), t$95$1]]]]
\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 \frac{-3511119404027961}{351111940402796075728379920075981393284761128699669252487168127261196632432619068618571244770327218791250222421623815151677323767215657465806342637967722899175327916845440400930277772658683777577056802640791026892262013051450122815378736544025053197584668966180832613749896964723593195907881555331297312768}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.0000000000000001e-290 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.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
lower-/.f64N/A
*-lft-identityN/A
lower--.f6489.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.2%
Applied rewrites89.2%
if -1.0000000000000001e-290 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ y (- z y)) z)))
(if (<= y -194999999999999983724270038920213885242203718025216)
t_0
(if (<=
y
-2018324372703715/2124551971267068394758352826209874509318372470908127692797776552801614239443408970956650009060917142675557317944986004061386317350610828957638079915066349407775325083341572876126912512)
(* (/ z (- z y)) x)
(if (<=
y
35681192317649/2854495385411919762116571938898990272765493248)
(+ x y)
t_0)))))double code(double x, double y, double z) {
double t_0 = (y / (z - y)) * z;
double tmp;
if (y <= -1.95e+50) {
tmp = t_0;
} else if (y <= -9.5e-169) {
tmp = (z / (z - y)) * x;
} else if (y <= 1.25e-32) {
tmp = x + 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 = (y / (z - y)) * z
if (y <= (-1.95d+50)) then
tmp = t_0
else if (y <= (-9.5d-169)) then
tmp = (z / (z - y)) * x
else if (y <= 1.25d-32) then
tmp = x + y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y / (z - y)) * z;
double tmp;
if (y <= -1.95e+50) {
tmp = t_0;
} else if (y <= -9.5e-169) {
tmp = (z / (z - y)) * x;
} else if (y <= 1.25e-32) {
tmp = x + y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (y / (z - y)) * z tmp = 0 if y <= -1.95e+50: tmp = t_0 elif y <= -9.5e-169: tmp = (z / (z - y)) * x elif y <= 1.25e-32: tmp = x + y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(y / Float64(z - y)) * z) tmp = 0.0 if (y <= -1.95e+50) tmp = t_0; elseif (y <= -9.5e-169) tmp = Float64(Float64(z / Float64(z - y)) * x); elseif (y <= 1.25e-32) tmp = Float64(x + y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y / (z - y)) * z; tmp = 0.0; if (y <= -1.95e+50) tmp = t_0; elseif (y <= -9.5e-169) tmp = (z / (z - y)) * x; elseif (y <= 1.25e-32) tmp = x + y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -194999999999999983724270038920213885242203718025216], t$95$0, If[LessEqual[y, -2018324372703715/2124551971267068394758352826209874509318372470908127692797776552801614239443408970956650009060917142675557317944986004061386317350610828957638079915066349407775325083341572876126912512], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 35681192317649/2854495385411919762116571938898990272765493248], N[(x + y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{y}{z - y} \cdot z\\
\mathbf{if}\;y \leq -194999999999999983724270038920213885242203718025216:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq \frac{-2018324372703715}{2124551971267068394758352826209874509318372470908127692797776552801614239443408970956650009060917142675557317944986004061386317350610828957638079915066349407775325083341572876126912512}:\\
\;\;\;\;\frac{z}{z - y} \cdot x\\
\mathbf{elif}\;y \leq \frac{35681192317649}{2854495385411919762116571938898990272765493248}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.9499999999999998e50 or 1.2500000000000001e-32 < y Initial program 88.6%
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.5%
Applied rewrites92.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f6449.1%
Applied rewrites49.1%
if -1.9499999999999998e50 < y < -9.5000000000000001e-169Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
*-lft-identityN/A
associate-/r/N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6449.6%
Applied rewrites49.6%
if -9.5000000000000001e-169 < y < 1.2500000000000001e-32Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
lower--.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
distribute-rgt-out--51.9%
sub-flip51.9%
+-commutative51.9%
distribute-neg-frac251.9%
sub-negate-rev51.9%
lift--.f64N/A
lift--.f64N/A
div-addN/A
lift-+.f64N/A
associate-/l*N/A
associate-*l/N/A
lift--.f64N/A
lift-+.f6451.9%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flipN/A
lower-+.f6451.9%
Applied rewrites51.9%
(FPCore (x y z)
:precision binary64
(if (<= y -194999999999999983724270038920213885242203718025216)
(- z)
(if (<=
y
-2018324372703715/2124551971267068394758352826209874509318372470908127692797776552801614239443408970956650009060917142675557317944986004061386317350610828957638079915066349407775325083341572876126912512)
(* (/ z (- z y)) x)
(if (<=
y
319703483166135/11417981541647679048466287755595961091061972992)
(+ x y)
(if (<=
y
550000000000000034620484012274092293161598264847377161196670750875660543518704867470375044471607874880979271586561345253287966082623990237146785940556165572473160640990296858979914666830930817442259472152448714805578030907392)
(/ (* y z) (- z y))
(- z))))))double code(double x, double y, double z) {
double tmp;
if (y <= -1.95e+50) {
tmp = -z;
} else if (y <= -9.5e-169) {
tmp = (z / (z - y)) * x;
} else if (y <= 2.8e-32) {
tmp = x + y;
} else if (y <= 5.5e+224) {
tmp = (y * z) / (z - y);
} 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.95d+50)) then
tmp = -z
else if (y <= (-9.5d-169)) then
tmp = (z / (z - y)) * x
else if (y <= 2.8d-32) then
tmp = x + y
else if (y <= 5.5d+224) then
tmp = (y * z) / (z - y)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.95e+50) {
tmp = -z;
} else if (y <= -9.5e-169) {
tmp = (z / (z - y)) * x;
} else if (y <= 2.8e-32) {
tmp = x + y;
} else if (y <= 5.5e+224) {
tmp = (y * z) / (z - y);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.95e+50: tmp = -z elif y <= -9.5e-169: tmp = (z / (z - y)) * x elif y <= 2.8e-32: tmp = x + y elif y <= 5.5e+224: tmp = (y * z) / (z - y) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.95e+50) tmp = Float64(-z); elseif (y <= -9.5e-169) tmp = Float64(Float64(z / Float64(z - y)) * x); elseif (y <= 2.8e-32) tmp = Float64(x + y); elseif (y <= 5.5e+224) tmp = Float64(Float64(y * z) / Float64(z - y)); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.95e+50) tmp = -z; elseif (y <= -9.5e-169) tmp = (z / (z - y)) * x; elseif (y <= 2.8e-32) tmp = x + y; elseif (y <= 5.5e+224) tmp = (y * z) / (z - y); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -194999999999999983724270038920213885242203718025216], (-z), If[LessEqual[y, -2018324372703715/2124551971267068394758352826209874509318372470908127692797776552801614239443408970956650009060917142675557317944986004061386317350610828957638079915066349407775325083341572876126912512], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 319703483166135/11417981541647679048466287755595961091061972992], N[(x + y), $MachinePrecision], If[LessEqual[y, 550000000000000034620484012274092293161598264847377161196670750875660543518704867470375044471607874880979271586561345253287966082623990237146785940556165572473160640990296858979914666830930817442259472152448714805578030907392], N[(N[(y * z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], (-z)]]]]
\begin{array}{l}
\mathbf{if}\;y \leq -194999999999999983724270038920213885242203718025216:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq \frac{-2018324372703715}{2124551971267068394758352826209874509318372470908127692797776552801614239443408970956650009060917142675557317944986004061386317350610828957638079915066349407775325083341572876126912512}:\\
\;\;\;\;\frac{z}{z - y} \cdot x\\
\mathbf{elif}\;y \leq \frac{319703483166135}{11417981541647679048466287755595961091061972992}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 550000000000000034620484012274092293161598264847377161196670750875660543518704867470375044471607874880979271586561345253287966082623990237146785940556165572473160640990296858979914666830930817442259472152448714805578030907392:\\
\;\;\;\;\frac{y \cdot z}{z - y}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -1.9499999999999998e50 or 5.5000000000000003e224 < y Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
if -1.9499999999999998e50 < y < -9.5000000000000001e-169Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6449.5%
Applied rewrites49.5%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
*-lft-identityN/A
associate-/r/N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6449.6%
Applied rewrites49.6%
if -9.5000000000000001e-169 < y < 2.7999999999999999e-32Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
lower--.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
distribute-rgt-out--51.9%
sub-flip51.9%
+-commutative51.9%
distribute-neg-frac251.9%
sub-negate-rev51.9%
lift--.f64N/A
lift--.f64N/A
div-addN/A
lift-+.f64N/A
associate-/l*N/A
associate-*l/N/A
lift--.f64N/A
lift-+.f6451.9%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flipN/A
lower-+.f6451.9%
Applied rewrites51.9%
if 2.7999999999999999e-32 < y < 5.5000000000000003e224Initial program 88.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
lower-/.f64N/A
*-lft-identityN/A
lower--.f6489.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.2%
Applied rewrites89.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6439.4%
Applied rewrites39.4%
(FPCore (x y z)
:precision binary64
(if (<=
y
-8199999999999999888373114960669082384948087332005840710986759143424)
(- z)
(if (<=
y
319703483166135/11417981541647679048466287755595961091061972992)
(+ x y)
(if (<=
y
550000000000000034620484012274092293161598264847377161196670750875660543518704867470375044471607874880979271586561345253287966082623990237146785940556165572473160640990296858979914666830930817442259472152448714805578030907392)
(/ (* y z) (- z y))
(- z)))))double code(double x, double y, double z) {
double tmp;
if (y <= -8.2e+66) {
tmp = -z;
} else if (y <= 2.8e-32) {
tmp = x + y;
} else if (y <= 5.5e+224) {
tmp = (y * z) / (z - y);
} 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.2d+66)) then
tmp = -z
else if (y <= 2.8d-32) then
tmp = x + y
else if (y <= 5.5d+224) then
tmp = (y * z) / (z - y)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8.2e+66) {
tmp = -z;
} else if (y <= 2.8e-32) {
tmp = x + y;
} else if (y <= 5.5e+224) {
tmp = (y * z) / (z - y);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.2e+66: tmp = -z elif y <= 2.8e-32: tmp = x + y elif y <= 5.5e+224: tmp = (y * z) / (z - y) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.2e+66) tmp = Float64(-z); elseif (y <= 2.8e-32) tmp = Float64(x + y); elseif (y <= 5.5e+224) tmp = Float64(Float64(y * z) / Float64(z - y)); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.2e+66) tmp = -z; elseif (y <= 2.8e-32) tmp = x + y; elseif (y <= 5.5e+224) tmp = (y * z) / (z - y); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8199999999999999888373114960669082384948087332005840710986759143424], (-z), If[LessEqual[y, 319703483166135/11417981541647679048466287755595961091061972992], N[(x + y), $MachinePrecision], If[LessEqual[y, 550000000000000034620484012274092293161598264847377161196670750875660543518704867470375044471607874880979271586561345253287966082623990237146785940556165572473160640990296858979914666830930817442259472152448714805578030907392], N[(N[(y * z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], (-z)]]]
\begin{array}{l}
\mathbf{if}\;y \leq -8199999999999999888373114960669082384948087332005840710986759143424:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq \frac{319703483166135}{11417981541647679048466287755595961091061972992}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 550000000000000034620484012274092293161598264847377161196670750875660543518704867470375044471607874880979271586561345253287966082623990237146785940556165572473160640990296858979914666830930817442259472152448714805578030907392:\\
\;\;\;\;\frac{y \cdot z}{z - y}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -8.1999999999999999e66 or 5.5000000000000003e224 < y Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
if -8.1999999999999999e66 < y < 2.7999999999999999e-32Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
lower--.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
distribute-rgt-out--51.9%
sub-flip51.9%
+-commutative51.9%
distribute-neg-frac251.9%
sub-negate-rev51.9%
lift--.f64N/A
lift--.f64N/A
div-addN/A
lift-+.f64N/A
associate-/l*N/A
associate-*l/N/A
lift--.f64N/A
lift-+.f6451.9%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flipN/A
lower-+.f6451.9%
Applied rewrites51.9%
if 2.7999999999999999e-32 < y < 5.5000000000000003e224Initial program 88.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
lower-/.f64N/A
*-lft-identityN/A
lower--.f6489.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.2%
Applied rewrites89.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6439.4%
Applied rewrites39.4%
(FPCore (x y z)
:precision binary64
(if (<=
y
-8199999999999999888373114960669082384948087332005840710986759143424)
(- z)
(if (<= y 72000000000000000693102649494470656) (+ x y) (- z))))double code(double x, double y, double z) {
double tmp;
if (y <= -8.2e+66) {
tmp = -z;
} else if (y <= 7.2e+34) {
tmp = x + y;
} 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.2d+66)) then
tmp = -z
else if (y <= 7.2d+34) then
tmp = x + y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8.2e+66) {
tmp = -z;
} else if (y <= 7.2e+34) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.2e+66: tmp = -z elif y <= 7.2e+34: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.2e+66) tmp = Float64(-z); elseif (y <= 7.2e+34) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.2e+66) tmp = -z; elseif (y <= 7.2e+34) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8199999999999999888373114960669082384948087332005840710986759143424], (-z), If[LessEqual[y, 72000000000000000693102649494470656], N[(x + y), $MachinePrecision], (-z)]]
\begin{array}{l}
\mathbf{if}\;y \leq -8199999999999999888373114960669082384948087332005840710986759143424:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 72000000000000000693102649494470656:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -8.1999999999999999e66 or 7.2000000000000001e34 < y Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
if -8.1999999999999999e66 < y < 7.2000000000000001e34Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
lower--.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
distribute-rgt-out--51.9%
sub-flip51.9%
+-commutative51.9%
distribute-neg-frac251.9%
sub-negate-rev51.9%
lift--.f64N/A
lift--.f64N/A
div-addN/A
lift-+.f64N/A
associate-/l*N/A
associate-*l/N/A
lift--.f64N/A
lift-+.f6451.9%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flipN/A
lower-+.f6451.9%
Applied rewrites51.9%
(FPCore (x y z)
:precision binary64
(if (<=
z
-179999999999999991809867743164304086087427869300453890886284773824455759423616381689070858720502746283775855272893250654006708753453914860067394837843033146261504)
y
(if (<=
z
1050000000000000039771512955146801415361985593779020615116046538467559188987904)
(- z)
y)))double code(double x, double y, double z) {
double tmp;
if (z <= -1.8e+161) {
tmp = y;
} else if (z <= 1.05e+78) {
tmp = -z;
} else {
tmp = y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.8d+161)) then
tmp = y
else if (z <= 1.05d+78) then
tmp = -z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.8e+161) {
tmp = y;
} else if (z <= 1.05e+78) {
tmp = -z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.8e+161: tmp = y elif z <= 1.05e+78: tmp = -z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.8e+161) tmp = y; elseif (z <= 1.05e+78) tmp = Float64(-z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.8e+161) tmp = y; elseif (z <= 1.05e+78) tmp = -z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -179999999999999991809867743164304086087427869300453890886284773824455759423616381689070858720502746283775855272893250654006708753453914860067394837843033146261504], y, If[LessEqual[z, 1050000000000000039771512955146801415361985593779020615116046538467559188987904], (-z), y]]
\begin{array}{l}
\mathbf{if}\;z \leq -179999999999999991809867743164304086087427869300453890886284773824455759423616381689070858720502746283775855272893250654006708753453914860067394837843033146261504:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1050000000000000039771512955146801415361985593779020615116046538467559188987904:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
if z < -1.7999999999999999e161 or 1.05e78 < z Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
lower--.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
distribute-rgt-out--51.9%
sub-flip51.9%
+-commutative51.9%
distribute-neg-frac251.9%
sub-negate-rev51.9%
lift--.f64N/A
lift--.f64N/A
div-addN/A
lift-+.f64N/A
associate-/l*N/A
associate-*l/N/A
lift--.f64N/A
lift-+.f6451.9%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flipN/A
lower-+.f6451.9%
Applied rewrites51.9%
Taylor expanded in x around 0
Applied rewrites18.6%
if -1.7999999999999999e161 < z < 1.05e78Initial program 88.6%
Taylor expanded in y around inf
lower-*.f6434.7%
Applied rewrites34.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6434.7%
Applied rewrites34.7%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
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 = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
y
Initial program 88.6%
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
frac-2neg-revN/A
remove-double-negN/A
lower-*.f64N/A
Applied rewrites92.5%
Taylor expanded in z around inf
lower--.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
distribute-rgt-out--51.9%
sub-flip51.9%
+-commutative51.9%
distribute-neg-frac251.9%
sub-negate-rev51.9%
lift--.f64N/A
lift--.f64N/A
div-addN/A
lift-+.f64N/A
associate-/l*N/A
associate-*l/N/A
lift--.f64N/A
lift-+.f6451.9%
lift--.f64N/A
lift-*.f64N/A
mul-1-negN/A
add-flipN/A
lower-+.f6451.9%
Applied rewrites51.9%
Taylor expanded in x around 0
Applied rewrites18.6%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
(/ (+ x y) (- 1 (/ y z))))