
(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 (- 1.0 (/ y z))) (t_1 (/ (+ x y) t_0)))
(if (<= t_1 -2e-258)
t_1
(if (<= t_1 0.0) (* (- (- (/ x y)) 1.0) z) (+ (/ y t_0) (/ x t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = (x + y) / t_0;
double tmp;
if (t_1 <= -2e-258) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (-(x / y) - 1.0) * z;
} else {
tmp = (y / t_0) + (x / 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (y / z)
t_1 = (x + y) / t_0
if (t_1 <= (-2d-258)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = (-(x / y) - 1.0d0) * z
else
tmp = (y / t_0) + (x / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = (x + y) / t_0;
double tmp;
if (t_1 <= -2e-258) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (-(x / y) - 1.0) * z;
} else {
tmp = (y / t_0) + (x / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = (x + y) / t_0 tmp = 0 if t_1 <= -2e-258: tmp = t_1 elif t_1 <= 0.0: tmp = (-(x / y) - 1.0) * z else: tmp = (y / t_0) + (x / t_0) return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) t_1 = Float64(Float64(x + y) / t_0) tmp = 0.0 if (t_1 <= -2e-258) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(-Float64(x / y)) - 1.0) * z); else tmp = Float64(Float64(y / t_0) + Float64(x / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); t_1 = (x + y) / t_0; tmp = 0.0; if (t_1 <= -2e-258) tmp = t_1; elseif (t_1 <= 0.0) tmp = (-(x / y) - 1.0) * z; else tmp = (y / t_0) + (x / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-258], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[((-N[(x / y), $MachinePrecision]) - 1.0), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / t$95$0), $MachinePrecision] + N[(x / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{x + y}{t\_0}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-258}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(-\frac{x}{y}\right) - 1\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t\_0} + \frac{x}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.99999999999999991e-258Initial program 87.7%
if -1.99999999999999991e-258 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 87.7%
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
div-add-revN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f6487.7
Applied rewrites87.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6448.7
Applied rewrites48.7%
if -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 87.7%
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
div-add-revN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f6487.7
Applied rewrites87.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))) (if (<= t_0 -2e-258) t_0 (if (<= t_0 0.0) (* (- (- (/ x y)) 1.0) z) t_0))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if (t_0 <= -2e-258) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (-(x / y) - 1.0) * z;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + y) / (1.0d0 - (y / z))
if (t_0 <= (-2d-258)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = (-(x / y) - 1.0d0) * z
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 <= -2e-258) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (-(x / y) - 1.0) * z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if t_0 <= -2e-258: tmp = t_0 elif t_0 <= 0.0: tmp = (-(x / y) - 1.0) * z 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 <= -2e-258) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(-Float64(x / y)) - 1.0) * z); 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 <= -2e-258) tmp = t_0; elseif (t_0 <= 0.0) tmp = (-(x / y) - 1.0) * z; 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, -2e-258], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[((-N[(x / y), $MachinePrecision]) - 1.0), $MachinePrecision] * z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-258}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(-\frac{x}{y}\right) - 1\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.99999999999999991e-258 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 87.7%
if -1.99999999999999991e-258 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 87.7%
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
div-add-revN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f6487.7
Applied rewrites87.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6448.7
Applied rewrites48.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (- (/ x y)) 1.0) z)))
(if (<= y -7.6e+27)
t_0
(if (<= y 2.6e-146)
(/ x (/ (- z y) z))
(if (<= y 7.3e+28) (/ (+ x y) 1.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = (-(x / y) - 1.0) * z;
double tmp;
if (y <= -7.6e+27) {
tmp = t_0;
} else if (y <= 2.6e-146) {
tmp = x / ((z - y) / z);
} else if (y <= 7.3e+28) {
tmp = (x + y) / 1.0;
} 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) * z
if (y <= (-7.6d+27)) then
tmp = t_0
else if (y <= 2.6d-146) then
tmp = x / ((z - y) / z)
else if (y <= 7.3d+28) then
tmp = (x + y) / 1.0d0
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) * z;
double tmp;
if (y <= -7.6e+27) {
tmp = t_0;
} else if (y <= 2.6e-146) {
tmp = x / ((z - y) / z);
} else if (y <= 7.3e+28) {
tmp = (x + y) / 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-(x / y) - 1.0) * z tmp = 0 if y <= -7.6e+27: tmp = t_0 elif y <= 2.6e-146: tmp = x / ((z - y) / z) elif y <= 7.3e+28: tmp = (x + y) / 1.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(-Float64(x / y)) - 1.0) * z) tmp = 0.0 if (y <= -7.6e+27) tmp = t_0; elseif (y <= 2.6e-146) tmp = Float64(x / Float64(Float64(z - y) / z)); elseif (y <= 7.3e+28) tmp = Float64(Float64(x + y) / 1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-(x / y) - 1.0) * z; tmp = 0.0; if (y <= -7.6e+27) tmp = t_0; elseif (y <= 2.6e-146) tmp = x / ((z - y) / z); elseif (y <= 7.3e+28) tmp = (x + y) / 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[((-N[(x / y), $MachinePrecision]) - 1.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -7.6e+27], t$95$0, If[LessEqual[y, 2.6e-146], N[(x / N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.3e+28], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(-\frac{x}{y}\right) - 1\right) \cdot z\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-146}:\\
\;\;\;\;\frac{x}{\frac{z - y}{z}}\\
\mathbf{elif}\;y \leq 7.3 \cdot 10^{+28}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7.60000000000000043e27 or 7.2999999999999998e28 < y Initial program 87.7%
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
div-add-revN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f6487.7
Applied rewrites87.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6448.7
Applied rewrites48.7%
if -7.60000000000000043e27 < y < 2.59999999999999987e-146Initial program 87.7%
Taylor expanded in x around inf
lower-/.f64N/A
lift-/.f64N/A
lift--.f6449.4
Applied rewrites49.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f6449.4
Applied rewrites49.4%
if 2.59999999999999987e-146 < y < 7.2999999999999998e28Initial program 87.7%
Taylor expanded in y around 0
Applied rewrites50.7%
(FPCore (x y z)
:precision binary64
(if (<= y -9.5e+225)
(- z)
(if (<= y -3e+32)
(/ y (- 1.0 (/ y z)))
(if (<= y 8e+121) (/ x (/ (- z y) z)) (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.5e+225) {
tmp = -z;
} else if (y <= -3e+32) {
tmp = y / (1.0 - (y / z));
} else if (y <= 8e+121) {
tmp = x / ((z - y) / z);
} 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 <= (-9.5d+225)) then
tmp = -z
else if (y <= (-3d+32)) then
tmp = y / (1.0d0 - (y / z))
else if (y <= 8d+121) then
tmp = x / ((z - y) / z)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.5e+225) {
tmp = -z;
} else if (y <= -3e+32) {
tmp = y / (1.0 - (y / z));
} else if (y <= 8e+121) {
tmp = x / ((z - y) / z);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.5e+225: tmp = -z elif y <= -3e+32: tmp = y / (1.0 - (y / z)) elif y <= 8e+121: tmp = x / ((z - y) / z) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.5e+225) tmp = Float64(-z); elseif (y <= -3e+32) tmp = Float64(y / Float64(1.0 - Float64(y / z))); elseif (y <= 8e+121) tmp = Float64(x / Float64(Float64(z - y) / z)); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.5e+225) tmp = -z; elseif (y <= -3e+32) tmp = y / (1.0 - (y / z)); elseif (y <= 8e+121) tmp = x / ((z - y) / z); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.5e+225], (-z), If[LessEqual[y, -3e+32], N[(y / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+121], N[(x / N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+225}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -3 \cdot 10^{+32}:\\
\;\;\;\;\frac{y}{1 - \frac{y}{z}}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+121}:\\
\;\;\;\;\frac{x}{\frac{z - y}{z}}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -9.49999999999999957e225 or 8.0000000000000003e121 < y Initial program 87.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
if -9.49999999999999957e225 < y < -3e32Initial program 87.7%
Taylor expanded in x around 0
Applied rewrites40.7%
if -3e32 < y < 8.0000000000000003e121Initial program 87.7%
Taylor expanded in x around inf
lower-/.f64N/A
lift-/.f64N/A
lift--.f6449.4
Applied rewrites49.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f6449.4
Applied rewrites49.4%
(FPCore (x y z) :precision binary64 (if (<= y -5e+33) (- z) (if (<= y 8e+121) (/ x (/ (- z y) z)) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+33) {
tmp = -z;
} else if (y <= 8e+121) {
tmp = x / ((z - y) / z);
} 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 <= (-5d+33)) then
tmp = -z
else if (y <= 8d+121) then
tmp = x / ((z - y) / z)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e+33) {
tmp = -z;
} else if (y <= 8e+121) {
tmp = x / ((z - y) / z);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e+33: tmp = -z elif y <= 8e+121: tmp = x / ((z - y) / z) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e+33) tmp = Float64(-z); elseif (y <= 8e+121) tmp = Float64(x / Float64(Float64(z - y) / z)); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e+33) tmp = -z; elseif (y <= 8e+121) tmp = x / ((z - y) / z); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e+33], (-z), If[LessEqual[y, 8e+121], N[(x / N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+33}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+121}:\\
\;\;\;\;\frac{x}{\frac{z - y}{z}}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -4.99999999999999973e33 or 8.0000000000000003e121 < y Initial program 87.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
if -4.99999999999999973e33 < y < 8.0000000000000003e121Initial program 87.7%
Taylor expanded in x around inf
lower-/.f64N/A
lift-/.f64N/A
lift--.f6449.4
Applied rewrites49.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f6449.4
Applied rewrites49.4%
(FPCore (x y z)
:precision binary64
(if (<= y -3.7e+28)
(- z)
(if (<= y 1.25e+29)
(/ (+ x y) 1.0)
(if (<= y 6.6e+119) (- (/ (* z x) y)) (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.7e+28) {
tmp = -z;
} else if (y <= 1.25e+29) {
tmp = (x + y) / 1.0;
} else if (y <= 6.6e+119) {
tmp = -((z * 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 <= (-3.7d+28)) then
tmp = -z
else if (y <= 1.25d+29) then
tmp = (x + y) / 1.0d0
else if (y <= 6.6d+119) then
tmp = -((z * 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 <= -3.7e+28) {
tmp = -z;
} else if (y <= 1.25e+29) {
tmp = (x + y) / 1.0;
} else if (y <= 6.6e+119) {
tmp = -((z * x) / y);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.7e+28: tmp = -z elif y <= 1.25e+29: tmp = (x + y) / 1.0 elif y <= 6.6e+119: tmp = -((z * x) / y) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.7e+28) tmp = Float64(-z); elseif (y <= 1.25e+29) tmp = Float64(Float64(x + y) / 1.0); elseif (y <= 6.6e+119) tmp = Float64(-Float64(Float64(z * x) / y)); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.7e+28) tmp = -z; elseif (y <= 1.25e+29) tmp = (x + y) / 1.0; elseif (y <= 6.6e+119) tmp = -((z * x) / y); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.7e+28], (-z), If[LessEqual[y, 1.25e+29], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[y, 6.6e+119], (-N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+28}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+29}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+119}:\\
\;\;\;\;-\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.6999999999999999e28 or 6.6000000000000004e119 < y Initial program 87.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
if -3.6999999999999999e28 < y < 1.25e29Initial program 87.7%
Taylor expanded in y around 0
Applied rewrites50.7%
if 1.25e29 < y < 6.6000000000000004e119Initial program 87.7%
Taylor expanded in x around inf
lower-/.f64N/A
lift-/.f64N/A
lift--.f6449.4
Applied rewrites49.4%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6416.8
Applied rewrites16.8%
(FPCore (x y z) :precision binary64 (if (<= y -3.7e+28) (- z) (if (<= y 2.8e+46) (/ (+ x y) 1.0) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.7e+28) {
tmp = -z;
} else if (y <= 2.8e+46) {
tmp = (x + y) / 1.0;
} else {
tmp = -z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-3.7d+28)) then
tmp = -z
else if (y <= 2.8d+46) then
tmp = (x + y) / 1.0d0
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.7e+28) {
tmp = -z;
} else if (y <= 2.8e+46) {
tmp = (x + y) / 1.0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.7e+28: tmp = -z elif y <= 2.8e+46: tmp = (x + y) / 1.0 else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.7e+28) tmp = Float64(-z); elseif (y <= 2.8e+46) tmp = Float64(Float64(x + y) / 1.0); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.7e+28) tmp = -z; elseif (y <= 2.8e+46) tmp = (x + y) / 1.0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.7e+28], (-z), If[LessEqual[y, 2.8e+46], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+28}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+46}:\\
\;\;\;\;\frac{x + y}{1}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.6999999999999999e28 or 2.80000000000000018e46 < y Initial program 87.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
if -3.6999999999999999e28 < y < 2.80000000000000018e46Initial program 87.7%
Taylor expanded in y around 0
Applied rewrites50.7%
(FPCore (x y z) :precision binary64 (if (<= z -2.65e+98) (/ y 1.0) (if (<= z 6.8e+109) (- z) (/ y 1.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e+98) {
tmp = y / 1.0;
} else if (z <= 6.8e+109) {
tmp = -z;
} else {
tmp = y / 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.65d+98)) then
tmp = y / 1.0d0
else if (z <= 6.8d+109) then
tmp = -z
else
tmp = y / 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e+98) {
tmp = y / 1.0;
} else if (z <= 6.8e+109) {
tmp = -z;
} else {
tmp = y / 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.65e+98: tmp = y / 1.0 elif z <= 6.8e+109: tmp = -z else: tmp = y / 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.65e+98) tmp = Float64(y / 1.0); elseif (z <= 6.8e+109) tmp = Float64(-z); else tmp = Float64(y / 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.65e+98) tmp = y / 1.0; elseif (z <= 6.8e+109) tmp = -z; else tmp = y / 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.65e+98], N[(y / 1.0), $MachinePrecision], If[LessEqual[z, 6.8e+109], (-z), N[(y / 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+98}:\\
\;\;\;\;\frac{y}{1}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+109}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{1}\\
\end{array}
\end{array}
if z < -2.64999999999999999e98 or 6.80000000000000013e109 < z Initial program 87.7%
Taylor expanded in x around 0
Applied rewrites40.7%
Taylor expanded in y around 0
Applied rewrites17.9%
if -2.64999999999999999e98 < z < 6.80000000000000013e109Initial program 87.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
(FPCore (x y z) :precision binary64 (- z))
double code(double x, double y, double z) {
return -z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -z
end function
public static double code(double x, double y, double z) {
return -z;
}
def code(x, y, z): return -z
function code(x, y, z) return Float64(-z) end
function tmp = code(x, y, z) tmp = -z; end
code[x_, y_, z_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 87.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
herbie shell --seed 2025142
(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))))