
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (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 - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (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 - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y x) (/ (- z t) (- a t)))))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-302) t_1 (if (<= t_2 0.0) (+ (/ (* (- z a) x) t) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - x) * ((z - t) / (a - t)));
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-302) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (((z - a) * x) / t) + y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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) :: t_2
real(8) :: tmp
t_1 = x + ((y - x) * ((z - t) / (a - t)))
t_2 = x + (((y - x) * (z - t)) / (a - t))
if (t_2 <= (-2d-302)) then
tmp = t_1
else if (t_2 <= 0.0d0) then
tmp = (((z - a) * x) / t) + y
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 - x) * ((z - t) / (a - t)));
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-302) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (((z - a) * x) / t) + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - x) * ((z - t) / (a - t))) t_2 = x + (((y - x) * (z - t)) / (a - t)) tmp = 0 if t_2 <= -2e-302: tmp = t_1 elif t_2 <= 0.0: tmp = (((z - a) * x) / t) + y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - x) * Float64(Float64(z - t) / Float64(a - t)))) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-302) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(Float64(z - a) * x) / t) + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - x) * ((z - t) / (a - t))); t_2 = x + (((y - x) * (z - t)) / (a - t)); tmp = 0.0; if (t_2 <= -2e-302) tmp = t_1; elseif (t_2 <= 0.0) tmp = (((z - a) * x) / t) + y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-302], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t} + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1.9999999999999999e-302 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.2
Applied rewrites90.2%
if -1.9999999999999999e-302 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.8%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites98.8%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.8
Applied rewrites98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-302) t_1 (if (<= t_2 0.0) (+ (/ (* (- z a) x) t) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-302) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (((z - a) * x) / t) + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-302) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(Float64(z - a) * x) / t) + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-302], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t} + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1.9999999999999999e-302 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.7%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.2
Applied rewrites90.2%
if -1.9999999999999999e-302 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.8%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites98.8%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.8
Applied rewrites98.8%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.22e+113)
(fma (- y x) (/ (- z t) a) x)
(if (<= a 6e-76)
(+ (- (/ (* (- y x) (- z a)) t)) y)
(+ x (* y (/ (- z t) (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.22e+113) {
tmp = fma((y - x), ((z - t) / a), x);
} else if (a <= 6e-76) {
tmp = -(((y - x) * (z - a)) / t) + y;
} else {
tmp = x + (y * ((z - t) / (a - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.22e+113) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); elseif (a <= 6e-76) tmp = Float64(Float64(-Float64(Float64(Float64(y - x) * Float64(z - a)) / t)) + y); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.22e+113], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 6e-76], N[((-N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]) + y), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.22 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;a \leq 6 \cdot 10^{-76}:\\
\;\;\;\;\left(-\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}\right) + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a - t}\\
\end{array}
\end{array}
if a < -1.2199999999999999e113Initial program 67.8%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6481.7
Applied rewrites81.7%
if -1.2199999999999999e113 < a < 6.00000000000000048e-76Initial program 68.4%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites67.2%
if 6.00000000000000048e-76 < a Initial program 67.6%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6488.2
Applied rewrites88.2%
Taylor expanded in x around 0
Applied rewrites73.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (+ (/ (- t z) (- a t)) 1.0) x)))
(if (<= x -5.6e+21)
t_1
(if (<= x 1.45e+80) (+ x (* y (/ (- z t) (- a t)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (((t - z) / (a - t)) + 1.0) * x;
double tmp;
if (x <= -5.6e+21) {
tmp = t_1;
} else if (x <= 1.45e+80) {
tmp = x + (y * ((z - t) / (a - 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 = (((t - z) / (a - t)) + 1.0d0) * x
if (x <= (-5.6d+21)) then
tmp = t_1
else if (x <= 1.45d+80) then
tmp = x + (y * ((z - t) / (a - 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 = (((t - z) / (a - t)) + 1.0) * x;
double tmp;
if (x <= -5.6e+21) {
tmp = t_1;
} else if (x <= 1.45e+80) {
tmp = x + (y * ((z - t) / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (((t - z) / (a - t)) + 1.0) * x tmp = 0 if x <= -5.6e+21: tmp = t_1 elif x <= 1.45e+80: tmp = x + (y * ((z - t) / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(Float64(t - z) / Float64(a - t)) + 1.0) * x) tmp = 0.0 if (x <= -5.6e+21) tmp = t_1; elseif (x <= 1.45e+80) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (((t - z) / (a - t)) + 1.0) * x; tmp = 0.0; if (x <= -5.6e+21) tmp = t_1; elseif (x <= 1.45e+80) tmp = x + (y * ((z - t) / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -5.6e+21], t$95$1, If[LessEqual[x, 1.45e+80], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{t - z}{a - t} + 1\right) \cdot x\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+80}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.6e21 or 1.44999999999999993e80 < x Initial program 55.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.4%
Taylor expanded in x around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f6460.0
Applied rewrites60.0%
if -5.6e21 < x < 1.44999999999999993e80Initial program 76.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.1
Applied rewrites90.1%
Taylor expanded in x around 0
Applied rewrites79.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.62e-52) (+ (/ (* (- z a) x) t) y) (if (<= t 2e+26) (fma (- y x) (/ (- z t) a) x) (* (/ (- z t) (- a t)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.62e-52) {
tmp = (((z - a) * x) / t) + y;
} else if (t <= 2e+26) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = ((z - t) / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.62e-52) tmp = Float64(Float64(Float64(Float64(z - a) * x) / t) + y); elseif (t <= 2e+26) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.62e-52], N[(N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 2e+26], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.62 \cdot 10^{-52}:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t} + y\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\end{array}
\end{array}
if t < -1.61999999999999995e-52Initial program 52.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.3%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.7
Applied rewrites55.7%
if -1.61999999999999995e-52 < t < 2.0000000000000001e26Initial program 89.8%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.0
Applied rewrites79.0%
if 2.0000000000000001e26 < t Initial program 43.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.2
Applied rewrites38.2%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.42e-53) (+ (/ (* (- z a) x) t) y) (if (<= t 5.4e+25) (+ x (* (- y x) (/ z a))) (* (/ (- z t) (- a t)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.42e-53) {
tmp = (((z - a) * x) / t) + y;
} else if (t <= 5.4e+25) {
tmp = x + ((y - x) * (z / a));
} else {
tmp = ((z - t) / (a - t)) * 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 <= (-1.42d-53)) then
tmp = (((z - a) * x) / t) + y
else if (t <= 5.4d+25) then
tmp = x + ((y - x) * (z / a))
else
tmp = ((z - t) / (a - t)) * 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 <= -1.42e-53) {
tmp = (((z - a) * x) / t) + y;
} else if (t <= 5.4e+25) {
tmp = x + ((y - x) * (z / a));
} else {
tmp = ((z - t) / (a - t)) * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.42e-53: tmp = (((z - a) * x) / t) + y elif t <= 5.4e+25: tmp = x + ((y - x) * (z / a)) else: tmp = ((z - t) / (a - t)) * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.42e-53) tmp = Float64(Float64(Float64(Float64(z - a) * x) / t) + y); elseif (t <= 5.4e+25) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / a))); else tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.42e-53) tmp = (((z - a) * x) / t) + y; elseif (t <= 5.4e+25) tmp = x + ((y - x) * (z / a)); else tmp = ((z - t) / (a - t)) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.42e-53], N[(N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 5.4e+25], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.42 \cdot 10^{-53}:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t} + y\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+25}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\end{array}
\end{array}
if t < -1.41999999999999992e-53Initial program 52.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.2%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.6
Applied rewrites55.6%
if -1.41999999999999992e-53 < t < 5.4e25Initial program 89.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6495.3
Applied rewrites95.3%
Taylor expanded in t around 0
lower-/.f6475.2
Applied rewrites75.2%
if 5.4e25 < t Initial program 43.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.2
Applied rewrites38.2%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.42e-53) (+ (/ (* (- z a) x) t) y) (if (<= t 5.4e+25) (fma z (/ (- y x) a) x) (* (/ (- z t) (- a t)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.42e-53) {
tmp = (((z - a) * x) / t) + y;
} else if (t <= 5.4e+25) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = ((z - t) / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.42e-53) tmp = Float64(Float64(Float64(Float64(z - a) * x) / t) + y); elseif (t <= 5.4e+25) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.42e-53], N[(N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 5.4e+25], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.42 \cdot 10^{-53}:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t} + y\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\end{array}
\end{array}
if t < -1.41999999999999992e-53Initial program 52.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.2%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.6
Applied rewrites55.6%
if -1.41999999999999992e-53 < t < 5.4e25Initial program 89.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.1
Applied rewrites73.1%
if 5.4e25 < t Initial program 43.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.2
Applied rewrites38.2%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.62e-52) (+ (/ (* z x) t) y) (if (<= t 5.4e+25) (fma z (/ (- y x) a) x) (* (/ (- z t) (- a t)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.62e-52) {
tmp = ((z * x) / t) + y;
} else if (t <= 5.4e+25) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = ((z - t) / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.62e-52) tmp = Float64(Float64(Float64(z * x) / t) + y); elseif (t <= 5.4e+25) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.62e-52], N[(N[(N[(z * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 5.4e+25], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.62 \cdot 10^{-52}:\\
\;\;\;\;\frac{z \cdot x}{t} + y\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\end{array}
\end{array}
if t < -1.61999999999999995e-52Initial program 52.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.3%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
Applied rewrites49.6%
if -1.61999999999999995e-52 < t < 5.4e25Initial program 89.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.0
Applied rewrites73.0%
if 5.4e25 < t Initial program 43.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.2
Applied rewrites38.2%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.62e-52) (+ (/ (* z x) t) y) (if (<= t 2e+26) (fma z (/ (- y x) a) x) (- (* y (/ (- z t) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.62e-52) {
tmp = ((z * x) / t) + y;
} else if (t <= 2e+26) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = -(y * ((z - t) / t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.62e-52) tmp = Float64(Float64(Float64(z * x) / t) + y); elseif (t <= 2e+26) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = Float64(-Float64(y * Float64(Float64(z - t) / t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.62e-52], N[(N[(N[(z * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 2e+26], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], (-N[(y * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.62 \cdot 10^{-52}:\\
\;\;\;\;\frac{z \cdot x}{t} + y\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;-y \cdot \frac{z - t}{t}\\
\end{array}
\end{array}
if t < -1.61999999999999995e-52Initial program 52.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.3%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around inf
Applied rewrites49.6%
if -1.61999999999999995e-52 < t < 2.0000000000000001e26Initial program 89.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.0
Applied rewrites73.0%
if 2.0000000000000001e26 < t Initial program 43.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.2
Applied rewrites38.2%
Taylor expanded in a around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6453.6
Applied rewrites53.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.35e+113) x (if (<= a 4.4e+68) (- (* y (/ (- z t) t))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 4.4e+68) {
tmp = -(y * ((z - t) / t));
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (a <= (-1.35d+113)) then
tmp = x
else if (a <= 4.4d+68) then
tmp = -(y * ((z - t) / t))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 4.4e+68) {
tmp = -(y * ((z - t) / t));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.35e+113: tmp = x elif a <= 4.4e+68: tmp = -(y * ((z - t) / t)) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.35e+113) tmp = x; elseif (a <= 4.4e+68) tmp = Float64(-Float64(y * Float64(Float64(z - t) / t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.35e+113) tmp = x; elseif (a <= 4.4e+68) tmp = -(y * ((z - t) / t)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e+113], x, If[LessEqual[a, 4.4e+68], (-N[(y * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+113}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{+68}:\\
\;\;\;\;-y \cdot \frac{z - t}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.35000000000000006e113 or 4.39999999999999974e68 < a Initial program 67.1%
Taylor expanded in a around inf
Applied rewrites49.8%
if -1.35000000000000006e113 < a < 4.39999999999999974e68Initial program 68.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in a around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6448.2
Applied rewrites48.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.35e+113) x (if (<= a 1.95e+73) (+ (/ (* z x) t) y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 1.95e+73) {
tmp = ((z * x) / t) + y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (a <= (-1.35d+113)) then
tmp = x
else if (a <= 1.95d+73) then
tmp = ((z * x) / t) + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 1.95e+73) {
tmp = ((z * x) / t) + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.35e+113: tmp = x elif a <= 1.95e+73: tmp = ((z * x) / t) + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.35e+113) tmp = x; elseif (a <= 1.95e+73) tmp = Float64(Float64(Float64(z * x) / t) + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.35e+113) tmp = x; elseif (a <= 1.95e+73) tmp = ((z * x) / t) + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e+113], x, If[LessEqual[a, 1.95e+73], N[(N[(N[(z * x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+113}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{+73}:\\
\;\;\;\;\frac{z \cdot x}{t} + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.35000000000000006e113 or 1.95e73 < a Initial program 67.1%
Taylor expanded in a around inf
Applied rewrites50.1%
if -1.35000000000000006e113 < a < 1.95e73Initial program 68.6%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.8%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6454.6
Applied rewrites54.6%
Taylor expanded in z around inf
Applied rewrites50.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- x y) t) z))) (if (<= z -10500000000000.0) t_1 (if (<= z 2.25e-85) (+ x y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / t) * z;
double tmp;
if (z <= -10500000000000.0) {
tmp = t_1;
} else if (z <= 2.25e-85) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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) / t) * z
if (z <= (-10500000000000.0d0)) then
tmp = t_1
else if (z <= 2.25d-85) then
tmp = x + y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / t) * z;
double tmp;
if (z <= -10500000000000.0) {
tmp = t_1;
} else if (z <= 2.25e-85) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((x - y) / t) * z tmp = 0 if z <= -10500000000000.0: tmp = t_1 elif z <= 2.25e-85: tmp = x + y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / t) * z) tmp = 0.0 if (z <= -10500000000000.0) tmp = t_1; elseif (z <= 2.25e-85) tmp = Float64(x + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((x - y) / t) * z; tmp = 0.0; if (z <= -10500000000000.0) tmp = t_1; elseif (z <= 2.25e-85) tmp = x + y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -10500000000000.0], t$95$1, If[LessEqual[z, 2.25e-85], N[(x + y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{t} \cdot z\\
\mathbf{if}\;z \leq -10500000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-85}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.05e13 or 2.25000000000000002e-85 < z Initial program 68.1%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites46.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6438.6
Applied rewrites38.6%
if -1.05e13 < z < 2.25000000000000002e-85Initial program 68.1%
Taylor expanded in t around inf
lift--.f6425.7
Applied rewrites25.7%
Taylor expanded in x around 0
Applied rewrites47.4%
(FPCore (x y z t a)
:precision binary64
(if (<= t -9.8e+83)
y
(if (<= t 1.12e-275)
x
(if (<= t 9.2e-83) (* y (/ z a)) (if (<= t 3e+134) (+ x y) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.8e+83) {
tmp = y;
} else if (t <= 1.12e-275) {
tmp = x;
} else if (t <= 9.2e-83) {
tmp = y * (z / a);
} else if (t <= 3e+134) {
tmp = x + y;
} else {
tmp = 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.8d+83)) then
tmp = y
else if (t <= 1.12d-275) then
tmp = x
else if (t <= 9.2d-83) then
tmp = y * (z / a)
else if (t <= 3d+134) then
tmp = x + y
else
tmp = 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.8e+83) {
tmp = y;
} else if (t <= 1.12e-275) {
tmp = x;
} else if (t <= 9.2e-83) {
tmp = y * (z / a);
} else if (t <= 3e+134) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9.8e+83: tmp = y elif t <= 1.12e-275: tmp = x elif t <= 9.2e-83: tmp = y * (z / a) elif t <= 3e+134: tmp = x + y else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.8e+83) tmp = y; elseif (t <= 1.12e-275) tmp = x; elseif (t <= 9.2e-83) tmp = Float64(y * Float64(z / a)); elseif (t <= 3e+134) tmp = Float64(x + y); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9.8e+83) tmp = y; elseif (t <= 1.12e-275) tmp = x; elseif (t <= 9.2e-83) tmp = y * (z / a); elseif (t <= 3e+134) tmp = x + y; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.8e+83], y, If[LessEqual[t, 1.12e-275], x, If[LessEqual[t, 9.2e-83], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e+134], N[(x + y), $MachinePrecision], y]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{+83}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-275}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{-83}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+134}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -9.79999999999999957e83 or 2.99999999999999997e134 < t Initial program 35.5%
Taylor expanded in t around inf
Applied rewrites51.3%
if -9.79999999999999957e83 < t < 1.11999999999999995e-275Initial program 85.6%
Taylor expanded in a around inf
Applied rewrites33.1%
if 1.11999999999999995e-275 < t < 9.19999999999999959e-83Initial program 91.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6439.6
Applied rewrites39.6%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6431.3
Applied rewrites31.3%
if 9.19999999999999959e-83 < t < 2.99999999999999997e134Initial program 74.2%
Taylor expanded in t around inf
lift--.f6418.1
Applied rewrites18.1%
Taylor expanded in x around 0
Applied rewrites34.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.35e+113) x (if (<= a 2.2e-115) y (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 2.2e-115) {
tmp = 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 (a <= (-1.35d+113)) then
tmp = x
else if (a <= 2.2d-115) then
tmp = 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 (a <= -1.35e+113) {
tmp = x;
} else if (a <= 2.2e-115) {
tmp = y;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.35e+113: tmp = x elif a <= 2.2e-115: tmp = y else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.35e+113) tmp = x; elseif (a <= 2.2e-115) tmp = y; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.35e+113) tmp = x; elseif (a <= 2.2e-115) tmp = y; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e+113], x, If[LessEqual[a, 2.2e-115], y, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+113}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.2 \cdot 10^{-115}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -1.35000000000000006e113Initial program 67.9%
Taylor expanded in a around inf
Applied rewrites50.5%
if -1.35000000000000006e113 < a < 2.1999999999999999e-115Initial program 68.6%
Taylor expanded in t around inf
Applied rewrites33.0%
if 2.1999999999999999e-115 < a Initial program 67.5%
Taylor expanded in t around inf
lift--.f6416.2
Applied rewrites16.2%
Taylor expanded in x around 0
Applied rewrites38.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.35e+113) x (if (<= a 130000000000.0) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 130000000000.0) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (a <= (-1.35d+113)) then
tmp = x
else if (a <= 130000000000.0d0) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+113) {
tmp = x;
} else if (a <= 130000000000.0) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.35e+113: tmp = x elif a <= 130000000000.0: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.35e+113) tmp = x; elseif (a <= 130000000000.0) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.35e+113) tmp = x; elseif (a <= 130000000000.0) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e+113], x, If[LessEqual[a, 130000000000.0], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+113}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 130000000000:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.35000000000000006e113 or 1.3e11 < a Initial program 67.4%
Taylor expanded in a around inf
Applied rewrites46.8%
if -1.35000000000000006e113 < a < 1.3e11Initial program 68.6%
Taylor expanded in t around inf
Applied rewrites32.5%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 68.1%
Taylor expanded in a around inf
Applied rewrites25.3%
herbie shell --seed 2025112
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y x) (- z t)) (- a t))))