
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - 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 + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - 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 + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- t z) (- t a)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((t - z) / (t - a)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(t - z) / Float64(t - a)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(t - z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{t - z}{t - a}, y, x\right)
\end{array}
Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
(FPCore (x y z t a) :precision binary64 (fma (- z t) (/ y (- a t)) x))
double code(double x, double y, double z, double t, double a) {
return fma((z - t), (y / (a - t)), x);
}
function code(x, y, z, t, a) return fma(Float64(z - t), Float64(y / Float64(a - t)), x) end
code[x_, y_, z_, t_, a_] := N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - t, \frac{y}{a - t}, x\right)
\end{array}
Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ y (/ a (- z t))))))
(if (<= a -5e+25)
t_1
(if (<= a 3.5e-152)
(+ x (/ y (/ t (- t z))))
(if (<= a 1.35e-22) (- x (/ (* y z) (- t a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y / (a / (z - t)));
double tmp;
if (a <= -5e+25) {
tmp = t_1;
} else if (a <= 3.5e-152) {
tmp = x + (y / (t / (t - z)));
} else if (a <= 1.35e-22) {
tmp = x - ((y * z) / (t - a));
} 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 = x + (y / (a / (z - t)))
if (a <= (-5d+25)) then
tmp = t_1
else if (a <= 3.5d-152) then
tmp = x + (y / (t / (t - z)))
else if (a <= 1.35d-22) then
tmp = x - ((y * z) / (t - a))
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 = x + (y / (a / (z - t)));
double tmp;
if (a <= -5e+25) {
tmp = t_1;
} else if (a <= 3.5e-152) {
tmp = x + (y / (t / (t - z)));
} else if (a <= 1.35e-22) {
tmp = x - ((y * z) / (t - a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y / (a / (z - t))) tmp = 0 if a <= -5e+25: tmp = t_1 elif a <= 3.5e-152: tmp = x + (y / (t / (t - z))) elif a <= 1.35e-22: tmp = x - ((y * z) / (t - a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y / Float64(a / Float64(z - t)))) tmp = 0.0 if (a <= -5e+25) tmp = t_1; elseif (a <= 3.5e-152) tmp = Float64(x + Float64(y / Float64(t / Float64(t - z)))); elseif (a <= 1.35e-22) tmp = Float64(x - Float64(Float64(y * z) / Float64(t - a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y / (a / (z - t))); tmp = 0.0; if (a <= -5e+25) tmp = t_1; elseif (a <= 3.5e-152) tmp = x + (y / (t / (t - z))); elseif (a <= 1.35e-22) tmp = x - ((y * z) / (t - a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5e+25], t$95$1, If[LessEqual[a, 3.5e-152], N[(x + N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35e-22], N[(x - N[(N[(y * z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{if}\;a \leq -5 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-152}:\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-22}:\\
\;\;\;\;x - \frac{y \cdot z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.00000000000000024e25 or 1.3500000000000001e-22 < a Initial program 85.8%
lift-/.f64N/A
div-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6498.3
Applied rewrites98.3%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6498.3
Applied rewrites98.3%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6461.4
Applied rewrites61.4%
if -5.00000000000000024e25 < a < 3.5000000000000001e-152Initial program 85.8%
lift-/.f64N/A
div-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6498.3
Applied rewrites98.3%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6466.7
Applied rewrites66.7%
if 3.5000000000000001e-152 < a < 1.3500000000000001e-22Initial program 85.8%
Taylor expanded in z around inf
lower-*.f6474.3
Applied rewrites74.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6474.3
Applied rewrites74.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ y (/ a (- z t))))))
(if (<= a -5e+25)
t_1
(if (<= a 3.5e-152)
(fma (/ (- t z) t) y x)
(if (<= a 1.35e-22) (- x (/ (* y z) (- t a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y / (a / (z - t)));
double tmp;
if (a <= -5e+25) {
tmp = t_1;
} else if (a <= 3.5e-152) {
tmp = fma(((t - z) / t), y, x);
} else if (a <= 1.35e-22) {
tmp = x - ((y * z) / (t - a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y / Float64(a / Float64(z - t)))) tmp = 0.0 if (a <= -5e+25) tmp = t_1; elseif (a <= 3.5e-152) tmp = fma(Float64(Float64(t - z) / t), y, x); elseif (a <= 1.35e-22) tmp = Float64(x - Float64(Float64(y * z) / Float64(t - a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5e+25], t$95$1, If[LessEqual[a, 3.5e-152], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[a, 1.35e-22], N[(x - N[(N[(y * z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{if}\;a \leq -5 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-152}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-22}:\\
\;\;\;\;x - \frac{y \cdot z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.00000000000000024e25 or 1.3500000000000001e-22 < a Initial program 85.8%
lift-/.f64N/A
div-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6498.3
Applied rewrites98.3%
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6498.3
Applied rewrites98.3%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6461.4
Applied rewrites61.4%
if -5.00000000000000024e25 < a < 3.5000000000000001e-152Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6466.5
Applied rewrites66.5%
if 3.5000000000000001e-152 < a < 1.3500000000000001e-22Initial program 85.8%
Taylor expanded in z around inf
lower-*.f6474.3
Applied rewrites74.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6474.3
Applied rewrites74.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -5e+25) (fma (- z t) (/ y a) x) (if (<= a 1.7e-51) (fma (/ (- t z) t) y x) (fma (/ z a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5e+25) {
tmp = fma((z - t), (y / a), x);
} else if (a <= 1.7e-51) {
tmp = fma(((t - z) / t), y, x);
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5e+25) tmp = fma(Float64(z - t), Float64(y / a), x); elseif (a <= 1.7e-51) tmp = fma(Float64(Float64(t - z) / t), y, x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5e+25], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 1.7e-51], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if a < -5.00000000000000024e25Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in t around 0
Applied rewrites62.1%
if -5.00000000000000024e25 < a < 1.70000000000000001e-51Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6466.5
Applied rewrites66.5%
if 1.70000000000000001e-51 < a Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in t around 0
lower-/.f6462.8
Applied rewrites62.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z a) y x))) (if (<= a -4.9e+25) t_1 (if (<= a 1.7e-51) (fma (/ (- t z) t) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / a), y, x);
double tmp;
if (a <= -4.9e+25) {
tmp = t_1;
} else if (a <= 1.7e-51) {
tmp = fma(((t - z) / t), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / a), y, x) tmp = 0.0 if (a <= -4.9e+25) tmp = t_1; elseif (a <= 1.7e-51) tmp = fma(Float64(Float64(t - z) / t), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[a, -4.9e+25], t$95$1, If[LessEqual[a, 1.7e-51], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{if}\;a \leq -4.9 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.9000000000000001e25 or 1.70000000000000001e-51 < a Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in t around 0
lower-/.f6462.8
Applied rewrites62.8%
if -4.9000000000000001e25 < a < 1.70000000000000001e-51Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6466.5
Applied rewrites66.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.8e+63) (+ x (/ z (/ a y))) (if (<= z 1.85e+52) (fma t (/ y (- t a)) x) (fma (/ z a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.8e+63) {
tmp = x + (z / (a / y));
} else if (z <= 1.85e+52) {
tmp = fma(t, (y / (t - a)), x);
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.8e+63) tmp = Float64(x + Float64(z / Float64(a / y))); elseif (z <= 1.85e+52) tmp = fma(t, Float64(y / Float64(t - a)), x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.8e+63], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+52], N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+63}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{t - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -5.7999999999999999e63Initial program 85.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6461.3
Applied rewrites61.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6462.8
Applied rewrites62.8%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6462.9
Applied rewrites62.9%
if -5.7999999999999999e63 < z < 1.85e52Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in z around 0
Applied rewrites71.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
if 1.85e52 < z Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in t around 0
lower-/.f6462.8
Applied rewrites62.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.2e-77) (+ x y) (if (<= t 1.45e+34) (+ x (/ z (/ a y))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e-77) {
tmp = x + y;
} else if (t <= 1.45e+34) {
tmp = x + (z / (a / y));
} else {
tmp = x + y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (t <= (-9.2d-77)) then
tmp = x + y
else if (t <= 1.45d+34) then
tmp = x + (z / (a / y))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e-77) {
tmp = x + y;
} else if (t <= 1.45e+34) {
tmp = x + (z / (a / y));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9.2e-77: tmp = x + y elif t <= 1.45e+34: tmp = x + (z / (a / y)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.2e-77) tmp = Float64(x + y); elseif (t <= 1.45e+34) tmp = Float64(x + Float64(z / Float64(a / y))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9.2e-77) tmp = x + y; elseif (t <= 1.45e+34) tmp = x + (z / (a / y)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.2e-77], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.45e+34], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-77}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+34}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -9.19999999999999994e-77 or 1.4500000000000001e34 < t Initial program 85.8%
Taylor expanded in t around inf
lower-+.f6460.5
Applied rewrites60.5%
if -9.19999999999999994e-77 < t < 1.4500000000000001e34Initial program 85.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6461.3
Applied rewrites61.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6462.8
Applied rewrites62.8%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6462.9
Applied rewrites62.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.2e-77) (+ x y) (if (<= t 1.45e+34) (+ x (* z (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e-77) {
tmp = x + y;
} else if (t <= 1.45e+34) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (t <= (-9.2d-77)) then
tmp = x + y
else if (t <= 1.45d+34) then
tmp = x + (z * (y / a))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e-77) {
tmp = x + y;
} else if (t <= 1.45e+34) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9.2e-77: tmp = x + y elif t <= 1.45e+34: tmp = x + (z * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.2e-77) tmp = Float64(x + y); elseif (t <= 1.45e+34) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9.2e-77) tmp = x + y; elseif (t <= 1.45e+34) tmp = x + (z * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.2e-77], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.45e+34], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-77}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+34}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -9.19999999999999994e-77 or 1.4500000000000001e34 < t Initial program 85.8%
Taylor expanded in t around inf
lower-+.f6460.5
Applied rewrites60.5%
if -9.19999999999999994e-77 < t < 1.4500000000000001e34Initial program 85.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6461.3
Applied rewrites61.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6462.8
Applied rewrites62.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.2e-77) (+ x y) (if (<= t 1.5e+34) (fma (/ z a) y x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e-77) {
tmp = x + y;
} else if (t <= 1.5e+34) {
tmp = fma((z / a), y, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.2e-77) tmp = Float64(x + y); elseif (t <= 1.5e+34) tmp = fma(Float64(z / a), y, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.2e-77], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.5e+34], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-77}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -9.19999999999999994e-77 or 1.50000000000000009e34 < t Initial program 85.8%
Taylor expanded in t around inf
lower-+.f6460.5
Applied rewrites60.5%
if -9.19999999999999994e-77 < t < 1.50000000000000009e34Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in t around 0
lower-/.f6462.8
Applied rewrites62.8%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (* y (- z t)) (- a t)) (- INFINITY)) (fma t (/ y t) x) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((y * (z - t)) / (a - t)) <= -((double) INFINITY)) {
tmp = fma(t, (y / t), x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(y * Float64(z - t)) / Float64(a - t)) <= Float64(-Inf)) tmp = fma(t, Float64(y / t), x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(t * N[(y / t), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0Initial program 85.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in z around 0
Applied rewrites71.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
Taylor expanded in t around inf
lower-/.f6459.7
Applied rewrites59.7%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 85.8%
Taylor expanded in t around inf
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 85.8%
Taylor expanded in t around inf
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a) :precision binary64 y)
double code(double x, double y, double z, double t, double a) {
return y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 = y
end function
public static double code(double x, double y, double z, double t, double a) {
return y;
}
def code(x, y, z, t, a): return y
function code(x, y, z, t, a) return y end
function tmp = code(x, y, z, t, a) tmp = y; end
code[x_, y_, z_, t_, a_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 85.8%
Taylor expanded in t around inf
lower-+.f6460.5
Applied rewrites60.5%
Taylor expanded in x around 0
Applied rewrites18.2%
herbie shell --seed 2025156
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
(+ x (/ (* y (- z t)) (- a t))))