
(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]
\frac{x + y}{1 - \frac{y}{z}}
Herbie found 8 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]
\frac{x + y}{1 - \frac{y}{z}}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (+ y x) (- z y)) z)))
(if (<= y -400000.0)
t_0
(if (<= y 2e+31) (/ (+ x y) (- 1.0 (/ y z))) t_0))))double code(double x, double y, double z) {
double t_0 = ((y + x) / (z - y)) * z;
double tmp;
if (y <= -400000.0) {
tmp = t_0;
} else if (y <= 2e+31) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y + x) / (z - y)) * z
if (y <= (-400000.0d0)) then
tmp = t_0
else if (y <= 2d+31) then
tmp = (x + y) / (1.0d0 - (y / z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y + x) / (z - y)) * z;
double tmp;
if (y <= -400000.0) {
tmp = t_0;
} else if (y <= 2e+31) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y + x) / (z - y)) * z tmp = 0 if y <= -400000.0: tmp = t_0 elif y <= 2e+31: tmp = (x + y) / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y + x) / Float64(z - y)) * z) tmp = 0.0 if (y <= -400000.0) tmp = t_0; elseif (y <= 2e+31) tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y + x) / (z - y)) * z; tmp = 0.0; if (y <= -400000.0) tmp = t_0; elseif (y <= 2e+31) tmp = (x + y) / (1.0 - (y / z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -400000.0], t$95$0, If[LessEqual[y, 2e+31], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{y + x}{z - y} \cdot z\\
\mathbf{if}\;y \leq -400000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+31}:\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -4e5 or 1.9999999999999999e31 < y Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.5%
Applied rewrites92.5%
if -4e5 < y < 1.9999999999999999e31Initial program 88.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (+ y x) (- z y)) z)))
(if (<= y -8000.0)
t_0
(if (<= y 2e+31) (* (/ z (- z y)) (+ y x)) t_0))))double code(double x, double y, double z) {
double t_0 = ((y + x) / (z - y)) * z;
double tmp;
if (y <= -8000.0) {
tmp = t_0;
} else if (y <= 2e+31) {
tmp = (z / (z - y)) * (y + x);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y + x) / (z - y)) * z
if (y <= (-8000.0d0)) then
tmp = t_0
else if (y <= 2d+31) then
tmp = (z / (z - y)) * (y + x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y + x) / (z - y)) * z;
double tmp;
if (y <= -8000.0) {
tmp = t_0;
} else if (y <= 2e+31) {
tmp = (z / (z - y)) * (y + x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y + x) / (z - y)) * z tmp = 0 if y <= -8000.0: tmp = t_0 elif y <= 2e+31: tmp = (z / (z - y)) * (y + x) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y + x) / Float64(z - y)) * z) tmp = 0.0 if (y <= -8000.0) tmp = t_0; elseif (y <= 2e+31) tmp = Float64(Float64(z / Float64(z - y)) * Float64(y + x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y + x) / (z - y)) * z; tmp = 0.0; if (y <= -8000.0) tmp = t_0; elseif (y <= 2e+31) tmp = (z / (z - y)) * (y + x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -8000.0], t$95$0, If[LessEqual[y, 2e+31], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{y + x}{z - y} \cdot z\\
\mathbf{if}\;y \leq -8000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+31}:\\
\;\;\;\;\frac{z}{z - y} \cdot \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -8e3 or 1.9999999999999999e31 < y Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.5%
Applied rewrites92.5%
if -8e3 < y < 1.9999999999999999e31Initial program 88.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-flip-revN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6488.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.8%
Applied rewrites88.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))
(t_1 (* (/ z (- z y)) (+ y x))))
(if (<= t_0 -2e-222) t_1 (if (<= t_0 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 <= -2e-222) {
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 <= (-2d-222)) 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 <= -2e-222) {
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 <= -2e-222: 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 <= -2e-222) 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 <= -2e-222) 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.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-222], t$95$1, If[LessEqual[t$95$0, 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 -2 \cdot 10^{-222}:\\
\;\;\;\;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))) < -2.0000000000000001e-222 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 88.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-flip-revN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6488.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.8%
Applied rewrites88.8%
if -2.0000000000000001e-222 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.5%
Applied rewrites35.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (/ z (- z y)) x))) (if (<= x -2.2e-41) t_0 (if (<= x 4.1e-7) (* (/ y (- z y)) z) t_0))))
double code(double x, double y, double z) {
double t_0 = (z / (z - y)) * x;
double tmp;
if (x <= -2.2e-41) {
tmp = t_0;
} else if (x <= 4.1e-7) {
tmp = (y / (z - y)) * z;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z / (z - y)) * x
if (x <= (-2.2d-41)) then
tmp = t_0
else if (x <= 4.1d-7) then
tmp = (y / (z - y)) * z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z / (z - y)) * x;
double tmp;
if (x <= -2.2e-41) {
tmp = t_0;
} else if (x <= 4.1e-7) {
tmp = (y / (z - y)) * z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / (z - y)) * x tmp = 0 if x <= -2.2e-41: tmp = t_0 elif x <= 4.1e-7: tmp = (y / (z - y)) * z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / Float64(z - y)) * x) tmp = 0.0 if (x <= -2.2e-41) tmp = t_0; elseif (x <= 4.1e-7) tmp = Float64(Float64(y / Float64(z - y)) * z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / (z - y)) * x; tmp = 0.0; if (x <= -2.2e-41) tmp = t_0; elseif (x <= 4.1e-7) tmp = (y / (z - y)) * z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.2e-41], t$95$0, If[LessEqual[x, 4.1e-7], N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{z}{z - y} \cdot x\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-7}:\\
\;\;\;\;\frac{y}{z - y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -2.2e-41 or 4.0999999999999999e-7 < x Initial program 88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6448.7%
Applied rewrites48.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
*-lft-identityN/A
lift--.f64N/A
*-commutativeN/A
mult-flipN/A
lift-/.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
if -2.2e-41 < x < 4.0999999999999999e-7Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6492.5%
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites49.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (- z y))) (t_1 (* t_0 x)))
(if (<= x -2.2e-41)
t_1
(if (<= x 4.1e-176) (* t_0 y) (if (<= x 2.6e-41) (+ x y) t_1)))))double code(double x, double y, double z) {
double t_0 = z / (z - y);
double t_1 = t_0 * x;
double tmp;
if (x <= -2.2e-41) {
tmp = t_1;
} else if (x <= 4.1e-176) {
tmp = t_0 * y;
} else if (x <= 2.6e-41) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z / (z - y)
t_1 = t_0 * x
if (x <= (-2.2d-41)) then
tmp = t_1
else if (x <= 4.1d-176) then
tmp = t_0 * y
else if (x <= 2.6d-41) then
tmp = x + y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (z - y);
double t_1 = t_0 * x;
double tmp;
if (x <= -2.2e-41) {
tmp = t_1;
} else if (x <= 4.1e-176) {
tmp = t_0 * y;
} else if (x <= 2.6e-41) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z / (z - y) t_1 = t_0 * x tmp = 0 if x <= -2.2e-41: tmp = t_1 elif x <= 4.1e-176: tmp = t_0 * y elif x <= 2.6e-41: tmp = x + y else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z / Float64(z - y)) t_1 = Float64(t_0 * x) tmp = 0.0 if (x <= -2.2e-41) tmp = t_1; elseif (x <= 4.1e-176) tmp = Float64(t_0 * y); elseif (x <= 2.6e-41) tmp = Float64(x + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (z - y); t_1 = t_0 * x; tmp = 0.0; if (x <= -2.2e-41) tmp = t_1; elseif (x <= 4.1e-176) tmp = t_0 * y; elseif (x <= 2.6e-41) tmp = x + y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * x), $MachinePrecision]}, If[LessEqual[x, -2.2e-41], t$95$1, If[LessEqual[x, 4.1e-176], N[(t$95$0 * y), $MachinePrecision], If[LessEqual[x, 2.6e-41], N[(x + y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \frac{z}{z - y}\\
t_1 := t\_0 \cdot x\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-176}:\\
\;\;\;\;t\_0 \cdot y\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-41}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -2.2e-41 or 2.5999999999999999e-41 < x Initial program 88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6448.7%
Applied rewrites48.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
*-lft-identityN/A
lift--.f64N/A
*-commutativeN/A
mult-flipN/A
lift-/.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
if -2.2e-41 < x < 4.1000000000000003e-176Initial program 88.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-flip-revN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6488.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.8%
Applied rewrites88.8%
Taylor expanded in x around 0
Applied rewrites42.2%
if 4.1000000000000003e-176 < x < 2.5999999999999999e-41Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6476.3%
Applied rewrites76.3%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft-inN/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in z around inf
lower-+.f6449.8%
Applied rewrites49.8%
(FPCore (x y z)
:precision binary64
(if (<= y -1.8e+96)
(- z)
(if (<= y 4.9e-57)
(* (/ z (- z y)) x)
(if (<= y 5.2e+114) (+ x y) (- z)))))double code(double x, double y, double z) {
double tmp;
if (y <= -1.8e+96) {
tmp = -z;
} else if (y <= 4.9e-57) {
tmp = (z / (z - y)) * x;
} else if (y <= 5.2e+114) {
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 <= (-1.8d+96)) then
tmp = -z
else if (y <= 4.9d-57) then
tmp = (z / (z - y)) * x
else if (y <= 5.2d+114) 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 <= -1.8e+96) {
tmp = -z;
} else if (y <= 4.9e-57) {
tmp = (z / (z - y)) * x;
} else if (y <= 5.2e+114) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.8e+96: tmp = -z elif y <= 4.9e-57: tmp = (z / (z - y)) * x elif y <= 5.2e+114: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.8e+96) tmp = Float64(-z); elseif (y <= 4.9e-57) tmp = Float64(Float64(z / Float64(z - y)) * x); elseif (y <= 5.2e+114) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.8e+96) tmp = -z; elseif (y <= 4.9e-57) tmp = (z / (z - y)) * x; elseif (y <= 5.2e+114) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.8e+96], (-z), If[LessEqual[y, 4.9e-57], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 5.2e+114], N[(x + y), $MachinePrecision], (-z)]]]
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+96}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-57}:\\
\;\;\;\;\frac{z}{z - y} \cdot x\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+114}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -1.8000000000000001e96 or 5.2000000000000001e114 < y Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.5%
Applied rewrites35.5%
if -1.8000000000000001e96 < y < 4.8999999999999999e-57Initial program 88.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-/.f6448.7%
Applied rewrites48.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
*-lft-identityN/A
lift--.f64N/A
*-commutativeN/A
mult-flipN/A
lift-/.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
if 4.8999999999999999e-57 < y < 5.2000000000000001e114Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6476.3%
Applied rewrites76.3%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft-inN/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in z around inf
lower-+.f6449.8%
Applied rewrites49.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.15e+22) (- z) (if (<= y 5.2e+114) (+ x y) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+22) {
tmp = -z;
} else if (y <= 5.2e+114) {
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 <= (-1.15d+22)) then
tmp = -z
else if (y <= 5.2d+114) 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 <= -1.15e+22) {
tmp = -z;
} else if (y <= 5.2e+114) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+22: tmp = -z elif y <= 5.2e+114: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+22) tmp = Float64(-z); elseif (y <= 5.2e+114) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e+22) tmp = -z; elseif (y <= 5.2e+114) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+22], (-z), If[LessEqual[y, 5.2e+114], N[(x + y), $MachinePrecision], (-z)]]
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+22}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+114}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -1.1500000000000001e22 or 5.2000000000000001e114 < y Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.5%
Applied rewrites35.5%
if -1.1500000000000001e22 < y < 5.2000000000000001e114Initial program 88.1%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower--.f6476.3%
Applied rewrites76.3%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft-inN/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in z around inf
lower-+.f6449.8%
Applied rewrites49.8%
(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)
-z
Initial program 88.1%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.5%
Applied rewrites35.5%
herbie shell --seed 2025258
(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))))