
(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.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.f6499.9
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+197)
(* (- x y) (/ 60.0 z))
(if (or (<= t_1 -1e+23) (not (<= t_1 2e+101)))
(* (- x 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+197) {
tmp = (x - y) * (60.0 / z);
} else if ((t_1 <= -1e+23) || !(t_1 <= 2e+101)) {
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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+197)) then
tmp = (x - y) * (60.0d0 / z)
else if ((t_1 <= (-1d+23)) .or. (.not. (t_1 <= 2d+101))) 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+197) {
tmp = (x - y) * (60.0 / z);
} else if ((t_1 <= -1e+23) || !(t_1 <= 2e+101)) {
tmp = (x - 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+197: tmp = (x - y) * (60.0 / z) elif (t_1 <= -1e+23) or not (t_1 <= 2e+101): tmp = (x - 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+197) tmp = Float64(Float64(x - y) * Float64(60.0 / z)); elseif ((t_1 <= -1e+23) || !(t_1 <= 2e+101)) 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) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+197) tmp = (x - y) * (60.0 / z); elseif ((t_1 <= -1e+23) || ~((t_1 <= 2e+101))) tmp = (x - 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[LessEqual[t$95$1, -5e+197], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, -1e+23], N[Not[LessEqual[t$95$1, 2e+101]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * 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^{+197}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+23} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+101}\right):\\
\;\;\;\;\left(x - y\right) \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)) < -5.00000000000000009e197Initial program 99.9%
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--.f6494.8
Applied rewrites94.8%
Taylor expanded in z around inf
Applied rewrites67.8%
if -5.00000000000000009e197 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.9999999999999992e22 or 2e101 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.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--.f6483.7
Applied rewrites83.7%
Taylor expanded in z around 0
Applied rewrites62.5%
if -9.9999999999999992e22 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e101Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6473.9
Applied rewrites73.9%
Final simplification70.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -2e+234)
(* (- x y) (/ 60.0 z))
(if (<= t_1 -1e+23)
(* (- y) (/ 60.0 (- z t)))
(if (<= t_1 2e+101) (* 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 <= -2e+234) {
tmp = (x - y) * (60.0 / z);
} else if (t_1 <= -1e+23) {
tmp = -y * (60.0 / (z - t));
} else if (t_1 <= 2e+101) {
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 <= (-2d+234)) then
tmp = (x - y) * (60.0d0 / z)
else if (t_1 <= (-1d+23)) then
tmp = -y * (60.0d0 / (z - t))
else if (t_1 <= 2d+101) 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 <= -2e+234) {
tmp = (x - y) * (60.0 / z);
} else if (t_1 <= -1e+23) {
tmp = -y * (60.0 / (z - t));
} else if (t_1 <= 2e+101) {
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 <= -2e+234: tmp = (x - y) * (60.0 / z) elif t_1 <= -1e+23: tmp = -y * (60.0 / (z - t)) elif t_1 <= 2e+101: 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 <= -2e+234) tmp = Float64(Float64(x - y) * Float64(60.0 / z)); elseif (t_1 <= -1e+23) tmp = Float64(Float64(-y) * Float64(60.0 / Float64(z - t))); elseif (t_1 <= 2e+101) 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 <= -2e+234) tmp = (x - y) * (60.0 / z); elseif (t_1 <= -1e+23) tmp = -y * (60.0 / (z - t)); elseif (t_1 <= 2e+101) 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, -2e+234], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e+23], N[((-y) * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+101], 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 -2 \cdot 10^{+234}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+23}:\\
\;\;\;\;\left(-y\right) \cdot \frac{60}{z - t}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+101}:\\
\;\;\;\;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)) < -2.00000000000000004e234Initial program 100.0%
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--.f6494.0
Applied rewrites94.0%
Taylor expanded in z around inf
Applied rewrites67.8%
if -2.00000000000000004e234 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.9999999999999992e22Initial program 99.7%
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--.f6477.2
Applied rewrites77.2%
Taylor expanded in x around 0
Applied rewrites62.3%
if -9.9999999999999992e22 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e101Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6473.9
Applied rewrites73.9%
if 2e101 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.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--.f6494.8
Applied rewrites94.8%
Taylor expanded in z around 0
Applied rewrites70.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -1e-27) (not (<= t_1 1e+29)))
(* (- x y) (/ 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 <= -1e-27) || !(t_1 <= 1e+29)) {
tmp = (x - y) * (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 <= (-1d-27)) .or. (.not. (t_1 <= 1d+29))) then
tmp = (x - y) * (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 <= -1e-27) || !(t_1 <= 1e+29)) {
tmp = (x - y) * (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 <= -1e-27) or not (t_1 <= 1e+29): tmp = (x - y) * (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 <= -1e-27) || !(t_1 <= 1e+29)) tmp = Float64(Float64(x - y) * 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 <= -1e-27) || ~((t_1 <= 1e+29))) tmp = (x - y) * (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, -1e-27], N[Not[LessEqual[t$95$1, 1e+29]], $MachinePrecision]], 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}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-27} \lor \neg \left(t\_1 \leq 10^{+29}\right):\\
\;\;\;\;\left(x - y\right) \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)) < -1e-27 or 9.99999999999999914e28 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.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--.f6479.0
Applied rewrites79.0%
if -1e-27 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999914e28Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6481.1
Applied rewrites81.1%
Final simplification80.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -1e+23) (not (<= t_1 2e+101)))
(* (- x 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 <= -1e+23) || !(t_1 <= 2e+101)) {
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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if ((t_1 <= (-1d+23)) .or. (.not. (t_1 <= 2d+101))) 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -1e+23) || !(t_1 <= 2e+101)) {
tmp = (x - 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 <= -1e+23) or not (t_1 <= 2e+101): tmp = (x - 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 <= -1e+23) || !(t_1 <= 2e+101)) 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) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if ((t_1 <= -1e+23) || ~((t_1 <= 2e+101))) tmp = (x - 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, -1e+23], N[Not[LessEqual[t$95$1, 2e+101]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * 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^{+23} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+101}\right):\\
\;\;\;\;\left(x - y\right) \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.9999999999999992e22 or 2e101 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.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--.f6486.3
Applied rewrites86.3%
Taylor expanded in z around 0
Applied rewrites58.3%
if -9.9999999999999992e22 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e101Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6473.9
Applied rewrites73.9%
Final simplification68.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -1e+23) (not (<= t_1 5e+170)))
(* (- 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 <= -1e+23) || !(t_1 <= 5e+170)) {
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 <= (-1d+23)) .or. (.not. (t_1 <= 5d+170))) 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 <= -1e+23) || !(t_1 <= 5e+170)) {
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 <= -1e+23) or not (t_1 <= 5e+170): 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 <= -1e+23) || !(t_1 <= 5e+170)) tmp = Float64(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 <= -1e+23) || ~((t_1 <= 5e+170))) 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, -1e+23], N[Not[LessEqual[t$95$1, 5e+170]], $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 -1 \cdot 10^{+23} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+170}\right):\\
\;\;\;\;\left(-y\right) \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.9999999999999992e22 or 4.99999999999999977e170 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.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--.f6486.3
Applied rewrites86.3%
Taylor expanded in z around inf
Applied rewrites38.4%
Taylor expanded in x around 0
Applied rewrites16.9%
Taylor expanded in z around 0
Applied rewrites47.1%
if -9.9999999999999992e22 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 4.99999999999999977e170Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6471.7
Applied rewrites71.7%
Final simplification64.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -1e+23) (not (<= t_1 5e+170)))
(* (/ y t) 60.0)
(* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -1e+23) || !(t_1 <= 5e+170)) {
tmp = (y / t) * 60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if ((t_1 <= (-1d+23)) .or. (.not. (t_1 <= 5d+170))) then
tmp = (y / t) * 60.0d0
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -1e+23) || !(t_1 <= 5e+170)) {
tmp = (y / t) * 60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if (t_1 <= -1e+23) or not (t_1 <= 5e+170): tmp = (y / t) * 60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if ((t_1 <= -1e+23) || !(t_1 <= 5e+170)) tmp = Float64(Float64(y / t) * 60.0); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if ((t_1 <= -1e+23) || ~((t_1 <= 5e+170))) tmp = (y / t) * 60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+23], N[Not[LessEqual[t$95$1, 5e+170]], $MachinePrecision]], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+23} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+170}\right):\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.9999999999999992e22 or 4.99999999999999977e170 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6465.1
Applied rewrites65.1%
Taylor expanded in y around inf
Applied rewrites47.0%
if -9.9999999999999992e22 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 4.99999999999999977e170Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6471.7
Applied rewrites71.7%
Final simplification64.5%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (* 60.0 (- x y)) (- z t)) 2e+101) (* 120.0 a) (* x (/ -60.0 t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((60.0 * (x - y)) / (z - t)) <= 2e+101) {
tmp = 120.0 * a;
} else {
tmp = x * (-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 (((60.0d0 * (x - y)) / (z - t)) <= 2d+101) then
tmp = 120.0d0 * a
else
tmp = x * ((-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 (((60.0 * (x - y)) / (z - t)) <= 2e+101) {
tmp = 120.0 * a;
} else {
tmp = x * (-60.0 / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((60.0 * (x - y)) / (z - t)) <= 2e+101: tmp = 120.0 * a else: tmp = x * (-60.0 / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) <= 2e+101) tmp = Float64(120.0 * a); else tmp = Float64(x * Float64(-60.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((60.0 * (x - y)) / (z - t)) <= 2e+101) tmp = 120.0 * a; else tmp = x * (-60.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], 2e+101], N[(120.0 * a), $MachinePrecision], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{60 \cdot \left(x - y\right)}{z - t} \leq 2 \cdot 10^{+101}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e101Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6461.5
Applied rewrites61.5%
if 2e101 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6470.7
Applied rewrites70.7%
Taylor expanded in x around inf
Applied rewrites27.6%
Applied rewrites27.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.7e-49)
(fma a 120.0 (* (/ -60.0 t) (- x y)))
(if (<= t 1.73e-176)
(fma a 120.0 (* (/ 60.0 z) (- x y)))
(if (<= t 3.6e+137)
(fma a 120.0 (/ (* -60.0 y) (- z t)))
(fma (/ (- x y) t) -60.0 (* 120.0 a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.7e-49) {
tmp = fma(a, 120.0, ((-60.0 / t) * (x - y)));
} else if (t <= 1.73e-176) {
tmp = fma(a, 120.0, ((60.0 / z) * (x - y)));
} else if (t <= 3.6e+137) {
tmp = fma(a, 120.0, ((-60.0 * y) / (z - t)));
} else {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.7e-49) tmp = fma(a, 120.0, Float64(Float64(-60.0 / t) * Float64(x - y))); elseif (t <= 1.73e-176) tmp = fma(a, 120.0, Float64(Float64(60.0 / z) * Float64(x - y))); elseif (t <= 3.6e+137) tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / Float64(z - t))); 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[LessEqual[t, -3.7e-49], N[(a * 120.0 + N[(N[(-60.0 / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.73e-176], N[(a * 120.0 + N[(N[(60.0 / z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+137], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $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}\;t \leq -3.7 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60}{t} \cdot \left(x - y\right)\right)\\
\mathbf{elif}\;t \leq 1.73 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{z} \cdot \left(x - y\right)\right)\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\end{array}
\end{array}
if t < -3.7000000000000001e-49Initial program 99.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.f6499.9
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
lower-/.f6487.3
Applied rewrites87.3%
if -3.7000000000000001e-49 < t < 1.73000000000000015e-176Initial program 99.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.f6499.9
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 inf
lower-/.f6489.2
Applied rewrites89.2%
if 1.73000000000000015e-176 < t < 3.6e137Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6492.8
Applied rewrites92.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6492.8
Applied rewrites92.8%
if 3.6e137 < t Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6497.7
Applied rewrites97.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a 120.0 (* (/ -60.0 t) (- x y)))))
(if (<= t -3.7e-49)
t_1
(if (<= t 1.73e-176)
(fma a 120.0 (* (/ 60.0 z) (- x y)))
(if (<= t 7.8e+118) (fma 120.0 a (* (/ y (- z t)) -60.0)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, 120.0, ((-60.0 / t) * (x - y)));
double tmp;
if (t <= -3.7e-49) {
tmp = t_1;
} else if (t <= 1.73e-176) {
tmp = fma(a, 120.0, ((60.0 / z) * (x - y)));
} else if (t <= 7.8e+118) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, 120.0, Float64(Float64(-60.0 / t) * Float64(x - y))) tmp = 0.0 if (t <= -3.7e-49) tmp = t_1; elseif (t <= 1.73e-176) tmp = fma(a, 120.0, Float64(Float64(60.0 / z) * Float64(x - y))); elseif (t <= 7.8e+118) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * 120.0 + N[(N[(-60.0 / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.7e-49], t$95$1, If[LessEqual[t, 1.73e-176], N[(a * 120.0 + N[(N[(60.0 / z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e+118], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, 120, \frac{-60}{t} \cdot \left(x - y\right)\right)\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.73 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{z} \cdot \left(x - y\right)\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.7000000000000001e-49 or 7.8e118 < t Initial program 99.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.f6499.9
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
lower-/.f6491.0
Applied rewrites91.0%
if -3.7000000000000001e-49 < t < 1.73000000000000015e-176Initial program 99.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.f6499.9
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 inf
lower-/.f6489.2
Applied rewrites89.2%
if 1.73000000000000015e-176 < t < 7.8e118Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6492.0
Applied rewrites92.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a 120.0 (* (/ -60.0 t) (- x y)))))
(if (<= t -3.7e-49)
t_1
(if (<= t 1.73e-176)
(fma a 120.0 (* (/ (- x y) z) 60.0))
(if (<= t 7.8e+118) (fma 120.0 a (* (/ y (- z t)) -60.0)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, 120.0, ((-60.0 / t) * (x - y)));
double tmp;
if (t <= -3.7e-49) {
tmp = t_1;
} else if (t <= 1.73e-176) {
tmp = fma(a, 120.0, (((x - y) / z) * 60.0));
} else if (t <= 7.8e+118) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, 120.0, Float64(Float64(-60.0 / t) * Float64(x - y))) tmp = 0.0 if (t <= -3.7e-49) tmp = t_1; elseif (t <= 1.73e-176) tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / z) * 60.0)); elseif (t <= 7.8e+118) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * 120.0 + N[(N[(-60.0 / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.7e-49], t$95$1, If[LessEqual[t, 1.73e-176], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e+118], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, 120, \frac{-60}{t} \cdot \left(x - y\right)\right)\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.73 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{z} \cdot 60\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.7000000000000001e-49 or 7.8e118 < t Initial program 99.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.f6499.9
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
lower-/.f6491.0
Applied rewrites91.0%
if -3.7000000000000001e-49 < t < 1.73000000000000015e-176Initial program 99.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.f6499.9
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 inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6489.1
Applied rewrites89.1%
if 1.73000000000000015e-176 < t < 7.8e118Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6492.0
Applied rewrites92.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) -60.0 (* 120.0 a))))
(if (<= t -3.7e-49)
t_1
(if (<= t 1.73e-176)
(fma a 120.0 (* (/ (- x y) z) 60.0))
(if (<= t 7.8e+118) (fma 120.0 a (* (/ y (- z t)) -60.0)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), -60.0, (120.0 * a));
double tmp;
if (t <= -3.7e-49) {
tmp = t_1;
} else if (t <= 1.73e-176) {
tmp = fma(a, 120.0, (((x - y) / z) * 60.0));
} else if (t <= 7.8e+118) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)) tmp = 0.0 if (t <= -3.7e-49) tmp = t_1; elseif (t <= 1.73e-176) tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / z) * 60.0)); elseif (t <= 7.8e+118) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.7e-49], t$95$1, If[LessEqual[t, 1.73e-176], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e+118], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.73 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{z} \cdot 60\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.7000000000000001e-49 or 7.8e118 < t Initial program 99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6491.0
Applied rewrites91.0%
if -3.7000000000000001e-49 < t < 1.73000000000000015e-176Initial program 99.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.f6499.9
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 inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6489.1
Applied rewrites89.1%
if 1.73000000000000015e-176 < t < 7.8e118Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6492.0
Applied rewrites92.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) -60.0 (* 120.0 a))))
(if (<= t -3.7e-49)
t_1
(if (<= t 1.73e-176)
(fma (/ (- x y) z) 60.0 (* 120.0 a))
(if (<= t 7.8e+118) (fma 120.0 a (* (/ y (- z t)) -60.0)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), -60.0, (120.0 * a));
double tmp;
if (t <= -3.7e-49) {
tmp = t_1;
} else if (t <= 1.73e-176) {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
} else if (t <= 7.8e+118) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)) tmp = 0.0 if (t <= -3.7e-49) tmp = t_1; elseif (t <= 1.73e-176) tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); elseif (t <= 7.8e+118) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.7e-49], t$95$1, If[LessEqual[t, 1.73e-176], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e+118], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.73 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.7000000000000001e-49 or 7.8e118 < t Initial program 99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6491.0
Applied rewrites91.0%
if -3.7000000000000001e-49 < t < 1.73000000000000015e-176Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6489.1
Applied rewrites89.1%
if 1.73000000000000015e-176 < t < 7.8e118Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6492.0
Applied rewrites92.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a 120.0 (* (/ y t) 60.0))))
(if (<= t -4.5e-53)
t_1
(if (<= t -1.05e-169)
(* 120.0 a)
(if (<= t 6e-160) (* (- x y) (/ 60.0 z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, 120.0, ((y / t) * 60.0));
double tmp;
if (t <= -4.5e-53) {
tmp = t_1;
} else if (t <= -1.05e-169) {
tmp = 120.0 * a;
} else if (t <= 6e-160) {
tmp = (x - y) * (60.0 / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, 120.0, Float64(Float64(y / t) * 60.0)) tmp = 0.0 if (t <= -4.5e-53) tmp = t_1; elseif (t <= -1.05e-169) tmp = Float64(120.0 * a); elseif (t <= 6e-160) tmp = Float64(Float64(x - y) * Float64(60.0 / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * 120.0 + N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.5e-53], t$95$1, If[LessEqual[t, -1.05e-169], N[(120.0 * a), $MachinePrecision], If[LessEqual[t, 6e-160], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, 120, \frac{y}{t} \cdot 60\right)\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.05 \cdot 10^{-169}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-160}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.49999999999999985e-53 or 5.99999999999999993e-160 < t Initial program 99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6485.1
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites79.7%
Applied rewrites79.7%
if -4.49999999999999985e-53 < t < -1.05e-169Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6458.8
Applied rewrites58.8%
if -1.05e-169 < t < 5.99999999999999993e-160Initial program 99.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--.f6468.8
Applied rewrites68.8%
Taylor expanded in z around inf
Applied rewrites59.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3.25e+50) (not (<= y 5.9e-31))) (fma a 120.0 (/ (* -60.0 y) (- z t))) (fma a 120.0 (/ (* x 60.0) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.25e+50) || !(y <= 5.9e-31)) {
tmp = fma(a, 120.0, ((-60.0 * y) / (z - t)));
} else {
tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.25e+50) || !(y <= 5.9e-31)) tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / Float64(z - t))); else tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.25e+50], N[Not[LessEqual[y, 5.9e-31]], $MachinePrecision]], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+50} \lor \neg \left(y \leq 5.9 \cdot 10^{-31}\right):\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
\end{array}
\end{array}
if y < -3.2500000000000001e50 or 5.90000000000000032e-31 < y Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6491.6
Applied rewrites91.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6491.6
Applied rewrites91.6%
if -3.2500000000000001e50 < y < 5.90000000000000032e-31Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6468.6
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6
Applied rewrites68.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6495.5
Applied rewrites95.5%
Final simplification93.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9.6e-102) (not (<= a 1.65e-202))) (fma 120.0 a (* (/ y (- z t)) -60.0)) (* (- x y) (/ 60.0 (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.6e-102) || !(a <= 1.65e-202)) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = (x - y) * (60.0 / (z - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9.6e-102) || !(a <= 1.65e-202)) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9.6e-102], N[Not[LessEqual[a, 1.65e-202]], $MachinePrecision]], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $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 -9.6 \cdot 10^{-102} \lor \neg \left(a \leq 1.65 \cdot 10^{-202}\right):\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if a < -9.6e-102 or 1.64999999999999995e-202 < a Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6488.5
Applied rewrites88.5%
if -9.6e-102 < a < 1.64999999999999995e-202Initial program 99.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--.f6487.3
Applied rewrites87.3%
Final simplification88.2%
(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.9%
Taylor expanded in z around inf
lower-*.f6455.6
Applied rewrites55.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 2024354
(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)))