
(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 (* (/ 60.0 (- z t)) (- x y))))
double code(double x, double y, double z, double t, double a) {
return fma(a, 120.0, ((60.0 / (z - t)) * (x - y)));
}
function code(x, y, z, t, a) return fma(a, 120.0, Float64(Float64(60.0 / Float64(z - t)) * Float64(x - y))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \frac{60}{z - t} \cdot \left(x - y\right)\right)
\end{array}
Initial program 99.3%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6499.4
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
(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) (/ -60.0 t))))))
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) * (-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) :: 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) * ((-60.0d0) / t)
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) * (-60.0 / t);
}
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) * (-60.0 / t) 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(x - y) * Float64(-60.0 / t)); 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) * (-60.0 / t); 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[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $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}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\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
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6466.4
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
lower-*.f6468.4
Applied rewrites68.4%
if 2e110 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.6%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6485.3
Applied rewrites85.3%
Taylor expanded in z around 0
lower-/.f6460.5
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+240)))
(* y (/ 60.0 t))
(* 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+240)) {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if ((t_1 <= (-5d+163)) .or. (.not. (t_1 <= 5d+240))) then
tmp = 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -5e+163) || !(t_1 <= 5e+240)) {
tmp = y * (60.0 / t);
} 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+240): tmp = y * (60.0 / t) 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+240)) tmp = Float64(y * Float64(60.0 / t)); 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+240))) tmp = y * (60.0 / t); 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+240]], $MachinePrecision]], N[(y * N[(60.0 / t), $MachinePrecision]), $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^{+240}\right):\\
\;\;\;\;y \cdot \frac{60}{t}\\
\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.0000000000000003e240 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6448.7
Applied rewrites48.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
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
lower-*.f6464.3
Applied rewrites64.3%
Final simplification60.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+163)
(* x (/ -60.0 t))
(if (<= t_1 5e+240) (* 120.0 a) (* y (/ 60.0 t))))))
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 * (-60.0 / t);
} else if (t_1 <= 5e+240) {
tmp = 120.0 * a;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+163)) then
tmp = x * ((-60.0d0) / t)
else if (t_1 <= 5d+240) then
tmp = 120.0d0 * a
else
tmp = 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+163) {
tmp = x * (-60.0 / t);
} else if (t_1 <= 5e+240) {
tmp = 120.0 * a;
} else {
tmp = y * (60.0 / t);
}
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 * (-60.0 / t) elif t_1 <= 5e+240: tmp = 120.0 * a else: tmp = y * (60.0 / t) 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(x * Float64(-60.0 / t)); elseif (t_1 <= 5e+240) tmp = Float64(120.0 * a); else tmp = Float64(y * Float64(60.0 / t)); 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 * (-60.0 / t); elseif (t_1 <= 5e+240) tmp = 120.0 * a; else tmp = y * (60.0 / t); 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[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+240], N[(120.0 * a), $MachinePrecision], N[(y * N[(60.0 / t), $MachinePrecision]), $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}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{60}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5e163Initial program 95.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6495.2
Applied rewrites95.2%
Taylor expanded in z around 0
lower-/.f6458.1
Applied rewrites58.1%
Taylor expanded in x around inf
Applied rewrites36.8%
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
lower-*.f6464.3
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 y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6473.0
Applied rewrites73.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.5
Applied rewrites56.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6456.5
Applied rewrites56.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+163)
(* (/ y t) 60.0)
(if (<= t_1 5e+240) (* 120.0 a) (* y (/ 60.0 t))))))
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 = (y / t) * 60.0;
} else if (t_1 <= 5e+240) {
tmp = 120.0 * a;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+163)) then
tmp = (y / t) * 60.0d0
else if (t_1 <= 5d+240) then
tmp = 120.0d0 * a
else
tmp = 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+163) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 5e+240) {
tmp = 120.0 * a;
} else {
tmp = y * (60.0 / t);
}
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 = (y / t) * 60.0 elif t_1 <= 5e+240: tmp = 120.0 * a else: tmp = y * (60.0 / t) 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(y / t) * 60.0); elseif (t_1 <= 5e+240) tmp = Float64(120.0 * a); else tmp = Float64(y * Float64(60.0 / t)); 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 = (y / t) * 60.0; elseif (t_1 <= 5e+240) tmp = 120.0 * a; else tmp = y * (60.0 / t); 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[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+240], N[(120.0 * a), $MachinePrecision], N[(y * N[(60.0 / t), $MachinePrecision]), $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{y}{t} \cdot 60\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{60}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5e163Initial program 95.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6425.9
Applied rewrites25.9%
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
lower-*.f6464.3
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 y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6473.0
Applied rewrites73.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.5
Applied rewrites56.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6456.5
Applied rewrites56.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -6.4e+72)
(+ (* (/ x z) 60.0) (* a 120.0))
(if (<= a -4e-32)
(fma a 120.0 (* (/ y t) 60.0))
(if (<= a 2.25e-20) (* (- 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 <= -6.4e+72) {
tmp = ((x / z) * 60.0) + (a * 120.0);
} else if (a <= -4e-32) {
tmp = fma(a, 120.0, ((y / t) * 60.0));
} else if (a <= 2.25e-20) {
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 <= -6.4e+72) tmp = Float64(Float64(Float64(x / z) * 60.0) + Float64(a * 120.0)); elseif (a <= -4e-32) tmp = fma(a, 120.0, Float64(Float64(y / t) * 60.0)); elseif (a <= 2.25e-20) 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, -6.4e+72], N[(N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -4e-32], N[(a * 120.0 + N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.25e-20], 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 -6.4 \cdot 10^{+72}:\\
\;\;\;\;\frac{x}{z} \cdot 60 + a \cdot 120\\
\mathbf{elif}\;a \leq -4 \cdot 10^{-32}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{y}{t} \cdot 60\right)\\
\mathbf{elif}\;a \leq 2.25 \cdot 10^{-20}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -6.4000000000000003e72Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.3
Applied rewrites84.3%
Taylor expanded in x around inf
Applied rewrites88.8%
if -6.4000000000000003e72 < a < -4.00000000000000022e-32Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6499.8
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.2
Applied rewrites81.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
if -4.00000000000000022e-32 < a < 2.2500000000000001e-20Initial program 98.8%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
if 2.2500000000000001e-20 < a Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6488.2
Applied rewrites88.2%
Final simplification82.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -8.2e+57) (not (<= y 1.35e+52))) (+ (/ (* -60.0 y) (- z t)) (* a 120.0)) (+ (/ (* 60.0 x) (- z t)) (* a 120.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -8.2e+57) || !(y <= 1.35e+52)) {
tmp = ((-60.0 * y) / (z - t)) + (a * 120.0);
} else {
tmp = ((60.0 * x) / (z - t)) + (a * 120.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 ((y <= (-8.2d+57)) .or. (.not. (y <= 1.35d+52))) then
tmp = (((-60.0d0) * y) / (z - t)) + (a * 120.0d0)
else
tmp = ((60.0d0 * x) / (z - t)) + (a * 120.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -8.2e+57) || !(y <= 1.35e+52)) {
tmp = ((-60.0 * y) / (z - t)) + (a * 120.0);
} else {
tmp = ((60.0 * x) / (z - t)) + (a * 120.0);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -8.2e+57) or not (y <= 1.35e+52): tmp = ((-60.0 * y) / (z - t)) + (a * 120.0) else: tmp = ((60.0 * x) / (z - t)) + (a * 120.0) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -8.2e+57) || !(y <= 1.35e+52)) tmp = Float64(Float64(Float64(-60.0 * y) / Float64(z - t)) + Float64(a * 120.0)); else tmp = Float64(Float64(Float64(60.0 * x) / Float64(z - t)) + Float64(a * 120.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -8.2e+57) || ~((y <= 1.35e+52))) tmp = ((-60.0 * y) / (z - t)) + (a * 120.0); else tmp = ((60.0 * x) / (z - t)) + (a * 120.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -8.2e+57], N[Not[LessEqual[y, 1.35e+52]], $MachinePrecision]], N[(N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(60.0 * x), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+57} \lor \neg \left(y \leq 1.35 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{-60 \cdot y}{z - t} + a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;\frac{60 \cdot x}{z - t} + a \cdot 120\\
\end{array}
\end{array}
if y < -8.2e57 or 1.35e52 < y Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6490.8
Applied rewrites90.8%
if -8.2e57 < y < 1.35e52Initial program 99.1%
Taylor expanded in x around inf
Applied rewrites93.9%
Final simplification92.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.45e-13) (not (<= z 3.5e+20))) (fma (/ (- x y) z) 60.0 (* 120.0 a)) (fma a 120.0 (* (/ (- x y) t) -60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.45e-13) || !(z <= 3.5e+20)) {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, (((x - y) / t) * -60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.45e-13) || !(z <= 3.5e+20)) tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / t) * -60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.45e-13], N[Not[LessEqual[z, 3.5e+20]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-13} \lor \neg \left(z \leq 3.5 \cdot 10^{+20}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right)\\
\end{array}
\end{array}
if z < -1.4499999999999999e-13 or 3.5e20 < z Initial program 99.0%
Taylor expanded in z around inf
*-commutativeN/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6492.1
Applied rewrites92.1%
if -1.4499999999999999e-13 < z < 3.5e20Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6499.7
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6487.4
Applied rewrites87.4%
Final simplification89.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.45e-13) (not (<= z 3.5e+20))) (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.45e-13) || !(z <= 3.5e+20)) {
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.45e-13) || !(z <= 3.5e+20)) 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.45e-13], N[Not[LessEqual[z, 3.5e+20]], $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.45 \cdot 10^{-13} \lor \neg \left(z \leq 3.5 \cdot 10^{+20}\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.4499999999999999e-13 or 3.5e20 < z Initial program 99.0%
Taylor expanded in z around inf
*-commutativeN/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6492.1
Applied rewrites92.1%
if -1.4499999999999999e-13 < z < 3.5e20Initial program 99.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification89.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -9.5e-52)
(* 120.0 a)
(if (<= a -4.6e-214)
(* (/ y (- z t)) -60.0)
(if (<= a 1.08e-104) (* (- x y) (/ -60.0 t)) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.5e-52) {
tmp = 120.0 * a;
} else if (a <= -4.6e-214) {
tmp = (y / (z - t)) * -60.0;
} else if (a <= 1.08e-104) {
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 <= (-9.5d-52)) then
tmp = 120.0d0 * a
else if (a <= (-4.6d-214)) then
tmp = (y / (z - t)) * (-60.0d0)
else if (a <= 1.08d-104) 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 <= -9.5e-52) {
tmp = 120.0 * a;
} else if (a <= -4.6e-214) {
tmp = (y / (z - t)) * -60.0;
} else if (a <= 1.08e-104) {
tmp = (x - y) * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9.5e-52: tmp = 120.0 * a elif a <= -4.6e-214: tmp = (y / (z - t)) * -60.0 elif a <= 1.08e-104: 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 <= -9.5e-52) tmp = Float64(120.0 * a); elseif (a <= -4.6e-214) tmp = Float64(Float64(y / Float64(z - t)) * -60.0); elseif (a <= 1.08e-104) 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 <= -9.5e-52) tmp = 120.0 * a; elseif (a <= -4.6e-214) tmp = (y / (z - t)) * -60.0; elseif (a <= 1.08e-104) 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, -9.5e-52], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, -4.6e-214], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[a, 1.08e-104], 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 -9.5 \cdot 10^{-52}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq -4.6 \cdot 10^{-214}:\\
\;\;\;\;\frac{y}{z - t} \cdot -60\\
\mathbf{elif}\;a \leq 1.08 \cdot 10^{-104}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -9.50000000000000007e-52 or 1.07999999999999997e-104 < a Initial program 99.2%
Taylor expanded in z around inf
lower-*.f6477.3
Applied rewrites77.3%
if -9.50000000000000007e-52 < a < -4.60000000000000022e-214Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.6
Applied rewrites59.6%
if -4.60000000000000022e-214 < a < 1.07999999999999997e-104Initial program 99.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6483.8
Applied rewrites83.8%
Taylor expanded in z around 0
lower-/.f6451.0
Applied rewrites51.0%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.9e-32)
(* 120.0 a)
(if (<= a -3.8e-214)
(* (- x y) (/ 60.0 z))
(if (<= a 1.08e-104) (* (- 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.9e-32) {
tmp = 120.0 * a;
} else if (a <= -3.8e-214) {
tmp = (x - y) * (60.0 / z);
} else if (a <= 1.08e-104) {
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.9d-32)) then
tmp = 120.0d0 * a
else if (a <= (-3.8d-214)) then
tmp = (x - y) * (60.0d0 / z)
else if (a <= 1.08d-104) 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.9e-32) {
tmp = 120.0 * a;
} else if (a <= -3.8e-214) {
tmp = (x - y) * (60.0 / z);
} else if (a <= 1.08e-104) {
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.9e-32: tmp = 120.0 * a elif a <= -3.8e-214: tmp = (x - y) * (60.0 / z) elif a <= 1.08e-104: 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.9e-32) tmp = Float64(120.0 * a); elseif (a <= -3.8e-214) tmp = Float64(Float64(x - y) * Float64(60.0 / z)); elseif (a <= 1.08e-104) 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.9e-32) tmp = 120.0 * a; elseif (a <= -3.8e-214) tmp = (x - y) * (60.0 / z); elseif (a <= 1.08e-104) 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.9e-32], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, -3.8e-214], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.08e-104], 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.9 \cdot 10^{-32}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq -3.8 \cdot 10^{-214}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z}\\
\mathbf{elif}\;a \leq 1.08 \cdot 10^{-104}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -3.9000000000000001e-32 or 1.07999999999999997e-104 < a Initial program 99.2%
Taylor expanded in z around inf
lower-*.f6478.0
Applied rewrites78.0%
if -3.9000000000000001e-32 < a < -3.8000000000000003e-214Initial program 99.6%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in z around inf
Applied rewrites54.2%
if -3.8000000000000003e-214 < a < 1.07999999999999997e-104Initial program 99.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6483.8
Applied rewrites83.8%
Taylor expanded in z around 0
lower-/.f6451.0
Applied rewrites51.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.45e-13)
(+ (* (/ (- x y) z) 60.0) (* a 120.0))
(if (<= z 3.5e+20)
(fma a 120.0 (* (/ (- x y) t) -60.0))
(fma a 120.0 (* (/ 60.0 z) (- x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e-13) {
tmp = (((x - y) / z) * 60.0) + (a * 120.0);
} else if (z <= 3.5e+20) {
tmp = fma(a, 120.0, (((x - y) / t) * -60.0));
} else {
tmp = fma(a, 120.0, ((60.0 / z) * (x - y)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45e-13) tmp = Float64(Float64(Float64(Float64(x - y) / z) * 60.0) + Float64(a * 120.0)); elseif (z <= 3.5e+20) tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / t) * -60.0)); else tmp = fma(a, 120.0, Float64(Float64(60.0 / z) * Float64(x - y))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45e-13], N[(N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+20], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(60.0 / z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-13}:\\
\;\;\;\;\frac{x - y}{z} \cdot 60 + a \cdot 120\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{z} \cdot \left(x - y\right)\right)\\
\end{array}
\end{array}
if z < -1.4499999999999999e-13Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6490.8
Applied rewrites90.8%
if -1.4499999999999999e-13 < z < 3.5e20Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6499.7
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6487.4
Applied rewrites87.4%
if 3.5e20 < z Initial program 98.5%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6498.6
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites93.4%
Final simplification90.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.45e-13)
(fma (/ (- x y) z) 60.0 (* 120.0 a))
(if (<= z 3.5e+20)
(fma a 120.0 (* (/ (- x y) t) -60.0))
(fma a 120.0 (* (/ 60.0 z) (- x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e-13) {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
} else if (z <= 3.5e+20) {
tmp = fma(a, 120.0, (((x - y) / t) * -60.0));
} else {
tmp = fma(a, 120.0, ((60.0 / z) * (x - y)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45e-13) tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); elseif (z <= 3.5e+20) tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / t) * -60.0)); else tmp = fma(a, 120.0, Float64(Float64(60.0 / z) * Float64(x - y))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45e-13], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+20], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(60.0 / z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{z} \cdot \left(x - y\right)\right)\\
\end{array}
\end{array}
if z < -1.4499999999999999e-13Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6490.7
Applied rewrites90.7%
if -1.4499999999999999e-13 < z < 3.5e20Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6499.7
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6487.4
Applied rewrites87.4%
if 3.5e20 < z Initial program 98.5%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6498.6
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites93.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.2e-12)
(+ (* (/ y z) -60.0) (* a 120.0))
(if (<= z 5.1e+20)
(fma (/ (- x y) t) -60.0 (* 120.0 a))
(+ (* (/ x z) 60.0) (* a 120.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.2e-12) {
tmp = ((y / z) * -60.0) + (a * 120.0);
} else if (z <= 5.1e+20) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = ((x / z) * 60.0) + (a * 120.0);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.2e-12) tmp = Float64(Float64(Float64(y / z) * -60.0) + Float64(a * 120.0)); elseif (z <= 5.1e+20) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = Float64(Float64(Float64(x / z) * 60.0) + Float64(a * 120.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.2e-12], N[(N[(N[(y / z), $MachinePrecision] * -60.0), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.1e+20], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{z} \cdot -60 + a \cdot 120\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot 60 + a \cdot 120\\
\end{array}
\end{array}
if z < -9.19999999999999957e-12Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6490.8
Applied rewrites90.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
if -9.19999999999999957e-12 < z < 5.1e20Initial program 99.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
if 5.1e20 < z Initial program 98.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6493.2
Applied rewrites93.2%
Taylor expanded in x around inf
Applied rewrites84.3%
Final simplification84.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.9e-32) (not (<= a 2.25e-20))) (* 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.9e-32) || !(a <= 2.25e-20)) {
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.9d-32)) .or. (.not. (a <= 2.25d-20))) 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.9e-32) || !(a <= 2.25e-20)) {
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.9e-32) or not (a <= 2.25e-20): 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.9e-32) || !(a <= 2.25e-20)) 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.9e-32) || ~((a <= 2.25e-20))) 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.9e-32], N[Not[LessEqual[a, 2.25e-20]], $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.9 \cdot 10^{-32} \lor \neg \left(a \leq 2.25 \cdot 10^{-20}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if a < -3.9000000000000001e-32 or 2.2500000000000001e-20 < a Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6482.2
Applied rewrites82.2%
if -3.9000000000000001e-32 < a < 2.2500000000000001e-20Initial program 98.8%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
Final simplification80.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.32e-66) (not (<= a 1.08e-104))) (* 120.0 a) (* (- x y) (/ -60.0 t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.32e-66) || !(a <= 1.08e-104)) {
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 <= (-1.32d-66)) .or. (.not. (a <= 1.08d-104))) 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 <= -1.32e-66) || !(a <= 1.08e-104)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (-60.0 / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.32e-66) or not (a <= 1.08e-104): 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 <= -1.32e-66) || !(a <= 1.08e-104)) 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 <= -1.32e-66) || ~((a <= 1.08e-104))) 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, -1.32e-66], N[Not[LessEqual[a, 1.08e-104]], $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 -1.32 \cdot 10^{-66} \lor \neg \left(a \leq 1.08 \cdot 10^{-104}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\end{array}
\end{array}
if a < -1.3200000000000001e-66 or 1.07999999999999997e-104 < a Initial program 99.2%
Taylor expanded in z around inf
lower-*.f6476.4
Applied rewrites76.4%
if -1.3200000000000001e-66 < a < 1.07999999999999997e-104Initial program 99.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6484.9
Applied rewrites84.9%
Taylor expanded in z around 0
lower-/.f6448.4
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
lower-*.f6454.6
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)))