
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
(FPCore (x y z t a) :precision binary64 (+ x (* y (- (+ 1.0 (/ t (- a t))) (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((1.0 + (t / (a - t))) - (z / (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 * ((1.0d0 + (t / (a - t))) - (z / (a - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((1.0 + (t / (a - t))) - (z / (a - t))));
}
def code(x, y, z, t, a): return x + (y * ((1.0 + (t / (a - t))) - (z / (a - t))))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(1.0 + Float64(t / Float64(a - t))) - Float64(z / Float64(a - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((1.0 + (t / (a - t))) - (z / (a - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(1.0 + N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)
Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* (/ (- z a) t) y) x)))
(if (<= t -3.6e+159)
t_1
(if (<= t 4.8e+205) (- x (- (* (/ y (- a t)) (- z t)) y)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (((z - a) / t) * y) + x;
double tmp;
if (t <= -3.6e+159) {
tmp = t_1;
} else if (t <= 4.8e+205) {
tmp = x - (((y / (a - t)) * (z - 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) :: tmp
t_1 = (((z - a) / t) * y) + x
if (t <= (-3.6d+159)) then
tmp = t_1
else if (t <= 4.8d+205) then
tmp = x - (((y / (a - t)) * (z - 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 = (((z - a) / t) * y) + x;
double tmp;
if (t <= -3.6e+159) {
tmp = t_1;
} else if (t <= 4.8e+205) {
tmp = x - (((y / (a - t)) * (z - t)) - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (((z - a) / t) * y) + x tmp = 0 if t <= -3.6e+159: tmp = t_1 elif t <= 4.8e+205: tmp = x - (((y / (a - t)) * (z - t)) - y) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(Float64(z - a) / t) * y) + x) tmp = 0.0 if (t <= -3.6e+159) tmp = t_1; elseif (t <= 4.8e+205) tmp = Float64(x - Float64(Float64(Float64(y / Float64(a - t)) * Float64(z - t)) - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (((z - a) / t) * y) + x; tmp = 0.0; if (t <= -3.6e+159) tmp = t_1; elseif (t <= 4.8e+205) tmp = x - (((y / (a - t)) * (z - t)) - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.6e+159], t$95$1, If[LessEqual[t, 4.8e+205], N[(x - N[(N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - a}{t} \cdot y + x\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+205}:\\
\;\;\;\;x - \left(\frac{y}{a - t} \cdot \left(z - t\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -3.6000000000000004e159 or 4.7999999999999997e205 < t Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.3%
Applied rewrites59.3%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.3%
Applied rewrites59.3%
if -3.6000000000000004e159 < t < 4.7999999999999997e205Initial program 76.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6479.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6487.8%
Applied rewrites87.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* (/ (- z a) t) y) x)))
(if (<= t -1.65e+140)
t_1
(if (<= t 1e+118) (+ x (* y (- 1.0 (/ z (- a t))))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (((z - a) / t) * y) + x;
double tmp;
if (t <= -1.65e+140) {
tmp = t_1;
} else if (t <= 1e+118) {
tmp = x + (y * (1.0 - (z / (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 = (((z - a) / t) * y) + x
if (t <= (-1.65d+140)) then
tmp = t_1
else if (t <= 1d+118) then
tmp = x + (y * (1.0d0 - (z / (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 = (((z - a) / t) * y) + x;
double tmp;
if (t <= -1.65e+140) {
tmp = t_1;
} else if (t <= 1e+118) {
tmp = x + (y * (1.0 - (z / (a - t))));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (((z - a) / t) * y) + x tmp = 0 if t <= -1.65e+140: tmp = t_1 elif t <= 1e+118: tmp = x + (y * (1.0 - (z / (a - t)))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(Float64(z - a) / t) * y) + x) tmp = 0.0 if (t <= -1.65e+140) tmp = t_1; elseif (t <= 1e+118) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(z / Float64(a - t))))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (((z - a) / t) * y) + x; tmp = 0.0; if (t <= -1.65e+140) tmp = t_1; elseif (t <= 1e+118) tmp = x + (y * (1.0 - (z / (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[(z - a), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.65e+140], t$95$1, If[LessEqual[t, 1e+118], N[(x + N[(y * N[(1.0 - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - a}{t} \cdot y + x\\
\mathbf{if}\;t \leq -1.65 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 10^{+118}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{z}{a - t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.6500000000000001e140 or 9.9999999999999997e117 < t Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.3%
Applied rewrites59.3%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.3%
Applied rewrites59.3%
if -1.6500000000000001e140 < t < 9.9999999999999997e117Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -0.235)
(+ x (* y (/ z t)))
(if (<= t 6e+47)
(- (+ x y) (* (/ z a) y))
(+ (* (/ (- z a) t) y) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -0.235) {
tmp = x + (y * (z / t));
} else if (t <= 6e+47) {
tmp = (x + y) - ((z / a) * y);
} else {
tmp = (((z - a) / t) * y) + 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 (t <= (-0.235d0)) then
tmp = x + (y * (z / t))
else if (t <= 6d+47) then
tmp = (x + y) - ((z / a) * y)
else
tmp = (((z - a) / t) * y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -0.235) {
tmp = x + (y * (z / t));
} else if (t <= 6e+47) {
tmp = (x + y) - ((z / a) * y);
} else {
tmp = (((z - a) / t) * y) + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -0.235: tmp = x + (y * (z / t)) elif t <= 6e+47: tmp = (x + y) - ((z / a) * y) else: tmp = (((z - a) / t) * y) + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -0.235) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (t <= 6e+47) tmp = Float64(Float64(x + y) - Float64(Float64(z / a) * y)); else tmp = Float64(Float64(Float64(Float64(z - a) / t) * y) + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -0.235) tmp = x + (y * (z / t)); elseif (t <= 6e+47) tmp = (x + y) - ((z / a) * y); else tmp = (((z - a) / t) * y) + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -0.235], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6e+47], N[(N[(x + y), $MachinePrecision] - N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -0.235:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+47}:\\
\;\;\;\;\left(x + y\right) - \frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z - a}{t} \cdot y + x\\
\end{array}
if t < -0.23499999999999999Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around 0
lower-/.f6460.7%
Applied rewrites60.7%
if -0.23499999999999999 < t < 6.0000000000000003e47Initial program 76.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.0%
Applied rewrites65.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.0%
Applied rewrites67.0%
if 6.0000000000000003e47 < t Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.3%
Applied rewrites59.3%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.3%
Applied rewrites59.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.4e-118) (+ x y) (if (<= a 1.1e+18) (+ (* (/ (- z a) t) y) x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.4e-118) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = (((z - a) / t) * y) + x;
} 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 <= (-4.4d-118)) then
tmp = x + y
else if (a <= 1.1d+18) then
tmp = (((z - a) / t) * y) + x
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 <= -4.4e-118) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = (((z - a) / t) * y) + x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.4e-118: tmp = x + y elif a <= 1.1e+18: tmp = (((z - a) / t) * y) + x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.4e-118) tmp = Float64(x + y); elseif (a <= 1.1e+18) tmp = Float64(Float64(Float64(Float64(z - a) / t) * y) + x); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.4e-118) tmp = x + y; elseif (a <= 1.1e+18) tmp = (((z - a) / t) * y) + x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.4e-118], N[(x + y), $MachinePrecision], If[LessEqual[a, 1.1e+18], N[(N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -4.4 \cdot 10^{-118}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{z - a}{t} \cdot y + x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if a < -4.3999999999999997e-118 or 1.1e18 < a Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
if -4.3999999999999997e-118 < a < 1.1e18Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.3%
Applied rewrites59.3%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.3%
Applied rewrites59.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -3e-118) (+ x y) (if (<= a 1.1e+18) (+ x (* (- z a) (/ y t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3e-118) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = x + ((z - a) * (y / t));
} 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 <= (-3d-118)) then
tmp = x + y
else if (a <= 1.1d+18) then
tmp = x + ((z - a) * (y / t))
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 <= -3e-118) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = x + ((z - a) * (y / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3e-118: tmp = x + y elif a <= 1.1e+18: tmp = x + ((z - a) * (y / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3e-118) tmp = Float64(x + y); elseif (a <= 1.1e+18) tmp = Float64(x + Float64(Float64(z - a) * Float64(y / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3e-118) tmp = x + y; elseif (a <= 1.1e+18) tmp = x + ((z - a) * (y / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3e-118], N[(x + y), $MachinePrecision], If[LessEqual[a, 1.1e+18], N[(x + N[(N[(z - a), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -3 \cdot 10^{-118}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+18}:\\
\;\;\;\;x + \left(z - a\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if a < -3.0000000000000002e-118 or 1.1e18 < a Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
if -3.0000000000000002e-118 < a < 1.1e18Initial program 76.9%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6456.6%
Applied rewrites56.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
mul-1-negN/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6460.3%
Applied rewrites60.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.34e-117) (+ x y) (if (<= a 1.1e+18) (+ x (* y (/ z t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.34e-117) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = x + (y * (z / t));
} 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.34d-117)) then
tmp = x + y
else if (a <= 1.1d+18) then
tmp = x + (y * (z / t))
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.34e-117) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = x + (y * (z / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.34e-117: tmp = x + y elif a <= 1.1e+18: tmp = x + (y * (z / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.34e-117) tmp = Float64(x + y); elseif (a <= 1.1e+18) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.34e-117) tmp = x + y; elseif (a <= 1.1e+18) tmp = x + (y * (z / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.34e-117], N[(x + y), $MachinePrecision], If[LessEqual[a, 1.1e+18], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -1.34 \cdot 10^{-117}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+18}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if a < -1.3400000000000001e-117 or 1.1e18 < a Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
if -1.3400000000000001e-117 < a < 1.1e18Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around 0
lower-/.f6460.7%
Applied rewrites60.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.15e-117) (+ x y) (if (<= a 1.1e+18) (+ x (* z (/ y t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.15e-117) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = x + (z * (y / t));
} 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 <= (-2.15d-117)) then
tmp = x + y
else if (a <= 1.1d+18) then
tmp = x + (z * (y / t))
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 <= -2.15e-117) {
tmp = x + y;
} else if (a <= 1.1e+18) {
tmp = x + (z * (y / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.15e-117: tmp = x + y elif a <= 1.1e+18: tmp = x + (z * (y / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.15e-117) tmp = Float64(x + y); elseif (a <= 1.1e+18) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.15e-117) tmp = x + y; elseif (a <= 1.1e+18) tmp = x + (z * (y / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.15e-117], N[(x + y), $MachinePrecision], If[LessEqual[a, 1.1e+18], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.15 \cdot 10^{-117}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+18}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if a < -2.15e-117 or 1.1e18 < a Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
if -2.15e-117 < a < 1.1e18Initial program 76.9%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6456.6%
Applied rewrites56.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f6459.3%
Applied rewrites59.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6460.9%
Applied rewrites60.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -3.2e+134) (* (/ (- z a) t) y) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.2e+134) {
tmp = ((z - a) / t) * 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 (y <= (-3.2d+134)) then
tmp = ((z - a) / t) * 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 (y <= -3.2e+134) {
tmp = ((z - a) / t) * y;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.2e+134: tmp = ((z - a) / t) * y else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.2e+134) tmp = Float64(Float64(Float64(z - a) / t) * y); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.2e+134) tmp = ((z - a) / t) * y; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.2e+134], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+134}:\\
\;\;\;\;\frac{z - a}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if y < -3.2000000000000001e134Initial program 76.9%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6456.6%
Applied rewrites56.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
mul-1-negN/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.6%
Applied rewrites21.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6424.2%
Applied rewrites24.2%
if -3.2000000000000001e134 < y Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
(FPCore (x y z t a) :precision binary64 (if (<= y -3.2e+134) (* (/ y t) (- z a)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.2e+134) {
tmp = (y / t) * (z - 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 (y <= (-3.2d+134)) then
tmp = (y / t) * (z - 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 (y <= -3.2e+134) {
tmp = (y / t) * (z - a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.2e+134: tmp = (y / t) * (z - a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.2e+134) tmp = Float64(Float64(y / t) * Float64(z - a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.2e+134) tmp = (y / t) * (z - a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.2e+134], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+134}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if y < -3.2000000000000001e134Initial program 76.9%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6456.6%
Applied rewrites56.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
lower-unsound-/.f64N/A
mul-1-negN/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.6%
Applied rewrites21.6%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6423.9%
Applied rewrites23.9%
if -3.2000000000000001e134 < y Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
(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]
x + y
Initial program 76.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.6%
Applied rewrites93.6%
Taylor expanded in t around 0
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.5%
Applied rewrites80.5%
Taylor expanded in a around inf
lower-+.f6460.1%
Applied rewrites60.1%
herbie shell --seed 2025258
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
(- (+ x y) (/ (* (- z t) y) (- a t))))