
(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 14 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.4%
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.7
Applied rewrites99.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -5e+122) (not (<= t_1 5e+75)))
(/ (* x 60.0) (- z 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+122) || !(t_1 <= 5e+75)) {
tmp = (x * 60.0) / (z - 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+122)) .or. (.not. (t_1 <= 5d+75))) then
tmp = (x * 60.0d0) / (z - 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+122) || !(t_1 <= 5e+75)) {
tmp = (x * 60.0) / (z - 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+122) or not (t_1 <= 5e+75): tmp = (x * 60.0) / (z - 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+122) || !(t_1 <= 5e+75)) tmp = Float64(Float64(x * 60.0) / Float64(z - 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+122) || ~((t_1 <= 5e+75))) tmp = (x * 60.0) / (z - 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+122], N[Not[LessEqual[t$95$1, 5e+75]], $MachinePrecision]], N[(N[(x * 60.0), $MachinePrecision] / N[(z - 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^{+122} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+75}\right):\\
\;\;\;\;\frac{x \cdot 60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.99999999999999989e122 or 5.0000000000000002e75 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6451.5
Applied rewrites51.5%
Applied rewrites51.6%
if -4.99999999999999989e122 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000002e75Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.4
Applied rewrites61.4%
Final simplification58.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -5e+122) (not (<= t_1 5e+75)))
(* x (/ 60.0 (- z 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+122) || !(t_1 <= 5e+75)) {
tmp = x * (60.0 / (z - 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+122)) .or. (.not. (t_1 <= 5d+75))) then
tmp = x * (60.0d0 / (z - 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+122) || !(t_1 <= 5e+75)) {
tmp = x * (60.0 / (z - 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+122) or not (t_1 <= 5e+75): tmp = x * (60.0 / (z - 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+122) || !(t_1 <= 5e+75)) tmp = Float64(x * Float64(60.0 / Float64(z - 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+122) || ~((t_1 <= 5e+75))) tmp = x * (60.0 / (z - 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+122], N[Not[LessEqual[t$95$1, 5e+75]], $MachinePrecision]], N[(x * N[(60.0 / N[(z - t), $MachinePrecision]), $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^{+122} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+75}\right):\\
\;\;\;\;x \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.99999999999999989e122 or 5.0000000000000002e75 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6451.5
Applied rewrites51.5%
Applied rewrites51.6%
if -4.99999999999999989e122 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000002e75Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.4
Applied rewrites61.4%
Final simplification58.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -1e+126) (not (<= t_1 5e+75)))
(* x (/ -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 <= -1e+126) || !(t_1 <= 5e+75)) {
tmp = x * (-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 <= (-1d+126)) .or. (.not. (t_1 <= 5d+75))) then
tmp = x * ((-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 <= -1e+126) || !(t_1 <= 5e+75)) {
tmp = x * (-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 <= -1e+126) or not (t_1 <= 5e+75): tmp = x * (-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 <= -1e+126) || !(t_1 <= 5e+75)) tmp = Float64(x * 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 <= -1e+126) || ~((t_1 <= 5e+75))) tmp = x * (-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, -1e+126], N[Not[LessEqual[t$95$1, 5e+75]], $MachinePrecision]], N[(x * 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 -1 \cdot 10^{+126} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+75}\right):\\
\;\;\;\;x \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)) < -9.99999999999999925e125 or 5.0000000000000002e75 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6451.5
Applied rewrites51.5%
Taylor expanded in z around 0
Applied rewrites28.7%
Applied rewrites28.7%
if -9.99999999999999925e125 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000002e75Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.3
Applied rewrites61.3%
Final simplification51.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -2e+175)
(* (/ x z) 60.0)
(if (<= t_1 5e+75) (* 120.0 a) (/ (* -60.0 x) 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 <= -2e+175) {
tmp = (x / z) * 60.0;
} else if (t_1 <= 5e+75) {
tmp = 120.0 * a;
} else {
tmp = (-60.0 * x) / 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 <= (-2d+175)) then
tmp = (x / z) * 60.0d0
else if (t_1 <= 5d+75) then
tmp = 120.0d0 * a
else
tmp = ((-60.0d0) * x) / 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 <= -2e+175) {
tmp = (x / z) * 60.0;
} else if (t_1 <= 5e+75) {
tmp = 120.0 * a;
} else {
tmp = (-60.0 * x) / t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -2e+175: tmp = (x / z) * 60.0 elif t_1 <= 5e+75: tmp = 120.0 * a else: tmp = (-60.0 * x) / 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 <= -2e+175) tmp = Float64(Float64(x / z) * 60.0); elseif (t_1 <= 5e+75) tmp = Float64(120.0 * a); else tmp = Float64(Float64(-60.0 * x) / 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 <= -2e+175) tmp = (x / z) * 60.0; elseif (t_1 <= 5e+75) tmp = 120.0 * a; else tmp = (-60.0 * x) / 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, -2e+175], N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+75], N[(120.0 * a), $MachinePrecision], N[(N[(-60.0 * x), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+175}:\\
\;\;\;\;\frac{x}{z} \cdot 60\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{-60 \cdot x}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -1.9999999999999999e175Initial program 95.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6452.7
Applied rewrites52.7%
Taylor expanded in z around inf
Applied rewrites38.2%
if -1.9999999999999999e175 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000002e75Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6457.8
Applied rewrites57.8%
if 5.0000000000000002e75 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in z around 0
Applied rewrites32.2%
Applied rewrites32.2%
Final simplification51.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -1e+126)
(* x (/ -60.0 t))
(if (<= t_1 5e+75) (* 120.0 a) (/ (* -60.0 x) 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 <= -1e+126) {
tmp = x * (-60.0 / t);
} else if (t_1 <= 5e+75) {
tmp = 120.0 * a;
} else {
tmp = (-60.0 * x) / 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 <= (-1d+126)) then
tmp = x * ((-60.0d0) / t)
else if (t_1 <= 5d+75) then
tmp = 120.0d0 * a
else
tmp = ((-60.0d0) * x) / 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 <= -1e+126) {
tmp = x * (-60.0 / t);
} else if (t_1 <= 5e+75) {
tmp = 120.0 * a;
} else {
tmp = (-60.0 * x) / t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -1e+126: tmp = x * (-60.0 / t) elif t_1 <= 5e+75: tmp = 120.0 * a else: tmp = (-60.0 * x) / 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 <= -1e+126) tmp = Float64(x * Float64(-60.0 / t)); elseif (t_1 <= 5e+75) tmp = Float64(120.0 * a); else tmp = Float64(Float64(-60.0 * x) / 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 <= -1e+126) tmp = x * (-60.0 / t); elseif (t_1 <= 5e+75) tmp = 120.0 * a; else tmp = (-60.0 * x) / 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, -1e+126], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+75], N[(120.0 * a), $MachinePrecision], N[(N[(-60.0 * x), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+126}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{-60 \cdot x}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.99999999999999925e125Initial program 97.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6445.5
Applied rewrites45.5%
Taylor expanded in z around 0
Applied rewrites24.4%
Applied rewrites24.4%
if -9.99999999999999925e125 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000002e75Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.3
Applied rewrites61.3%
if 5.0000000000000002e75 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in z around 0
Applied rewrites32.2%
Applied rewrites32.2%
Final simplification51.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -1e+126)
(* x (/ -60.0 t))
(if (<= t_1 5e+75) (* 120.0 a) (* (/ x 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 <= -1e+126) {
tmp = x * (-60.0 / t);
} else if (t_1 <= 5e+75) {
tmp = 120.0 * a;
} else {
tmp = (x / 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 <= (-1d+126)) then
tmp = x * ((-60.0d0) / t)
else if (t_1 <= 5d+75) then
tmp = 120.0d0 * a
else
tmp = (x / 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 <= -1e+126) {
tmp = x * (-60.0 / t);
} else if (t_1 <= 5e+75) {
tmp = 120.0 * a;
} else {
tmp = (x / 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 <= -1e+126: tmp = x * (-60.0 / t) elif t_1 <= 5e+75: tmp = 120.0 * a else: tmp = (x / 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 <= -1e+126) tmp = Float64(x * Float64(-60.0 / t)); elseif (t_1 <= 5e+75) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x / 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 <= -1e+126) tmp = x * (-60.0 / t); elseif (t_1 <= 5e+75) tmp = 120.0 * a; else tmp = (x / 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, -1e+126], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+75], N[(120.0 * a), $MachinePrecision], N[(N[(x / 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 -1 \cdot 10^{+126}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot -60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.99999999999999925e125Initial program 97.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6445.5
Applied rewrites45.5%
Taylor expanded in z around 0
Applied rewrites24.4%
Applied rewrites24.4%
if -9.99999999999999925e125 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000002e75Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.3
Applied rewrites61.3%
if 5.0000000000000002e75 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in z around 0
Applied rewrites32.2%
Final simplification51.0%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.8e+100)
(* 120.0 a)
(if (<= a 2.2e-32)
(/ (* (- x y) 60.0) (- z t))
(if (<= a 4.4e+119) (fma 120.0 a (* (/ y z) -60.0)) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.8e+100) {
tmp = 120.0 * a;
} else if (a <= 2.2e-32) {
tmp = ((x - y) * 60.0) / (z - t);
} else if (a <= 4.4e+119) {
tmp = fma(120.0, a, ((y / z) * -60.0));
} else {
tmp = 120.0 * a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.8e+100) tmp = Float64(120.0 * a); elseif (a <= 2.2e-32) tmp = Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t)); elseif (a <= 4.4e+119) tmp = fma(120.0, a, Float64(Float64(y / z) * -60.0)); else tmp = Float64(120.0 * a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.8e+100], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 2.2e-32], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.4e+119], N[(120.0 * a + N[(N[(y / z), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+100}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 2.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -3.79999999999999963e100 or 4.4000000000000003e119 < a Initial program 98.5%
Taylor expanded in z around inf
lower-*.f6489.3
Applied rewrites89.3%
if -3.79999999999999963e100 < a < 2.2e-32Initial program 99.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6485.6
Applied rewrites85.6%
Applied rewrites83.7%
Taylor expanded in a around 0
Applied rewrites77.9%
if 2.2e-32 < a < 4.4000000000000003e119Initial program 99.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.8
Applied rewrites76.8%
Taylor expanded in z around inf
Applied rewrites68.1%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -2.2e-13) (not (<= x 3.7e+91))) (fma (/ x (- z t)) 60.0 (* 120.0 a)) (fma a 120.0 (/ (* -60.0 y) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -2.2e-13) || !(x <= 3.7e+91)) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, ((-60.0 * y) / (z - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -2.2e-13) || !(x <= 3.7e+91)) tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -2.2e-13], N[Not[LessEqual[x, 3.7e+91]], $MachinePrecision]], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-13} \lor \neg \left(x \leq 3.7 \cdot 10^{+91}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\
\end{array}
\end{array}
if x < -2.19999999999999997e-13 or 3.69999999999999984e91 < x Initial program 98.9%
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.9
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6486.4
Applied rewrites86.4%
if -2.19999999999999997e-13 < x < 3.69999999999999984e91Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6493.6
Applied rewrites93.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6493.6
Applied rewrites93.6%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -2.2e-13) (not (<= x 3.7e+91))) (fma (/ x (- z t)) 60.0 (* 120.0 a)) (fma 120.0 a (* (/ y (- z t)) -60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -2.2e-13) || !(x <= 3.7e+91)) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -2.2e-13) || !(x <= 3.7e+91)) tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); else tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -2.2e-13], N[Not[LessEqual[x, 3.7e+91]], $MachinePrecision]], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-13} \lor \neg \left(x \leq 3.7 \cdot 10^{+91}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\end{array}
\end{array}
if x < -2.19999999999999997e-13 or 3.69999999999999984e91 < x Initial program 98.9%
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.9
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6486.4
Applied rewrites86.4%
if -2.19999999999999997e-13 < x < 3.69999999999999984e91Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6493.6
Applied rewrites93.6%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5e+101) (not (<= y 2.55e+73))) (/ (* (- x y) 60.0) (- z t)) (fma (/ x (- z t)) 60.0 (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5e+101) || !(y <= 2.55e+73)) {
tmp = ((x - y) * 60.0) / (z - t);
} else {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5e+101) || !(y <= 2.55e+73)) tmp = Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t)); else tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5e+101], N[Not[LessEqual[y, 2.55e+73]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+101} \lor \neg \left(y \leq 2.55 \cdot 10^{+73}\right):\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\end{array}
\end{array}
if y < -4.99999999999999989e101 or 2.55000000000000012e73 < y Initial program 98.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6487.4
Applied rewrites87.4%
Applied rewrites87.3%
Taylor expanded in a around 0
Applied rewrites80.8%
if -4.99999999999999989e101 < y < 2.55000000000000012e73Initial 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.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6489.9
Applied rewrites89.9%
Final simplification86.7%
(FPCore (x y z t a)
:precision binary64
(if (<= x -2.2e-13)
(fma a 120.0 (/ (* x 60.0) (- z t)))
(if (<= x 3.7e+91)
(fma a 120.0 (/ (* -60.0 y) (- z t)))
(fma (/ x (- z t)) 60.0 (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.2e-13) {
tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
} else if (x <= 3.7e+91) {
tmp = fma(a, 120.0, ((-60.0 * y) / (z - t)));
} else {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.2e-13) tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t))); elseif (x <= 3.7e+91) tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / Float64(z - t))); else tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.2e-13], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.7e+91], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\end{array}
\end{array}
if x < -2.19999999999999997e-13Initial program 98.4%
Taylor expanded in x around inf
lower-*.f6485.8
Applied rewrites85.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6485.8
Applied rewrites85.8%
if -2.19999999999999997e-13 < x < 3.69999999999999984e91Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6493.6
Applied rewrites93.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6493.6
Applied rewrites93.6%
if 3.69999999999999984e91 < x Initial program 99.6%
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.6
Applied rewrites99.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6487.6
Applied rewrites87.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.8e+100) (not (<= a 8.5e+64))) (* 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+100) || !(a <= 8.5e+64)) {
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+100)) .or. (.not. (a <= 8.5d+64))) 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+100) || !(a <= 8.5e+64)) {
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+100) or not (a <= 8.5e+64): 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+100) || !(a <= 8.5e+64)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(Float64(x - y) * 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+100) || ~((a <= 8.5e+64))) 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+100], N[Not[LessEqual[a, 8.5e+64]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+100} \lor \neg \left(a \leq 8.5 \cdot 10^{+64}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\
\end{array}
\end{array}
if a < -3.79999999999999963e100 or 8.4999999999999998e64 < a Initial program 98.7%
Taylor expanded in z around inf
lower-*.f6484.0
Applied rewrites84.0%
if -3.79999999999999963e100 < a < 8.4999999999999998e64Initial program 99.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6487.2
Applied rewrites87.2%
Applied rewrites85.4%
Taylor expanded in a around 0
Applied rewrites75.2%
Final simplification78.0%
(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.4%
Taylor expanded in z around inf
lower-*.f6444.3
Applied rewrites44.3%
Final simplification44.3%
(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 2024364
(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)))