
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
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 = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
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 = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
(FPCore (x y z t a) :precision binary64 (fma a 120.0 (/ (* (- x y) 60.0) (- z t))))
double code(double x, double y, double z, double t, double a) {
return fma(a, 120.0, (((x - y) * 60.0) / (z - t)));
}
function code(x, y, z, t, a) return fma(a, 120.0, Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \frac{\left(x - y\right) \cdot 60}{z - t}\right)
\end{array}
Initial program 99.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.4
Applied rewrites99.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+163)
(* (/ x (- z t)) 60.0)
(if (<= t_1 2e+110) (* 120.0 a) (* (/ (- x y) t) -60.0)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+163) {
tmp = (x / (z - t)) * 60.0;
} else if (t_1 <= 2e+110) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+163)) then
tmp = (x / (z - t)) * 60.0d0
else if (t_1 <= 2d+110) then
tmp = 120.0d0 * a
else
tmp = ((x - y) / t) * (-60.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+163) {
tmp = (x / (z - t)) * 60.0;
} else if (t_1 <= 2e+110) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -5e+163: tmp = (x / (z - t)) * 60.0 elif t_1 <= 2e+110: tmp = 120.0 * a else: tmp = ((x - y) / t) * -60.0 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+163) tmp = Float64(Float64(x / Float64(z - t)) * 60.0); elseif (t_1 <= 2e+110) tmp = Float64(120.0 * a); else tmp = Float64(Float64(Float64(x - y) / t) * -60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+163) tmp = (x / (z - t)) * 60.0; elseif (t_1 <= 2e+110) tmp = 120.0 * a; else tmp = ((x - y) / t) * -60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+163], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+110], N[(120.0 * a), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+163}:\\
\;\;\;\;\frac{x}{z - t} \cdot 60\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+110}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5e163Initial program 95.5%
Taylor expanded in x around inf
Applied rewrites66.4%
if -5e163 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e110Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites68.4%
if 2e110 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.6%
Taylor expanded in z around 0
Applied rewrites60.7%
Taylor expanded in t around 0
Applied rewrites60.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -5e+163) (not (<= t_1 5e+187)))
(* (/ x t) -60.0)
(* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -5e+163) || !(t_1 <= 5e+187)) {
tmp = (x / t) * -60.0;
} else {
tmp = 120.0 * a;
}
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 = (60.0d0 * (x - y)) / (z - t)
if ((t_1 <= (-5d+163)) .or. (.not. (t_1 <= 5d+187))) then
tmp = (x / t) * (-60.0d0)
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -5e+163) || !(t_1 <= 5e+187)) {
tmp = (x / t) * -60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if (t_1 <= -5e+163) or not (t_1 <= 5e+187): tmp = (x / t) * -60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if ((t_1 <= -5e+163) || !(t_1 <= 5e+187)) tmp = Float64(Float64(x / t) * -60.0); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if ((t_1 <= -5e+163) || ~((t_1 <= 5e+187))) tmp = (x / t) * -60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+163], N[Not[LessEqual[t$95$1, 5e+187]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+163} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+187}\right):\\
\;\;\;\;\frac{x}{t} \cdot -60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5e163 or 5.0000000000000001e187 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.6%
Taylor expanded in z around 0
Applied rewrites64.8%
Taylor expanded in x around inf
Applied rewrites33.9%
if -5e163 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000001e187Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites65.6%
Final simplification59.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+163)
(* (/ x t) -60.0)
(if (<= t_1 5e+240) (* 120.0 a) (* (/ y t) 60.0)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+163) {
tmp = (x / t) * -60.0;
} else if (t_1 <= 5e+240) {
tmp = 120.0 * a;
} else {
tmp = (y / t) * 60.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+163)) then
tmp = (x / t) * (-60.0d0)
else if (t_1 <= 5d+240) then
tmp = 120.0d0 * a
else
tmp = (y / t) * 60.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+163) {
tmp = (x / t) * -60.0;
} else if (t_1 <= 5e+240) {
tmp = 120.0 * a;
} else {
tmp = (y / t) * 60.0;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -5e+163: tmp = (x / t) * -60.0 elif t_1 <= 5e+240: tmp = 120.0 * a else: tmp = (y / t) * 60.0 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+163) tmp = Float64(Float64(x / t) * -60.0); elseif (t_1 <= 5e+240) tmp = Float64(120.0 * a); else tmp = Float64(Float64(y / t) * 60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+163) tmp = (x / t) * -60.0; elseif (t_1 <= 5e+240) tmp = 120.0 * a; else tmp = (y / t) * 60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+163], N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+240], N[(120.0 * a), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+163}:\\
\;\;\;\;\frac{x}{t} \cdot -60\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5e163Initial program 95.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Taylor expanded in x around inf
Applied rewrites36.7%
if -5e163 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000003e240Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites64.3%
if 5.0000000000000003e240 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites77.6%
Taylor expanded in y around inf
Applied rewrites56.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x y) z) 60.0)))
(if (<= z -185000.0)
(+ t_1 (* a 120.0))
(if (<= z -9.3e-175)
(fma a 120.0 (/ (* x 60.0) (- z t)))
(if (<= z 7.9e+21)
(fma (/ (- x y) t) -60.0 (* 120.0 a))
(fma a 120.0 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / z) * 60.0;
double tmp;
if (z <= -185000.0) {
tmp = t_1 + (a * 120.0);
} else if (z <= -9.3e-175) {
tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
} else if (z <= 7.9e+21) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, t_1);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / z) * 60.0) tmp = 0.0 if (z <= -185000.0) tmp = Float64(t_1 + Float64(a * 120.0)); elseif (z <= -9.3e-175) tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t))); elseif (z <= 7.9e+21) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, t_1); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision]}, If[LessEqual[z, -185000.0], N[(t$95$1 + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.3e-175], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.9e+21], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z} \cdot 60\\
\mathbf{if}\;z \leq -185000:\\
\;\;\;\;t\_1 + a \cdot 120\\
\mathbf{elif}\;z \leq -9.3 \cdot 10^{-175}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
\mathbf{elif}\;z \leq 7.9 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, t\_1\right)\\
\end{array}
\end{array}
if z < -185000Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites90.3%
if -185000 < z < -9.300000000000001e-175Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites91.3%
if -9.300000000000001e-175 < z < 7.9e21Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites91.1%
if 7.9e21 < z Initial program 98.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6498.6
Applied rewrites98.6%
Taylor expanded in z around inf
Applied rewrites93.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x y) z)))
(if (<= z -185000.0)
(fma t_1 60.0 (* 120.0 a))
(if (<= z -9.3e-175)
(fma a 120.0 (/ (* x 60.0) (- z t)))
(if (<= z 7.9e+21)
(fma (/ (- x y) t) -60.0 (* 120.0 a))
(fma a 120.0 (* t_1 60.0)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - y) / z;
double tmp;
if (z <= -185000.0) {
tmp = fma(t_1, 60.0, (120.0 * a));
} else if (z <= -9.3e-175) {
tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
} else if (z <= 7.9e+21) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, (t_1 * 60.0));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - y) / z) tmp = 0.0 if (z <= -185000.0) tmp = fma(t_1, 60.0, Float64(120.0 * a)); elseif (z <= -9.3e-175) tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t))); elseif (z <= 7.9e+21) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, Float64(t_1 * 60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -185000.0], N[(t$95$1 * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.3e-175], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.9e+21], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(t$95$1 * 60.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z}\\
\mathbf{if}\;z \leq -185000:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 60, 120 \cdot a\right)\\
\mathbf{elif}\;z \leq -9.3 \cdot 10^{-175}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
\mathbf{elif}\;z \leq 7.9 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, t\_1 \cdot 60\right)\\
\end{array}
\end{array}
if z < -185000Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites90.3%
if -185000 < z < -9.300000000000001e-175Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites91.3%
if -9.300000000000001e-175 < z < 7.9e21Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites91.1%
if 7.9e21 < z Initial program 98.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6498.6
Applied rewrites98.6%
Taylor expanded in z around inf
Applied rewrites93.3%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.5e+73)
(fma a 120.0 (/ (* x 60.0) z))
(if (<= a -3.9e-32)
(fma (/ y t) 60.0 (* 120.0 a))
(if (<= a 1.2e-19) (* (- x y) (/ 60.0 (- z t))) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.5e+73) {
tmp = fma(a, 120.0, ((x * 60.0) / z));
} else if (a <= -3.9e-32) {
tmp = fma((y / t), 60.0, (120.0 * a));
} else if (a <= 1.2e-19) {
tmp = (x - y) * (60.0 / (z - t));
} else {
tmp = 120.0 * a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.5e+73) tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / z)); elseif (a <= -3.9e-32) tmp = fma(Float64(y / t), 60.0, Float64(120.0 * a)); elseif (a <= 1.2e-19) tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); else tmp = Float64(120.0 * a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.5e+73], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -3.9e-32], N[(N[(y / t), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.2e-19], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z}\right)\\
\mathbf{elif}\;a \leq -3.9 \cdot 10^{-32}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, 60, 120 \cdot a\right)\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-19}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -1.50000000000000005e73Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites97.1%
Taylor expanded in z around inf
Applied rewrites88.8%
if -1.50000000000000005e73 < a < -3.9000000000000001e-32Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites81.2%
Taylor expanded in x around 0
Applied rewrites74.2%
if -3.9000000000000001e-32 < a < 1.20000000000000011e-19Initial program 98.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6498.8
Applied rewrites98.8%
Taylor expanded in a around 0
Applied rewrites78.0%
if 1.20000000000000011e-19 < a Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites88.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ x (- z t)) 60.0)))
(if (<= x -7.8e+172)
t_1
(if (<= x -1.42e+30)
(* 120.0 a)
(if (<= x 1.02e+176) (fma (/ y t) 60.0 (* 120.0 a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x / (z - t)) * 60.0;
double tmp;
if (x <= -7.8e+172) {
tmp = t_1;
} else if (x <= -1.42e+30) {
tmp = 120.0 * a;
} else if (x <= 1.02e+176) {
tmp = fma((y / t), 60.0, (120.0 * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x / Float64(z - t)) * 60.0) tmp = 0.0 if (x <= -7.8e+172) tmp = t_1; elseif (x <= -1.42e+30) tmp = Float64(120.0 * a); elseif (x <= 1.02e+176) tmp = fma(Float64(y / t), 60.0, Float64(120.0 * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision]}, If[LessEqual[x, -7.8e+172], t$95$1, If[LessEqual[x, -1.42e+30], N[(120.0 * a), $MachinePrecision], If[LessEqual[x, 1.02e+176], N[(N[(y / t), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z - t} \cdot 60\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.42 \cdot 10^{+30}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{+176}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.79999999999999934e172 or 1.02000000000000001e176 < x Initial program 98.2%
Taylor expanded in x around inf
Applied rewrites67.1%
if -7.79999999999999934e172 < x < -1.41999999999999991e30Initial program 99.6%
Taylor expanded in z around inf
Applied rewrites60.0%
if -1.41999999999999991e30 < x < 1.02000000000000001e176Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites74.6%
Taylor expanded in x around 0
Applied rewrites71.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.38e-8) (not (<= z 7.9e+21))) (fma (/ (- x y) z) 60.0 (* 120.0 a)) (fma (/ (- x y) t) -60.0 (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.38e-8) || !(z <= 7.9e+21)) {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
} else {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.38e-8) || !(z <= 7.9e+21)) tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); else tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.38e-8], N[Not[LessEqual[z, 7.9e+21]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.38 \cdot 10^{-8} \lor \neg \left(z \leq 7.9 \cdot 10^{+21}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\end{array}
\end{array}
if z < -1.37999999999999995e-8 or 7.9e21 < z Initial program 99.0%
Taylor expanded in z around inf
Applied rewrites92.1%
if -1.37999999999999995e-8 < z < 7.9e21Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites87.3%
Final simplification89.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.8e-73) (not (<= z 8.6e+21))) (fma a 120.0 (/ (* x 60.0) z)) (fma (/ (- x y) t) -60.0 (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.8e-73) || !(z <= 8.6e+21)) {
tmp = fma(a, 120.0, ((x * 60.0) / z));
} else {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.8e-73) || !(z <= 8.6e+21)) tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / z)); else tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.8e-73], N[Not[LessEqual[z, 8.6e+21]], $MachinePrecision]], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-73} \lor \neg \left(z \leq 8.6 \cdot 10^{+21}\right):\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\end{array}
\end{array}
if z < -2.80000000000000012e-73 or 8.6e21 < z Initial program 99.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.2
Applied rewrites99.2%
Taylor expanded in x around inf
Applied rewrites82.9%
Taylor expanded in z around inf
Applied rewrites79.0%
if -2.80000000000000012e-73 < z < 8.6e21Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites88.8%
Final simplification83.0%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.4e-54)
(* 120.0 a)
(if (<= a -1e-213)
(* (/ y (- z t)) -60.0)
(if (<= a 5e-108) (* (- x y) (/ -60.0 t)) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.4e-54) {
tmp = 120.0 * a;
} else if (a <= -1e-213) {
tmp = (y / (z - t)) * -60.0;
} else if (a <= 5e-108) {
tmp = (x - y) * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
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 <= (-3.4d-54)) then
tmp = 120.0d0 * a
else if (a <= (-1d-213)) then
tmp = (y / (z - t)) * (-60.0d0)
else if (a <= 5d-108) then
tmp = (x - y) * ((-60.0d0) / t)
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.4e-54) {
tmp = 120.0 * a;
} else if (a <= -1e-213) {
tmp = (y / (z - t)) * -60.0;
} else if (a <= 5e-108) {
tmp = (x - y) * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.4e-54: tmp = 120.0 * a elif a <= -1e-213: tmp = (y / (z - t)) * -60.0 elif a <= 5e-108: tmp = (x - y) * (-60.0 / t) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.4e-54) tmp = Float64(120.0 * a); elseif (a <= -1e-213) tmp = Float64(Float64(y / Float64(z - t)) * -60.0); elseif (a <= 5e-108) tmp = Float64(Float64(x - y) * Float64(-60.0 / t)); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.4e-54) tmp = 120.0 * a; elseif (a <= -1e-213) tmp = (y / (z - t)) * -60.0; elseif (a <= 5e-108) tmp = (x - y) * (-60.0 / t); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.4e-54], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, -1e-213], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[a, 5e-108], N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{-54}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq -1 \cdot 10^{-213}:\\
\;\;\;\;\frac{y}{z - t} \cdot -60\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -3.39999999999999987e-54 or 5e-108 < a Initial program 99.2%
Taylor expanded in z around inf
Applied rewrites77.3%
if -3.39999999999999987e-54 < a < -9.9999999999999995e-214Initial program 99.7%
Taylor expanded in y around inf
Applied rewrites59.6%
if -9.9999999999999995e-214 < a < 5e-108Initial program 99.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in a around 0
Applied rewrites83.8%
Taylor expanded in z around 0
Applied rewrites51.0%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.6e-32)
(* 120.0 a)
(if (<= a -1e-213)
(* (- x y) (/ 60.0 z))
(if (<= a 5e-108) (* (- x y) (/ -60.0 t)) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.6e-32) {
tmp = 120.0 * a;
} else if (a <= -1e-213) {
tmp = (x - y) * (60.0 / z);
} else if (a <= 5e-108) {
tmp = (x - y) * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
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 <= (-3.6d-32)) then
tmp = 120.0d0 * a
else if (a <= (-1d-213)) then
tmp = (x - y) * (60.0d0 / z)
else if (a <= 5d-108) then
tmp = (x - y) * ((-60.0d0) / t)
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.6e-32) {
tmp = 120.0 * a;
} else if (a <= -1e-213) {
tmp = (x - y) * (60.0 / z);
} else if (a <= 5e-108) {
tmp = (x - y) * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.6e-32: tmp = 120.0 * a elif a <= -1e-213: tmp = (x - y) * (60.0 / z) elif a <= 5e-108: tmp = (x - y) * (-60.0 / t) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.6e-32) tmp = Float64(120.0 * a); elseif (a <= -1e-213) tmp = Float64(Float64(x - y) * Float64(60.0 / z)); elseif (a <= 5e-108) tmp = Float64(Float64(x - y) * Float64(-60.0 / t)); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.6e-32) tmp = 120.0 * a; elseif (a <= -1e-213) tmp = (x - y) * (60.0 / z); elseif (a <= 5e-108) tmp = (x - y) * (-60.0 / t); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.6e-32], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, -1e-213], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5e-108], N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{-32}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq -1 \cdot 10^{-213}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z}\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -3.59999999999999993e-32 or 5e-108 < a Initial program 99.2%
Taylor expanded in z around inf
Applied rewrites78.0%
if -3.59999999999999993e-32 < a < -9.9999999999999995e-214Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites84.1%
Taylor expanded in z around inf
Applied rewrites54.2%
if -9.9999999999999995e-214 < a < 5e-108Initial program 99.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in a around 0
Applied rewrites83.8%
Taylor expanded in z around 0
Applied rewrites51.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x y) z)))
(if (<= z -1.38e-8)
(fma t_1 60.0 (* 120.0 a))
(if (<= z 7.9e+21)
(fma (/ (- x y) t) -60.0 (* 120.0 a))
(fma a 120.0 (* t_1 60.0))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - y) / z;
double tmp;
if (z <= -1.38e-8) {
tmp = fma(t_1, 60.0, (120.0 * a));
} else if (z <= 7.9e+21) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, (t_1 * 60.0));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - y) / z) tmp = 0.0 if (z <= -1.38e-8) tmp = fma(t_1, 60.0, Float64(120.0 * a)); elseif (z <= 7.9e+21) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, Float64(t_1 * 60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -1.38e-8], N[(t$95$1 * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.9e+21], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(t$95$1 * 60.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z}\\
\mathbf{if}\;z \leq -1.38 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 60, 120 \cdot a\right)\\
\mathbf{elif}\;z \leq 7.9 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, t\_1 \cdot 60\right)\\
\end{array}
\end{array}
if z < -1.37999999999999995e-8Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites90.7%
if -1.37999999999999995e-8 < z < 7.9e21Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites87.3%
if 7.9e21 < z Initial program 98.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6498.6
Applied rewrites98.6%
Taylor expanded in z around inf
Applied rewrites93.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.8e-32) (not (<= a 1.2e-19))) (* 120.0 a) (* (- x y) (/ 60.0 (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.8e-32) || !(a <= 1.2e-19)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (60.0 / (z - t));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-3.8d-32)) .or. (.not. (a <= 1.2d-19))) then
tmp = 120.0d0 * a
else
tmp = (x - y) * (60.0d0 / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.8e-32) || !(a <= 1.2e-19)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (60.0 / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.8e-32) or not (a <= 1.2e-19): tmp = 120.0 * a else: tmp = (x - y) * (60.0 / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.8e-32) || !(a <= 1.2e-19)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.8e-32) || ~((a <= 1.2e-19))) tmp = 120.0 * a; else tmp = (x - y) * (60.0 / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.8e-32], N[Not[LessEqual[a, 1.2e-19]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{-32} \lor \neg \left(a \leq 1.2 \cdot 10^{-19}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if a < -3.80000000000000008e-32 or 1.20000000000000011e-19 < a Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites82.2%
if -3.80000000000000008e-32 < a < 1.20000000000000011e-19Initial program 98.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6498.8
Applied rewrites98.8%
Taylor expanded in a around 0
Applied rewrites78.0%
Final simplification80.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.4e-60) (not (<= a 5e-108))) (* 120.0 a) (* (- x y) (/ -60.0 t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.4e-60) || !(a <= 5e-108)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (-60.0 / t);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-5.4d-60)) .or. (.not. (a <= 5d-108))) then
tmp = 120.0d0 * a
else
tmp = (x - y) * ((-60.0d0) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.4e-60) || !(a <= 5e-108)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (-60.0 / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.4e-60) or not (a <= 5e-108): tmp = 120.0 * a else: tmp = (x - y) * (-60.0 / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.4e-60) || !(a <= 5e-108)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x - y) * Float64(-60.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.4e-60) || ~((a <= 5e-108))) tmp = 120.0 * a; else tmp = (x - y) * (-60.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.4e-60], N[Not[LessEqual[a, 5e-108]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-60} \lor \neg \left(a \leq 5 \cdot 10^{-108}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\end{array}
\end{array}
if a < -5.40000000000000001e-60 or 5e-108 < a Initial program 99.2%
Taylor expanded in z around inf
Applied rewrites76.4%
if -5.40000000000000001e-60 < a < 5e-108Initial program 99.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in a around 0
Applied rewrites84.9%
Taylor expanded in z around 0
Applied rewrites48.4%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7e-64) (not (<= a 5e-108))) (* 120.0 a) (* (/ (- x y) t) -60.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e-64) || !(a <= 5e-108)) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 <= (-7d-64)) .or. (.not. (a <= 5d-108))) then
tmp = 120.0d0 * a
else
tmp = ((x - y) / t) * (-60.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e-64) || !(a <= 5e-108)) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7e-64) or not (a <= 5e-108): tmp = 120.0 * a else: tmp = ((x - y) / t) * -60.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7e-64) || !(a <= 5e-108)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(Float64(x - y) / t) * -60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -7e-64) || ~((a <= 5e-108))) tmp = 120.0 * a; else tmp = ((x - y) / t) * -60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7e-64], N[Not[LessEqual[a, 5e-108]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{-64} \lor \neg \left(a \leq 5 \cdot 10^{-108}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\end{array}
\end{array}
if a < -7.0000000000000006e-64 or 5e-108 < a Initial program 99.2%
Taylor expanded in z around inf
Applied rewrites76.4%
if -7.0000000000000006e-64 < a < 5e-108Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites56.1%
Taylor expanded in t around 0
Applied rewrites48.4%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (* 120.0 a))
double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
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 = 120.0d0 * a
end function
public static double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
def code(x, y, z, t, a): return 120.0 * a
function code(x, y, z, t, a) return Float64(120.0 * a) end
function tmp = code(x, y, z, t, a) tmp = 120.0 * a; end
code[x_, y_, z_, t_, a_] := N[(120.0 * a), $MachinePrecision]
\begin{array}{l}
\\
120 \cdot a
\end{array}
Initial program 99.3%
Taylor expanded in z around inf
Applied rewrites54.6%
(FPCore (x y z t a) :precision binary64 (+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
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 = (60.0d0 / ((z - t) / (x - y))) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
def code(x, y, z, t, a): return (60.0 / ((z - t) / (x - y))) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(60.0 / Float64(Float64(z - t) / Float64(x - y))) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = (60.0 / ((z - t) / (x - y))) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(60.0 / N[(N[(z - t), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60}{\frac{z - t}{x - y}} + a \cdot 120
\end{array}
herbie shell --seed 2025026
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (+ (/ 60 (/ (- z t) (- x y))) (* a 120)))
(+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))