
(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}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
(FPCore (x y z t a) :precision binary64 (fma a 120.0 (/ (* (- x y) 60.0) (- z t))))
double code(double x, double y, double z, double t, double a) {
return fma(a, 120.0, (((x - y) * 60.0) / (z - t)));
}
function code(x, y, z, t, a) return fma(a, 120.0, Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \frac{\left(x - y\right) \cdot 60}{z - t}\right)
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.4
Applied rewrites99.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.85e-28)
(fma (/ (- x y) z) 60.0 (* 120.0 a))
(if (<= z 8.6e-51)
(fma (/ (- x y) t) -60.0 (* 120.0 a))
(fma a 120.0 (/ (* (- x y) 60.0) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.85e-28) {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
} else if (z <= 8.6e-51) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, (((x - y) * 60.0) / z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.85e-28) tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); elseif (z <= 8.6e-51) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) * 60.0) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.85e-28], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e-51], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.85 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{\left(x - y\right) \cdot 60}{z}\right)\\
\end{array}
\end{array}
if z < -3.85e-28Initial program 99.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
if -3.85e-28 < z < 8.5999999999999995e-51Initial program 99.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6483.7
Applied rewrites83.7%
if 8.5999999999999995e-51 < z Initial program 99.3%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.3
Applied rewrites99.3%
Taylor expanded in z around inf
Applied rewrites82.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) z) 60.0 (* 120.0 a))))
(if (<= z -3.85e-28)
t_1
(if (<= z 8.6e-51) (fma (/ (- x y) t) -60.0 (* 120.0 a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / z), 60.0, (120.0 * a));
double tmp;
if (z <= -3.85e-28) {
tmp = t_1;
} else if (z <= 8.6e-51) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)) tmp = 0.0 if (z <= -3.85e-28) tmp = t_1; elseif (z <= 8.6e-51) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.85e-28], t$95$1, If[LessEqual[z, 8.6e-51], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\mathbf{if}\;z \leq -3.85 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.85e-28 or 8.5999999999999995e-51 < z Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6483.7
Applied rewrites83.7%
if -3.85e-28 < z < 8.5999999999999995e-51Initial program 99.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6483.7
Applied rewrites83.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a 120.0 (/ (* -60.0 y) z))))
(if (<= z -0.00136)
t_1
(if (<= z 470000.0) (fma (/ (- x y) t) -60.0 (* 120.0 a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, 120.0, ((-60.0 * y) / z));
double tmp;
if (z <= -0.00136) {
tmp = t_1;
} else if (z <= 470000.0) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, 120.0, Float64(Float64(-60.0 * y) / z)) tmp = 0.0 if (z <= -0.00136) tmp = t_1; elseif (z <= 470000.0) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.00136], t$95$1, If[LessEqual[z, 470000.0], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z}\right)\\
\mathbf{if}\;z \leq -0.00136:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 470000:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.00136 or 4.7e5 < z Initial program 99.4%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6480.6
Applied rewrites80.6%
Taylor expanded in z around inf
Applied rewrites73.3%
if -0.00136 < z < 4.7e5Initial program 99.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6480.8
Applied rewrites80.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -7.2e-73) (* 120.0 a) (if (<= a 3.7e+76) (* (- x y) (/ 60.0 (- z t))) (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7.2e-73) {
tmp = 120.0 * a;
} else if (a <= 3.7e+76) {
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) :: tmp
if (a <= (-7.2d-73)) then
tmp = 120.0d0 * a
else if (a <= 3.7d+76) 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 tmp;
if (a <= -7.2e-73) {
tmp = 120.0 * a;
} else if (a <= 3.7e+76) {
tmp = (x - y) * (60.0 / (z - t));
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7.2e-73: tmp = 120.0 * a elif a <= 3.7e+76: tmp = (x - y) * (60.0 / (z - t)) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7.2e-73) tmp = Float64(120.0 * a); elseif (a <= 3.7e+76) 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) tmp = 0.0; if (a <= -7.2e-73) tmp = 120.0 * a; elseif (a <= 3.7e+76) tmp = (x - y) * (60.0 / (z - t)); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7.2e-73], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 3.7e+76], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.2 \cdot 10^{-73}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{+76}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -7.1999999999999999e-73 or 3.6999999999999999e76 < a Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6473.2
Applied rewrites73.2%
if -7.1999999999999999e-73 < a < 3.6999999999999999e76Initial program 99.4%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in a around 0
*-commutativeN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f64N/A
lift--.f6474.1
Applied rewrites74.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a 120.0 (* (/ x t) -60.0))))
(if (<= t -42000.0)
t_1
(if (<= t 1e-82) (fma a 120.0 (/ (* -60.0 y) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, 120.0, ((x / t) * -60.0));
double tmp;
if (t <= -42000.0) {
tmp = t_1;
} else if (t <= 1e-82) {
tmp = fma(a, 120.0, ((-60.0 * y) / z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, 120.0, Float64(Float64(x / t) * -60.0)) tmp = 0.0 if (t <= -42000.0) tmp = t_1; elseif (t <= 1e-82) tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / 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[(x / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -42000.0], t$95$1, If[LessEqual[t, 1e-82], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, 120, \frac{x}{t} \cdot -60\right)\\
\mathbf{if}\;t \leq -42000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 10^{-82}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -42000 or 1e-82 < t Initial program 99.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6484.4
Applied rewrites84.4%
Taylor expanded in x around inf
Applied rewrites71.0%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6471.0
Applied rewrites71.0%
if -42000 < t < 1e-82Initial program 99.5%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
Taylor expanded in z around inf
Applied rewrites60.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))) (t_2 (* (/ x (- z t)) 60.0)))
(if (<= t_1 -2e+68)
(* (/ y (- z t)) -60.0)
(if (<= t_1 -1e+23)
t_2
(if (<= t_1 1e+127)
(* 120.0 a)
(if (<= t_1 1e+225) t_2 (* (/ (- x y) t) -60.0)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double t_2 = (x / (z - t)) * 60.0;
double tmp;
if (t_1 <= -2e+68) {
tmp = (y / (z - t)) * -60.0;
} else if (t_1 <= -1e+23) {
tmp = t_2;
} else if (t_1 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_1 <= 1e+225) {
tmp = t_2;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
t_2 = (x / (z - t)) * 60.0d0
if (t_1 <= (-2d+68)) then
tmp = (y / (z - t)) * (-60.0d0)
else if (t_1 <= (-1d+23)) then
tmp = t_2
else if (t_1 <= 1d+127) then
tmp = 120.0d0 * a
else if (t_1 <= 1d+225) then
tmp = t_2
else
tmp = ((x - y) / t) * (-60.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double t_2 = (x / (z - t)) * 60.0;
double tmp;
if (t_1 <= -2e+68) {
tmp = (y / (z - t)) * -60.0;
} else if (t_1 <= -1e+23) {
tmp = t_2;
} else if (t_1 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_1 <= 1e+225) {
tmp = t_2;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) t_2 = (x / (z - t)) * 60.0 tmp = 0 if t_1 <= -2e+68: tmp = (y / (z - t)) * -60.0 elif t_1 <= -1e+23: tmp = t_2 elif t_1 <= 1e+127: tmp = 120.0 * a elif t_1 <= 1e+225: tmp = t_2 else: tmp = ((x - y) / t) * -60.0 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) t_2 = Float64(Float64(x / Float64(z - t)) * 60.0) tmp = 0.0 if (t_1 <= -2e+68) tmp = Float64(Float64(y / Float64(z - t)) * -60.0); elseif (t_1 <= -1e+23) tmp = t_2; elseif (t_1 <= 1e+127) tmp = Float64(120.0 * a); elseif (t_1 <= 1e+225) tmp = t_2; else tmp = Float64(Float64(Float64(x - y) / t) * -60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); t_2 = (x / (z - t)) * 60.0; tmp = 0.0; if (t_1 <= -2e+68) tmp = (y / (z - t)) * -60.0; elseif (t_1 <= -1e+23) tmp = t_2; elseif (t_1 <= 1e+127) tmp = 120.0 * a; elseif (t_1 <= 1e+225) tmp = t_2; else tmp = ((x - y) / t) * -60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+68], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[t$95$1, -1e+23], t$95$2, If[LessEqual[t$95$1, 1e+127], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$1, 1e+225], t$95$2, N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
t_2 := \frac{x}{z - t} \cdot 60\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+68}:\\
\;\;\;\;\frac{y}{z - t} \cdot -60\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+23}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+127}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_1 \leq 10^{+225}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -1.99999999999999991e68Initial program 98.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6441.6
Applied rewrites41.6%
if -1.99999999999999991e68 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.9999999999999992e22 or 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999928e224Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6436.5
Applied rewrites36.5%
if -9.9999999999999992e22 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999955e126Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6467.9
Applied rewrites67.9%
if 9.99999999999999928e224 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6458.8
Applied rewrites58.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -0.05)
(fma a 120.0 (* (/ x t) -60.0))
(if (<= t_1 1e+127)
(* 120.0 a)
(if (<= t_1 1e+225) (* (/ x (- z t)) 60.0) (* (/ (- x y) t) -60.0))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -0.05) {
tmp = fma(a, 120.0, ((x / t) * -60.0));
} else if (t_1 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_1 <= 1e+225) {
tmp = (x / (z - t)) * 60.0;
} else {
tmp = ((x - y) / t) * -60.0;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_1 <= -0.05) tmp = fma(a, 120.0, Float64(Float64(x / t) * -60.0)); elseif (t_1 <= 1e+127) tmp = Float64(120.0 * a); elseif (t_1 <= 1e+225) tmp = Float64(Float64(x / Float64(z - t)) * 60.0); else tmp = Float64(Float64(Float64(x - y) / t) * -60.0); end return 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, -0.05], N[(a * 120.0 + N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+127], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$1, 1e+225], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x}{t} \cdot -60\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+127}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_1 \leq 10^{+225}:\\
\;\;\;\;\frac{x}{z - t} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -0.050000000000000003Initial program 98.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.8
Applied rewrites57.8%
Taylor expanded in x around inf
Applied rewrites42.3%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
if -0.050000000000000003 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999955e126Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6468.7
Applied rewrites68.7%
if 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999928e224Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6438.7
Applied rewrites38.7%
if 9.99999999999999928e224 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6458.8
Applied rewrites58.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x y) t) -60.0)) (t_2 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_2 -2e+17)
t_1
(if (<= t_2 1e+127)
(* 120.0 a)
(if (<= t_2 1e+225) (* (/ x (- z t)) 60.0) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / t) * -60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -2e+17) {
tmp = t_1;
} else if (t_2 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_2 <= 1e+225) {
tmp = (x / (z - t)) * 60.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((x - y) / t) * (-60.0d0)
t_2 = (60.0d0 * (x - y)) / (z - t)
if (t_2 <= (-2d+17)) then
tmp = t_1
else if (t_2 <= 1d+127) then
tmp = 120.0d0 * a
else if (t_2 <= 1d+225) then
tmp = (x / (z - t)) * 60.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / t) * -60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -2e+17) {
tmp = t_1;
} else if (t_2 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_2 <= 1e+225) {
tmp = (x / (z - t)) * 60.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((x - y) / t) * -60.0 t_2 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_2 <= -2e+17: tmp = t_1 elif t_2 <= 1e+127: tmp = 120.0 * a elif t_2 <= 1e+225: tmp = (x / (z - t)) * 60.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / t) * -60.0) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -2e+17) tmp = t_1; elseif (t_2 <= 1e+127) tmp = Float64(120.0 * a); elseif (t_2 <= 1e+225) tmp = Float64(Float64(x / Float64(z - t)) * 60.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((x - y) / t) * -60.0; t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -2e+17) tmp = t_1; elseif (t_2 <= 1e+127) tmp = 120.0 * a; elseif (t_2 <= 1e+225) tmp = (x / (z - t)) * 60.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+17], t$95$1, If[LessEqual[t$95$2, 1e+127], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$2, 1e+225], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{t} \cdot -60\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+127}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_2 \leq 10^{+225}:\\
\;\;\;\;\frac{x}{z - t} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -2e17 or 9.99999999999999928e224 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6446.4
Applied rewrites46.4%
if -2e17 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999955e126Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6468.1
Applied rewrites68.1%
if 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999928e224Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6438.7
Applied rewrites38.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.55e-78) (* 120.0 a) (if (<= a 2.15e-30) (* (/ (- x y) t) -60.0) (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.55e-78) {
tmp = 120.0 * a;
} else if (a <= 2.15e-30) {
tmp = ((x - 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) :: tmp
if (a <= (-1.55d-78)) then
tmp = 120.0d0 * a
else if (a <= 2.15d-30) then
tmp = ((x - 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 tmp;
if (a <= -1.55e-78) {
tmp = 120.0 * a;
} else if (a <= 2.15e-30) {
tmp = ((x - y) / t) * -60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.55e-78: tmp = 120.0 * a elif a <= 2.15e-30: tmp = ((x - y) / t) * -60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.55e-78) tmp = Float64(120.0 * a); elseif (a <= 2.15e-30) tmp = Float64(Float64(Float64(x - y) / t) * -60.0); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.55e-78) tmp = 120.0 * a; elseif (a <= 2.15e-30) tmp = ((x - y) / t) * -60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.55e-78], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 2.15e-30], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{-78}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 2.15 \cdot 10^{-30}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -1.55000000000000009e-78 or 2.14999999999999983e-30 < a Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6470.2
Applied rewrites70.2%
if -1.55000000000000009e-78 < a < 2.14999999999999983e-30Initial program 99.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6455.2
Applied rewrites55.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6443.1
Applied rewrites43.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -1e+260)
(* (/ y t) 60.0)
(if (<= t_1 1e+127)
(* 120.0 a)
(if (<= t_1 1e+231) (* (/ x z) 60.0) (/ (* x -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 <= -1e+260) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_1 <= 1e+231) {
tmp = (x / z) * 60.0;
} 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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-1d+260)) then
tmp = (y / t) * 60.0d0
else if (t_1 <= 1d+127) then
tmp = 120.0d0 * a
else if (t_1 <= 1d+231) then
tmp = (x / z) * 60.0d0
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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -1e+260) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 1e+127) {
tmp = 120.0 * a;
} else if (t_1 <= 1e+231) {
tmp = (x / z) * 60.0;
} else {
tmp = (x * -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 <= -1e+260: tmp = (y / t) * 60.0 elif t_1 <= 1e+127: tmp = 120.0 * a elif t_1 <= 1e+231: tmp = (x / z) * 60.0 else: tmp = (x * -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 <= -1e+260) tmp = Float64(Float64(y / t) * 60.0); elseif (t_1 <= 1e+127) tmp = Float64(120.0 * a); elseif (t_1 <= 1e+231) tmp = Float64(Float64(x / z) * 60.0); else tmp = Float64(Float64(x * -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 <= -1e+260) tmp = (y / t) * 60.0; elseif (t_1 <= 1e+127) tmp = 120.0 * a; elseif (t_1 <= 1e+231) tmp = (x / z) * 60.0; else tmp = (x * -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, -1e+260], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+127], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$1, 1e+231], N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision], N[(N[(x * -60.0), $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^{+260}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\mathbf{elif}\;t\_1 \leq 10^{+127}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_1 \leq 10^{+231}:\\
\;\;\;\;\frac{x}{z} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot -60}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -1.00000000000000007e260Initial program 95.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6468.1
Applied rewrites68.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.3
Applied rewrites37.3%
if -1.00000000000000007e260 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999955e126Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6460.2
Applied rewrites60.2%
if 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.0000000000000001e231Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6438.9
Applied rewrites38.9%
Taylor expanded in z around inf
Applied rewrites21.6%
if 1.0000000000000001e231 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6462.3
Applied rewrites62.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6435.6
Applied rewrites35.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -1e+260)
(* (/ y t) 60.0)
(if (<= t_1 1e+127) (* 120.0 a) (/ (* x -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 <= -1e+260) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 1e+127) {
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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-1d+260)) then
tmp = (y / t) * 60.0d0
else if (t_1 <= 1d+127) 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -1e+260) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 1e+127) {
tmp = 120.0 * a;
} else {
tmp = (x * -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 <= -1e+260: tmp = (y / t) * 60.0 elif t_1 <= 1e+127: tmp = 120.0 * a else: tmp = (x * -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 <= -1e+260) tmp = Float64(Float64(y / t) * 60.0); elseif (t_1 <= 1e+127) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x * -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 <= -1e+260) tmp = (y / t) * 60.0; elseif (t_1 <= 1e+127) tmp = 120.0 * a; else tmp = (x * -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, -1e+260], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+127], N[(120.0 * a), $MachinePrecision], N[(N[(x * -60.0), $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^{+260}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\mathbf{elif}\;t\_1 \leq 10^{+127}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot -60}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -1.00000000000000007e260Initial program 95.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6468.1
Applied rewrites68.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.3
Applied rewrites37.3%
if -1.00000000000000007e260 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999955e126Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6460.2
Applied rewrites60.2%
if 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.0
Applied rewrites28.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6427.8
Applied rewrites27.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -1e+260)
(* (/ y t) 60.0)
(if (<= t_1 1e+127) (* 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+260) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 1e+127) {
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+260)) then
tmp = (y / t) * 60.0d0
else if (t_1 <= 1d+127) 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+260) {
tmp = (y / t) * 60.0;
} else if (t_1 <= 1e+127) {
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+260: tmp = (y / t) * 60.0 elif t_1 <= 1e+127: 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+260) tmp = Float64(Float64(y / t) * 60.0); elseif (t_1 <= 1e+127) 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+260) tmp = (y / t) * 60.0; elseif (t_1 <= 1e+127) 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+260], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+127], 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^{+260}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\mathbf{elif}\;t\_1 \leq 10^{+127}:\\
\;\;\;\;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)) < -1.00000000000000007e260Initial program 95.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6468.1
Applied rewrites68.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.3
Applied rewrites37.3%
if -1.00000000000000007e260 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999955e126Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6460.2
Applied rewrites60.2%
if 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.0
Applied rewrites28.0%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (* 60.0 (- x y)) (- z t)) 1e+127) (* 120.0 a) (* (/ x t) -60.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((60.0 * (x - y)) / (z - t)) <= 1e+127) {
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) :: tmp
if (((60.0d0 * (x - y)) / (z - t)) <= 1d+127) 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 tmp;
if (((60.0 * (x - y)) / (z - t)) <= 1e+127) {
tmp = 120.0 * a;
} else {
tmp = (x / t) * -60.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((60.0 * (x - y)) / (z - t)) <= 1e+127: tmp = 120.0 * a else: tmp = (x / t) * -60.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) <= 1e+127) 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) tmp = 0.0; if (((60.0 * (x - y)) / (z - t)) <= 1e+127) tmp = 120.0 * a; else tmp = (x / t) * -60.0; 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], 1e+127], N[(120.0 * a), $MachinePrecision], N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{60 \cdot \left(x - y\right)}{z - t} \leq 10^{+127}:\\
\;\;\;\;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.99999999999999955e126Initial program 99.5%
Taylor expanded in z around inf
lower-*.f6456.5
Applied rewrites56.5%
if 9.99999999999999955e126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.0
Applied rewrites28.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-*.f6450.6
Applied rewrites50.6%
herbie shell --seed 2025112
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
(+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))