
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - 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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - 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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- z a)) t (* (/ (- a y) (- a z)) x)))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / (z - a)), t, (((a - y) / (a - z)) * x));
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(z - a)), t, Float64(Float64(Float64(a - y) / Float64(a - z)) * x)) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + N[(N[(N[(a - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{z - a}, t, \frac{a - y}{a - z} \cdot x\right)
\end{array}
Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6482.9
lift-+.f64N/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
+-inverses91.1
Applied rewrites91.1%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate-*l/N/A
associate-*r/N/A
lift--.f64N/A
lift--.f64N/A
--rgt-identityN/A
sub-divN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
Applied rewrites96.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -1e+113)
(fma (/ (- z y) (- z a)) (- t x) x)
(if (<= t_1 5e+43)
(* (fma (- (- y 0.0) a) x (* t (- z y))) (/ 1.0 (- z a)))
(fma (/ (- x t) (- z a)) (- y z) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -1e+113) {
tmp = fma(((z - y) / (z - a)), (t - x), x);
} else if (t_1 <= 5e+43) {
tmp = fma(((y - 0.0) - a), x, (t * (z - y))) * (1.0 / (z - a));
} else {
tmp = fma(((x - t) / (z - a)), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -1e+113) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); elseif (t_1 <= 5e+43) tmp = Float64(fma(Float64(Float64(y - 0.0) - a), x, Float64(t * Float64(z - y))) * Float64(1.0 / Float64(z - a))); else tmp = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+113], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+43], N[(N[(N[(N[(y - 0.0), $MachinePrecision] - a), $MachinePrecision] * x + N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - 0\right) - a, x, t \cdot \left(z - y\right)\right) \cdot \frac{1}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1e113Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
if -1e113 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 5.0000000000000004e43Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Applied rewrites74.1%
if 5.0000000000000004e43 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6480.9
Applied rewrites80.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 t (* (/ (- a y) (- a z)) x))))
(if (<= z -7e+100)
t_1
(if (<= z 3.8e+110) (fma (/ (- z y) (- z a)) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, t, (((a - y) / (a - z)) * x));
double tmp;
if (z <= -7e+100) {
tmp = t_1;
} else if (z <= 3.8e+110) {
tmp = fma(((z - y) / (z - a)), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, t, Float64(Float64(Float64(a - y) / Float64(a - z)) * x)) tmp = 0.0 if (z <= -7e+100) tmp = t_1; elseif (z <= 3.8e+110) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * t + N[(N[(N[(a - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+100], t$95$1, If[LessEqual[z, 3.8e+110], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, t, \frac{a - y}{a - z} \cdot x\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.99999999999999953e100 or 3.79999999999999989e110 < z Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6482.9
lift-+.f64N/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
+-inverses91.1
Applied rewrites91.1%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate-*l/N/A
associate-*r/N/A
lift--.f64N/A
lift--.f64N/A
--rgt-identityN/A
sub-divN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
Applied rewrites96.3%
Taylor expanded in z around inf
Applied rewrites67.0%
if -6.99999999999999953e100 < z < 3.79999999999999989e110Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) (- z a)) (- t x) x)))
(if (<= t -2.1e-171)
t_1
(if (<= t 3.2e-134) (* -1.0 (* (/ (- a y) (- z a)) x)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / (z - a)), (t - x), x);
double tmp;
if (t <= -2.1e-171) {
tmp = t_1;
} else if (t <= 3.2e-134) {
tmp = -1.0 * (((a - y) / (z - a)) * x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x) tmp = 0.0 if (t <= -2.1e-171) tmp = t_1; elseif (t <= 3.2e-134) tmp = Float64(-1.0 * Float64(Float64(Float64(a - y) / Float64(z - a)) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.1e-171], t$95$1, If[LessEqual[t, 3.2e-134], N[(-1.0 * N[(N[(N[(a - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{if}\;t \leq -2.1 \cdot 10^{-171}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-134}:\\
\;\;\;\;-1 \cdot \left(\frac{a - y}{z - a} \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.1e-171 or 3.2000000000000001e-134 < t Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
if -2.1e-171 < t < 3.2000000000000001e-134Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6452.5
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
--rgt-identityN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
lift--.f64N/A
--rgt-identityN/A
lower--.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x t) (- z a)) (- y z) x)))
(if (<= t -2.9e-157)
t_1
(if (<= t 2.9e-55) (* -1.0 (* (/ (- a y) (- z a)) x)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - t) / (z - a)), (y - z), x);
double tmp;
if (t <= -2.9e-157) {
tmp = t_1;
} else if (t <= 2.9e-55) {
tmp = -1.0 * (((a - y) / (z - a)) * x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x) tmp = 0.0 if (t <= -2.9e-157) tmp = t_1; elseif (t <= 2.9e-55) tmp = Float64(-1.0 * Float64(Float64(Float64(a - y) / Float64(z - a)) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.9e-157], t$95$1, If[LessEqual[t, 2.9e-55], N[(-1.0 * N[(N[(N[(a - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\mathbf{if}\;t \leq -2.9 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-55}:\\
\;\;\;\;-1 \cdot \left(\frac{a - y}{z - a} \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.89999999999999988e-157 or 2.9e-55 < t Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6480.9
Applied rewrites80.9%
if -2.89999999999999988e-157 < t < 2.9e-55Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6452.5
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
--rgt-identityN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
lift--.f64N/A
--rgt-identityN/A
lower--.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.4e+35)
(fma (/ z (- z a)) (- t x) x)
(if (<= z 8.2e+114)
(+ x (/ (* y (- t x)) (- a z)))
(fma (/ (- z y) z) (- t x) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e+35) {
tmp = fma((z / (z - a)), (t - x), x);
} else if (z <= 8.2e+114) {
tmp = x + ((y * (t - x)) / (a - z));
} else {
tmp = fma(((z - y) / z), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e+35) tmp = fma(Float64(z / Float64(z - a)), Float64(t - x), x); elseif (z <= 8.2e+114) tmp = Float64(x + Float64(Float64(y * Float64(t - x)) / Float64(a - z))); else tmp = fma(Float64(Float64(z - y) / z), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e+35], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 8.2e+114], N[(x + N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+114}:\\
\;\;\;\;x + \frac{y \cdot \left(t - x\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z}, t - x, x\right)\\
\end{array}
\end{array}
if z < -3.4000000000000001e35Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in y around 0
Applied rewrites47.5%
if -3.4000000000000001e35 < z < 8.2000000000000001e114Initial program 69.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6456.6
Applied rewrites56.6%
if 8.2000000000000001e114 < z Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6438.4
Applied rewrites38.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) z) (- t x) x)))
(if (<= z -9e+39)
t_1
(if (<= z -1.3e-162)
(* (- y a) (/ x (- z a)))
(if (<= z 2.7e-95)
(fma (/ y a) (- t x) x)
(if (<= z 2.1e+115) (fma z (/ (- x t) (- a z)) x) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / z), (t - x), x);
double tmp;
if (z <= -9e+39) {
tmp = t_1;
} else if (z <= -1.3e-162) {
tmp = (y - a) * (x / (z - a));
} else if (z <= 2.7e-95) {
tmp = fma((y / a), (t - x), x);
} else if (z <= 2.1e+115) {
tmp = fma(z, ((x - t) / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / z), Float64(t - x), x) tmp = 0.0 if (z <= -9e+39) tmp = t_1; elseif (z <= -1.3e-162) tmp = Float64(Float64(y - a) * Float64(x / Float64(z - a))); elseif (z <= 2.7e-95) tmp = fma(Float64(y / a), Float64(t - x), x); elseif (z <= 2.1e+115) tmp = fma(z, Float64(Float64(x - t) / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -9e+39], t$95$1, If[LessEqual[z, -1.3e-162], N[(N[(y - a), $MachinePrecision] * N[(x / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e-95], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.1e+115], N[(z * N[(N[(x - t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z}, t - x, x\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-162}:\\
\;\;\;\;\left(y - a\right) \cdot \frac{x}{z - a}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x - t}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.99999999999999991e39 or 2.10000000000000003e115 < z Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6438.4
Applied rewrites38.4%
if -8.99999999999999991e39 < z < -1.3e-162Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
--rgt-identityN/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*l/N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
Applied rewrites47.1%
if -1.3e-162 < z < 2.7e-95Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in z around 0
lower-/.f6450.5
Applied rewrites50.5%
if 2.7e-95 < z < 2.10000000000000003e115Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in y around 0
Applied rewrites47.5%
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6447.1
Applied rewrites47.1%
(FPCore (x y z t a)
:precision binary64
(if (<= y -5.8e+93)
(* (- x t) (/ y (- z a)))
(if (<= y 4.5e+54)
(fma (/ z (- z a)) (- t x) x)
(* (/ (- x t) (- z a)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5.8e+93) {
tmp = (x - t) * (y / (z - a));
} else if (y <= 4.5e+54) {
tmp = fma((z / (z - a)), (t - x), x);
} else {
tmp = ((x - t) / (z - a)) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -5.8e+93) tmp = Float64(Float64(x - t) * Float64(y / Float64(z - a))); elseif (y <= 4.5e+54) tmp = fma(Float64(z / Float64(z - a)), Float64(t - x), x); else tmp = Float64(Float64(Float64(x - t) / Float64(z - a)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -5.8e+93], N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+54], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+93}:\\
\;\;\;\;\left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+54}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - t}{z - a} \cdot y\\
\end{array}
\end{array}
if y < -5.7999999999999997e93Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6443.2
Applied rewrites43.2%
if -5.7999999999999997e93 < y < 4.49999999999999984e54Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in y around 0
Applied rewrites47.5%
if 4.49999999999999984e54 < y Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
frac-2neg-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6441.9
Applied rewrites41.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- y a) (/ x (- z a)))))
(if (<= x -5.2e-23)
t_1
(if (<= x -2.7e-166)
(* (- x t) (/ y (- z a)))
(if (<= x 1.2e-31) (/ (* t (- y z)) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - a) * (x / (z - a));
double tmp;
if (x <= -5.2e-23) {
tmp = t_1;
} else if (x <= -2.7e-166) {
tmp = (x - t) * (y / (z - a));
} else if (x <= 1.2e-31) {
tmp = (t * (y - z)) / (a - 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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - a) * (x / (z - a))
if (x <= (-5.2d-23)) then
tmp = t_1
else if (x <= (-2.7d-166)) then
tmp = (x - t) * (y / (z - a))
else if (x <= 1.2d-31) then
tmp = (t * (y - z)) / (a - z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - a) * (x / (z - a));
double tmp;
if (x <= -5.2e-23) {
tmp = t_1;
} else if (x <= -2.7e-166) {
tmp = (x - t) * (y / (z - a));
} else if (x <= 1.2e-31) {
tmp = (t * (y - z)) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - a) * (x / (z - a)) tmp = 0 if x <= -5.2e-23: tmp = t_1 elif x <= -2.7e-166: tmp = (x - t) * (y / (z - a)) elif x <= 1.2e-31: tmp = (t * (y - z)) / (a - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - a) * Float64(x / Float64(z - a))) tmp = 0.0 if (x <= -5.2e-23) tmp = t_1; elseif (x <= -2.7e-166) tmp = Float64(Float64(x - t) * Float64(y / Float64(z - a))); elseif (x <= 1.2e-31) tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - a) * (x / (z - a)); tmp = 0.0; if (x <= -5.2e-23) tmp = t_1; elseif (x <= -2.7e-166) tmp = (x - t) * (y / (z - a)); elseif (x <= 1.2e-31) tmp = (t * (y - z)) / (a - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - a), $MachinePrecision] * N[(x / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.2e-23], t$95$1, If[LessEqual[x, -2.7e-166], N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e-31], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - a\right) \cdot \frac{x}{z - a}\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-166}:\\
\;\;\;\;\left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-31}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.2e-23 or 1.2e-31 < x Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
--rgt-identityN/A
lift--.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*l/N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
Applied rewrites47.1%
if -5.2e-23 < x < -2.70000000000000006e-166Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6443.2
Applied rewrites43.2%
if -2.70000000000000006e-166 < x < 1.2e-31Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.1
Applied rewrites39.1%
(FPCore (x y z t a)
:precision binary64
(if (<= y -5.8e+93)
(* (- x t) (/ y (- z a)))
(if (<= y 2.05e+52)
(fma z (/ (- x t) (- a z)) x)
(* (/ (- x t) (- z a)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5.8e+93) {
tmp = (x - t) * (y / (z - a));
} else if (y <= 2.05e+52) {
tmp = fma(z, ((x - t) / (a - z)), x);
} else {
tmp = ((x - t) / (z - a)) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -5.8e+93) tmp = Float64(Float64(x - t) * Float64(y / Float64(z - a))); elseif (y <= 2.05e+52) tmp = fma(z, Float64(Float64(x - t) / Float64(a - z)), x); else tmp = Float64(Float64(Float64(x - t) / Float64(z - a)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -5.8e+93], N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.05e+52], N[(z * N[(N[(x - t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+93}:\\
\;\;\;\;\left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x - t}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - t}{z - a} \cdot y\\
\end{array}
\end{array}
if y < -5.7999999999999997e93Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6443.2
Applied rewrites43.2%
if -5.7999999999999997e93 < y < 2.05e52Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in y around 0
Applied rewrites47.5%
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6447.1
Applied rewrites47.1%
if 2.05e52 < y Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
frac-2neg-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6441.9
Applied rewrites41.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.4e+33) (+ x t) (if (<= z 8e+114) (fma (/ y a) (- t x) x) (/ (* t (- y z)) (- a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+33) {
tmp = x + t;
} else if (z <= 8e+114) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = (t * (y - z)) / (a - z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e+33) tmp = Float64(x + t); elseif (z <= 8e+114) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+33], N[(x + t), $MachinePrecision], If[LessEqual[z, 8e+114], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+33}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+114}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\
\end{array}
\end{array}
if z < -4.39999999999999988e33Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
if -4.39999999999999988e33 < z < 8e114Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in z around 0
lower-/.f6450.5
Applied rewrites50.5%
if 8e114 < z Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.1
Applied rewrites39.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.4e+33) (+ x t) (if (<= z 2.2e+115) (fma (/ y a) (- t x) x) (+ x (- t x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+33) {
tmp = x + t;
} else if (z <= 2.2e+115) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = x + (t - x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e+33) tmp = Float64(x + t); elseif (z <= 2.2e+115) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = Float64(x + Float64(t - x)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+33], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.2e+115], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+33}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right)\\
\end{array}
\end{array}
if z < -4.39999999999999988e33Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
if -4.39999999999999988e33 < z < 2.2e115Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in z around 0
lower-/.f6450.5
Applied rewrites50.5%
if 2.2e115 < z Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma z (/ (- x t) a) x)))
(if (<= a -1.95e+73)
t_1
(if (<= a -7e-258)
(+ x t)
(if (<= a 9.2e-185)
(/ (* y (- x t)) z)
(if (<= a 1.06e+163) (+ x t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, ((x - t) / a), x);
double tmp;
if (a <= -1.95e+73) {
tmp = t_1;
} else if (a <= -7e-258) {
tmp = x + t;
} else if (a <= 9.2e-185) {
tmp = (y * (x - t)) / z;
} else if (a <= 1.06e+163) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(Float64(x - t) / a), x) tmp = 0.0 if (a <= -1.95e+73) tmp = t_1; elseif (a <= -7e-258) tmp = Float64(x + t); elseif (a <= 9.2e-185) tmp = Float64(Float64(y * Float64(x - t)) / z); elseif (a <= 1.06e+163) tmp = Float64(x + t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(N[(x - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.95e+73], t$95$1, If[LessEqual[a, -7e-258], N[(x + t), $MachinePrecision], If[LessEqual[a, 9.2e-185], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 1.06e+163], N[(x + t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{x - t}{a}, x\right)\\
\mathbf{if}\;a \leq -1.95 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -7 \cdot 10^{-258}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{+163}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.95e73 or 1.06e163 < a Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.1
Applied rewrites85.1%
Taylor expanded in y around 0
Applied rewrites47.5%
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f6447.1
Applied rewrites47.1%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f6433.8
Applied rewrites33.8%
if -1.95e73 < a < -7.00000000000000003e-258 or 9.2000000000000003e-185 < a < 1.06e163Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
if -7.00000000000000003e-258 < a < 9.2000000000000003e-185Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6423.6
Applied rewrites23.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -1.0 (* x -1.0))))
(if (<= a -5.8e+156)
t_1
(if (<= a -7e-258)
(+ x t)
(if (<= a 9.2e-185)
(/ (* y (- x t)) z)
(if (<= a 2.35e+147) (+ x t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (x * -1.0);
double tmp;
if (a <= -5.8e+156) {
tmp = t_1;
} else if (a <= -7e-258) {
tmp = x + t;
} else if (a <= 9.2e-185) {
tmp = (y * (x - t)) / z;
} else if (a <= 2.35e+147) {
tmp = x + t;
} 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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (-1.0d0) * (x * (-1.0d0))
if (a <= (-5.8d+156)) then
tmp = t_1
else if (a <= (-7d-258)) then
tmp = x + t
else if (a <= 9.2d-185) then
tmp = (y * (x - t)) / z
else if (a <= 2.35d+147) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (x * -1.0);
double tmp;
if (a <= -5.8e+156) {
tmp = t_1;
} else if (a <= -7e-258) {
tmp = x + t;
} else if (a <= 9.2e-185) {
tmp = (y * (x - t)) / z;
} else if (a <= 2.35e+147) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (x * -1.0) tmp = 0 if a <= -5.8e+156: tmp = t_1 elif a <= -7e-258: tmp = x + t elif a <= 9.2e-185: tmp = (y * (x - t)) / z elif a <= 2.35e+147: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(x * -1.0)) tmp = 0.0 if (a <= -5.8e+156) tmp = t_1; elseif (a <= -7e-258) tmp = Float64(x + t); elseif (a <= 9.2e-185) tmp = Float64(Float64(y * Float64(x - t)) / z); elseif (a <= 2.35e+147) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (x * -1.0); tmp = 0.0; if (a <= -5.8e+156) tmp = t_1; elseif (a <= -7e-258) tmp = x + t; elseif (a <= 9.2e-185) tmp = (y * (x - t)) / z; elseif (a <= 2.35e+147) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(x * -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5.8e+156], t$95$1, If[LessEqual[a, -7e-258], N[(x + t), $MachinePrecision], If[LessEqual[a, 9.2e-185], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 2.35e+147], N[(x + t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(x \cdot -1\right)\\
\mathbf{if}\;a \leq -5.8 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -7 \cdot 10^{-258}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\mathbf{elif}\;a \leq 2.35 \cdot 10^{+147}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.80000000000000021e156 or 2.3500000000000001e147 < a Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
Taylor expanded in a around inf
Applied rewrites26.7%
if -5.80000000000000021e156 < a < -7.00000000000000003e-258 or 9.2000000000000003e-185 < a < 2.3500000000000001e147Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
if -7.00000000000000003e-258 < a < 9.2000000000000003e-185Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6423.6
Applied rewrites23.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -6.9e+93) (/ (* x y) (- z a)) (+ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6.9e+93) {
tmp = (x * y) / (z - a);
} else {
tmp = x + t;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-6.9d+93)) then
tmp = (x * y) / (z - a)
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6.9e+93) {
tmp = (x * y) / (z - a);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -6.9e+93: tmp = (x * y) / (z - a) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -6.9e+93) tmp = Float64(Float64(x * y) / Float64(z - a)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -6.9e+93) tmp = (x * y) / (z - a); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -6.9e+93], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.9 \cdot 10^{+93}:\\
\;\;\;\;\frac{x \cdot y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if y < -6.8999999999999995e93Initial program 69.5%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.4
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6437.9
Applied rewrites37.9%
Taylor expanded in x around inf
lower-*.f6420.9
Applied rewrites20.9%
if -6.8999999999999995e93 < y Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2200000000.0) (+ x t) (if (<= z 3.2e-111) (* -1.0 (* x -1.0)) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2200000000.0) {
tmp = x + t;
} else if (z <= 3.2e-111) {
tmp = -1.0 * (x * -1.0);
} else {
tmp = x + t;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2200000000.0d0)) then
tmp = x + t
else if (z <= 3.2d-111) then
tmp = (-1.0d0) * (x * (-1.0d0))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2200000000.0) {
tmp = x + t;
} else if (z <= 3.2e-111) {
tmp = -1.0 * (x * -1.0);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2200000000.0: tmp = x + t elif z <= 3.2e-111: tmp = -1.0 * (x * -1.0) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2200000000.0) tmp = Float64(x + t); elseif (z <= 3.2e-111) tmp = Float64(-1.0 * Float64(x * -1.0)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2200000000.0) tmp = x + t; elseif (z <= 3.2e-111) tmp = -1.0 * (x * -1.0); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2200000000.0], N[(x + t), $MachinePrecision], If[LessEqual[z, 3.2e-111], N[(-1.0 * N[(x * -1.0), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2200000000:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-111}:\\
\;\;\;\;-1 \cdot \left(x \cdot -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -2.2e9 or 3.1999999999999998e-111 < z Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
if -2.2e9 < z < 3.1999999999999998e-111Initial program 69.5%
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
distribute-neg-fracN/A
sub-to-fraction-revN/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate-+l+N/A
div-addN/A
Applied rewrites76.5%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
Taylor expanded in a around inf
Applied rewrites26.7%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + t;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 69.5%
Taylor expanded in z around inf
lower--.f6418.9
Applied rewrites18.9%
Taylor expanded in x around 0
Applied rewrites34.8%
herbie shell --seed 2025143
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))