
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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 - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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 - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (/ y z) 1.0) x)))
(if (<= z -2.9e+62)
t_0
(if (<= z 2e+43) (/ (fma (- y z) x x) z) t_0))))double code(double x, double y, double z) {
double t_0 = ((y / z) - 1.0) * x;
double tmp;
if (z <= -2.9e+62) {
tmp = t_0;
} else if (z <= 2e+43) {
tmp = fma((y - z), x, x) / z;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) - 1.0) * x) tmp = 0.0 if (z <= -2.9e+62) tmp = t_0; elseif (z <= 2e+43) tmp = Float64(fma(Float64(y - z), x, x) / z); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -2.9e+62], t$95$0, If[LessEqual[z, 2e+43], N[(N[(N[(y - z), $MachinePrecision] * x + x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\frac{y}{z} - 1\right) \cdot x\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+62}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y - z, x, x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -2.8999999999999998e62 or 2e43 < z Initial program 87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lift-+.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6495.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6495.8%
Applied rewrites95.8%
Taylor expanded in y around inf
lower-/.f6472.1%
Applied rewrites72.1%
if -2.8999999999999998e62 < z < 2e43Initial program 87.9%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.0%
Applied rewrites88.0%
(FPCore (x y z) :precision binary64 (* (copysign 1.0 x) (if (<= (fabs x) 10.0) (/ (fma (- y z) (fabs x) (fabs x)) z) (* (- (/ (- y -1.0) z) 1.0) (fabs x)))))
double code(double x, double y, double z) {
double tmp;
if (fabs(x) <= 10.0) {
tmp = fma((y - z), fabs(x), fabs(x)) / z;
} else {
tmp = (((y - -1.0) / z) - 1.0) * fabs(x);
}
return copysign(1.0, x) * tmp;
}
function code(x, y, z) tmp = 0.0 if (abs(x) <= 10.0) tmp = Float64(fma(Float64(y - z), abs(x), abs(x)) / z); else tmp = Float64(Float64(Float64(Float64(y - -1.0) / z) - 1.0) * abs(x)); end return Float64(copysign(1.0, x) * tmp) end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 10.0], N[(N[(N[(y - z), $MachinePrecision] * N[Abs[x], $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(N[(y - -1.0), $MachinePrecision] / z), $MachinePrecision] - 1.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 10:\\
\;\;\;\;\frac{\mathsf{fma}\left(y - z, \left|x\right|, \left|x\right|\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -1}{z} - 1\right) \cdot \left|x\right|\\
\end{array}
if x < 10Initial program 87.9%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.0%
Applied rewrites88.0%
if 10 < x Initial program 87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lift-+.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6495.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6495.8%
Applied rewrites95.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (/ y z) 1.0) x)))
(if (<= z -4.6e-9)
t_0
(if (<= z 0.0062) (* (/ x z) (- y -1.0)) t_0))))double code(double x, double y, double z) {
double t_0 = ((y / z) - 1.0) * x;
double tmp;
if (z <= -4.6e-9) {
tmp = t_0;
} else if (z <= 0.0062) {
tmp = (x / z) * (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 = ((y / z) - 1.0d0) * x
if (z <= (-4.6d-9)) then
tmp = t_0
else if (z <= 0.0062d0) then
tmp = (x / z) * (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 = ((y / z) - 1.0) * x;
double tmp;
if (z <= -4.6e-9) {
tmp = t_0;
} else if (z <= 0.0062) {
tmp = (x / z) * (y - -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) - 1.0) * x tmp = 0 if z <= -4.6e-9: tmp = t_0 elif z <= 0.0062: tmp = (x / z) * (y - -1.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) - 1.0) * x) tmp = 0.0 if (z <= -4.6e-9) tmp = t_0; elseif (z <= 0.0062) tmp = Float64(Float64(x / z) * Float64(y - -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) - 1.0) * x; tmp = 0.0; if (z <= -4.6e-9) tmp = t_0; elseif (z <= 0.0062) tmp = (x / z) * (y - -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -4.6e-9], t$95$0, If[LessEqual[z, 0.0062], N[(N[(x / z), $MachinePrecision] * N[(y - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\frac{y}{z} - 1\right) \cdot x\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.0062:\\
\;\;\;\;\frac{x}{z} \cdot \left(y - -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -4.5999999999999998e-9 or 0.0061999999999999998 < z Initial program 87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lift-+.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6495.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6495.8%
Applied rewrites95.8%
Taylor expanded in y around inf
lower-/.f6472.1%
Applied rewrites72.1%
if -4.5999999999999998e-9 < z < 0.0061999999999999998Initial program 87.9%
Taylor expanded in z around 0
lower-+.f6461.4%
Applied rewrites61.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6461.1%
Applied rewrites61.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (/ y z) 1.0) x)))
(if (<= z -4.6e-9)
t_0
(if (<= z 0.0062) (/ (* x (+ 1.0 y)) z) t_0))))double code(double x, double y, double z) {
double t_0 = ((y / z) - 1.0) * x;
double tmp;
if (z <= -4.6e-9) {
tmp = t_0;
} else if (z <= 0.0062) {
tmp = (x * (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 / z) - 1.0d0) * x
if (z <= (-4.6d-9)) then
tmp = t_0
else if (z <= 0.0062d0) then
tmp = (x * (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 / z) - 1.0) * x;
double tmp;
if (z <= -4.6e-9) {
tmp = t_0;
} else if (z <= 0.0062) {
tmp = (x * (1.0 + y)) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) - 1.0) * x tmp = 0 if z <= -4.6e-9: tmp = t_0 elif z <= 0.0062: tmp = (x * (1.0 + y)) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) - 1.0) * x) tmp = 0.0 if (z <= -4.6e-9) tmp = t_0; elseif (z <= 0.0062) tmp = Float64(Float64(x * Float64(1.0 + y)) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) - 1.0) * x; tmp = 0.0; if (z <= -4.6e-9) tmp = t_0; elseif (z <= 0.0062) tmp = (x * (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 / z), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -4.6e-9], t$95$0, If[LessEqual[z, 0.0062], N[(N[(x * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\frac{y}{z} - 1\right) \cdot x\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.0062:\\
\;\;\;\;\frac{x \cdot \left(1 + y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -4.5999999999999998e-9 or 0.0061999999999999998 < z Initial program 87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lift-+.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6495.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6495.8%
Applied rewrites95.8%
Taylor expanded in y around inf
lower-/.f6472.1%
Applied rewrites72.1%
if -4.5999999999999998e-9 < z < 0.0061999999999999998Initial program 87.9%
Taylor expanded in z around 0
lower-+.f6461.4%
Applied rewrites61.4%
(FPCore (x y z) :precision binary64 (if (<= z -3.7e+62) (- x) (if (<= z 7.6e+42) (/ (* x (+ 1.0 y)) z) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = (x * (1.0 + y)) / z;
} else {
tmp = -x;
}
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 <= (-3.7d+62)) then
tmp = -x
else if (z <= 7.6d+42) then
tmp = (x * (1.0d0 + y)) / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = (x * (1.0 + y)) / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.7e+62: tmp = -x elif z <= 7.6e+42: tmp = (x * (1.0 + y)) / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.7e+62) tmp = Float64(-x); elseif (z <= 7.6e+42) tmp = Float64(Float64(x * Float64(1.0 + y)) / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.7e+62) tmp = -x; elseif (z <= 7.6e+42) tmp = (x * (1.0 + y)) / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.7e+62], (-x), If[LessEqual[z, 7.6e+42], N[(N[(x * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], (-x)]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{x \cdot \left(1 + y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
if z < -3.7000000000000001e62 or 7.5999999999999997e42 < z Initial program 87.9%
Taylor expanded in z around inf
lower-*.f6438.6%
Applied rewrites38.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.6%
Applied rewrites38.6%
if -3.7000000000000001e62 < z < 7.5999999999999997e42Initial program 87.9%
Taylor expanded in z around 0
lower-+.f6461.4%
Applied rewrites61.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x y) z)))
(if (<= y -9e+85)
t_0
(if (<= y 4.5e+83) (* (/ (- 1.0 z) z) x) t_0))))double code(double x, double y, double z) {
double t_0 = (x * y) / z;
double tmp;
if (y <= -9e+85) {
tmp = t_0;
} else if (y <= 4.5e+83) {
tmp = ((1.0 - z) / z) * 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 = (x * y) / z
if (y <= (-9d+85)) then
tmp = t_0
else if (y <= 4.5d+83) then
tmp = ((1.0d0 - z) / z) * x
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) / z;
double tmp;
if (y <= -9e+85) {
tmp = t_0;
} else if (y <= 4.5e+83) {
tmp = ((1.0 - z) / z) * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x * y) / z tmp = 0 if y <= -9e+85: tmp = t_0 elif y <= 4.5e+83: tmp = ((1.0 - z) / z) * x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x * y) / z) tmp = 0.0 if (y <= -9e+85) tmp = t_0; elseif (y <= 4.5e+83) tmp = Float64(Float64(Float64(1.0 - z) / z) * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * y) / z; tmp = 0.0; if (y <= -9e+85) tmp = t_0; elseif (y <= 4.5e+83) tmp = ((1.0 - z) / z) * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -9e+85], t$95$0, If[LessEqual[y, 4.5e+83], N[(N[(N[(1.0 - z), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{x \cdot y}{z}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+83}:\\
\;\;\;\;\frac{1 - z}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -9.0000000000000001e85 or 4.4999999999999999e83 < y Initial program 87.9%
Taylor expanded in y around inf
lower-*.f6438.4%
Applied rewrites38.4%
if -9.0000000000000001e85 < y < 4.4999999999999999e83Initial program 87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval95.7%
Applied rewrites95.7%
Taylor expanded in y around 0
lower--.f6465.3%
Applied rewrites65.3%
(FPCore (x y z) :precision binary64 (if (<= z -3.7e+62) (- x) (if (<= z 7.6e+42) (* (/ (- y -1.0) z) x) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = ((y - -1.0) / z) * x;
} else {
tmp = -x;
}
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 <= (-3.7d+62)) then
tmp = -x
else if (z <= 7.6d+42) then
tmp = ((y - (-1.0d0)) / z) * x
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = ((y - -1.0) / z) * x;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.7e+62: tmp = -x elif z <= 7.6e+42: tmp = ((y - -1.0) / z) * x else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.7e+62) tmp = Float64(-x); elseif (z <= 7.6e+42) tmp = Float64(Float64(Float64(y - -1.0) / z) * x); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.7e+62) tmp = -x; elseif (z <= 7.6e+42) tmp = ((y - -1.0) / z) * x; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.7e+62], (-x), If[LessEqual[z, 7.6e+42], N[(N[(N[(y - -1.0), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], (-x)]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{y - -1}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
if z < -3.7000000000000001e62 or 7.5999999999999997e42 < z Initial program 87.9%
Taylor expanded in z around inf
lower-*.f6438.6%
Applied rewrites38.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.6%
Applied rewrites38.6%
if -3.7000000000000001e62 < z < 7.5999999999999997e42Initial program 87.9%
Taylor expanded in z around 0
lower-+.f6461.4%
Applied rewrites61.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x y) z)))
(if (<= z -3.7e+62)
(- x)
(if (<= z -2e-133)
t_0
(if (<= z 1.02e-162)
(/ (* x 1.0) z)
(if (<= z 7.6e+42) t_0 (- x)))))))double code(double x, double y, double z) {
double t_0 = (x * y) / z;
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= -2e-133) {
tmp = t_0;
} else if (z <= 1.02e-162) {
tmp = (x * 1.0) / z;
} else if (z <= 7.6e+42) {
tmp = t_0;
} else {
tmp = -x;
}
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) / z
if (z <= (-3.7d+62)) then
tmp = -x
else if (z <= (-2d-133)) then
tmp = t_0
else if (z <= 1.02d-162) then
tmp = (x * 1.0d0) / z
else if (z <= 7.6d+42) then
tmp = t_0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x * y) / z;
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= -2e-133) {
tmp = t_0;
} else if (z <= 1.02e-162) {
tmp = (x * 1.0) / z;
} else if (z <= 7.6e+42) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = (x * y) / z tmp = 0 if z <= -3.7e+62: tmp = -x elif z <= -2e-133: tmp = t_0 elif z <= 1.02e-162: tmp = (x * 1.0) / z elif z <= 7.6e+42: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(Float64(x * y) / z) tmp = 0.0 if (z <= -3.7e+62) tmp = Float64(-x); elseif (z <= -2e-133) tmp = t_0; elseif (z <= 1.02e-162) tmp = Float64(Float64(x * 1.0) / z); elseif (z <= 7.6e+42) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * y) / z; tmp = 0.0; if (z <= -3.7e+62) tmp = -x; elseif (z <= -2e-133) tmp = t_0; elseif (z <= 1.02e-162) tmp = (x * 1.0) / z; elseif (z <= 7.6e+42) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -3.7e+62], (-x), If[LessEqual[z, -2e-133], t$95$0, If[LessEqual[z, 1.02e-162], N[(N[(x * 1.0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 7.6e+42], t$95$0, (-x)]]]]]
\begin{array}{l}
t_0 := \frac{x \cdot y}{z}\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-162}:\\
\;\;\;\;\frac{x \cdot 1}{z}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
if z < -3.7000000000000001e62 or 7.5999999999999997e42 < z Initial program 87.9%
Taylor expanded in z around inf
lower-*.f6438.6%
Applied rewrites38.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.6%
Applied rewrites38.6%
if -3.7000000000000001e62 < z < -2.0000000000000001e-133 or 1.02e-162 < z < 7.5999999999999997e42Initial program 87.9%
Taylor expanded in y around inf
lower-*.f6438.4%
Applied rewrites38.4%
if -2.0000000000000001e-133 < z < 1.02e-162Initial program 87.9%
Taylor expanded in z around 0
lower-+.f6461.4%
Applied rewrites61.4%
Taylor expanded in y around 0
Applied rewrites29.5%
(FPCore (x y z) :precision binary64 (if (<= z -3.7e+62) (- x) (if (<= z 7.6e+42) (/ (* x y) z) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = (x * y) / z;
} else {
tmp = -x;
}
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 <= (-3.7d+62)) then
tmp = -x
else if (z <= 7.6d+42) then
tmp = (x * y) / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = (x * y) / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.7e+62: tmp = -x elif z <= 7.6e+42: tmp = (x * y) / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.7e+62) tmp = Float64(-x); elseif (z <= 7.6e+42) tmp = Float64(Float64(x * y) / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.7e+62) tmp = -x; elseif (z <= 7.6e+42) tmp = (x * y) / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.7e+62], (-x), If[LessEqual[z, 7.6e+42], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], (-x)]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
if z < -3.7000000000000001e62 or 7.5999999999999997e42 < z Initial program 87.9%
Taylor expanded in z around inf
lower-*.f6438.6%
Applied rewrites38.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.6%
Applied rewrites38.6%
if -3.7000000000000001e62 < z < 7.5999999999999997e42Initial program 87.9%
Taylor expanded in y around inf
lower-*.f6438.4%
Applied rewrites38.4%
(FPCore (x y z) :precision binary64 (if (<= z -3.7e+62) (- x) (if (<= z 7.6e+42) (* (/ y z) x) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = (y / z) * x;
} else {
tmp = -x;
}
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 <= (-3.7d+62)) then
tmp = -x
else if (z <= 7.6d+42) then
tmp = (y / z) * x
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.7e+62) {
tmp = -x;
} else if (z <= 7.6e+42) {
tmp = (y / z) * x;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.7e+62: tmp = -x elif z <= 7.6e+42: tmp = (y / z) * x else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.7e+62) tmp = Float64(-x); elseif (z <= 7.6e+42) tmp = Float64(Float64(y / z) * x); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.7e+62) tmp = -x; elseif (z <= 7.6e+42) tmp = (y / z) * x; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.7e+62], (-x), If[LessEqual[z, 7.6e+42], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], (-x)]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
if z < -3.7000000000000001e62 or 7.5999999999999997e42 < z Initial program 87.9%
Taylor expanded in z around inf
lower-*.f6438.6%
Applied rewrites38.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.6%
Applied rewrites38.6%
if -3.7000000000000001e62 < z < 7.5999999999999997e42Initial program 87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval95.7%
Applied rewrites95.7%
Taylor expanded in y around inf
lower-/.f6436.1%
Applied rewrites36.1%
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
return -x;
}
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
end function
public static double code(double x, double y, double z) {
return -x;
}
def code(x, y, z): return -x
function code(x, y, z) return Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
-x
Initial program 87.9%
Taylor expanded in z around inf
lower-*.f6438.6%
Applied rewrites38.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.6%
Applied rewrites38.6%
herbie shell --seed 2025210
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
(/ (* x (+ (- y z) 1.0)) z))