
(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
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.4
Applied rewrites99.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x y) z) 60.0)) (t_2 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_2 -5e+125)
t_1
(if (<= t_2 -5e-126)
(fma (/ y z) -60.0 (* 120.0 a))
(if (<= t_2 2e+23)
(* 120.0 a)
(if (<= t_2 5e+103) (* (/ (- x y) t) -60.0) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / z) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5e+125) {
tmp = t_1;
} else if (t_2 <= -5e-126) {
tmp = fma((y / z), -60.0, (120.0 * a));
} else if (t_2 <= 2e+23) {
tmp = 120.0 * a;
} else if (t_2 <= 5e+103) {
tmp = ((x - y) / t) * -60.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / z) * 60.0) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -5e+125) tmp = t_1; elseif (t_2 <= -5e-126) tmp = fma(Float64(y / z), -60.0, Float64(120.0 * a)); elseif (t_2 <= 2e+23) tmp = Float64(120.0 * a); elseif (t_2 <= 5e+103) tmp = Float64(Float64(Float64(x - y) / 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] / z), $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, -5e+125], t$95$1, If[LessEqual[t$95$2, -5e-126], N[(N[(y / z), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+23], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$2, 5e+103], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z} \cdot 60\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-126}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -60, 120 \cdot a\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+103}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.99999999999999962e125 or 5e103 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.3%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6484.7
Applied rewrites84.7%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6449.2
Applied rewrites49.2%
if -4.99999999999999962e125 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.00000000000000006e-126Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6458.4
Applied rewrites58.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6452.5
Applied rewrites52.5%
if -5.00000000000000006e-126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6477.3
Applied rewrites77.3%
if 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5e103Initial program 99.7%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6458.5
Applied rewrites58.5%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.0
Applied rewrites28.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -200000000000.0)
(/ (* (- x y) 60.0) (- z t))
(if (<= t_1 -5e-126)
(fma a 120.0 (/ (* -60.0 y) z))
(if (<= t_1 2e+23) (* 120.0 a) (* (- x y) (/ 60.0 (- z 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 <= -200000000000.0) {
tmp = ((x - y) * 60.0) / (z - t);
} else if (t_1 <= -5e-126) {
tmp = fma(a, 120.0, ((-60.0 * y) / z));
} else if (t_1 <= 2e+23) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (60.0 / (z - 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 <= -200000000000.0) tmp = Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t)); elseif (t_1 <= -5e-126) tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / z)); elseif (t_1 <= 2e+23) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); 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, -200000000000.0], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-126], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+23], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -200000000000:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-126}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -2e11Initial program 98.9%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6475.4
Applied rewrites75.4%
if -2e11 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.00000000000000006e-126Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6479.8
Applied rewrites79.8%
Taylor expanded in z around inf
Applied rewrites57.5%
if -5.00000000000000006e-126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6477.3
Applied rewrites77.3%
if 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.7%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6475.6
Applied rewrites75.6%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/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
lower-/.f64N/A
lift--.f6476.3
Applied rewrites76.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -200000000000.0)
(/ (* (- x y) 60.0) (- z t))
(if (<= t_1 -5e-126)
(fma (/ y z) -60.0 (* 120.0 a))
(if (<= t_1 2e+23) (* 120.0 a) (* (- x y) (/ 60.0 (- z 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 <= -200000000000.0) {
tmp = ((x - y) * 60.0) / (z - t);
} else if (t_1 <= -5e-126) {
tmp = fma((y / z), -60.0, (120.0 * a));
} else if (t_1 <= 2e+23) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (60.0 / (z - 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 <= -200000000000.0) tmp = Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t)); elseif (t_1 <= -5e-126) tmp = fma(Float64(y / z), -60.0, Float64(120.0 * a)); elseif (t_1 <= 2e+23) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); 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, -200000000000.0], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-126], N[(N[(y / z), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+23], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -200000000000:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-126}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -60, 120 \cdot a\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -2e11Initial program 98.9%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6475.4
Applied rewrites75.4%
if -2e11 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.00000000000000006e-126Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6457.4
Applied rewrites57.4%
if -5.00000000000000006e-126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6477.3
Applied rewrites77.3%
if 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.7%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6475.6
Applied rewrites75.6%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/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
lower-/.f64N/A
lift--.f6476.3
Applied rewrites76.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- x y) (/ 60.0 (- z t)))) (t_2 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_2 -200000000000.0)
t_1
(if (<= t_2 -5e-126)
(fma (/ y z) -60.0 (* 120.0 a))
(if (<= t_2 2e+23) (* 120.0 a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - y) * (60.0 / (z - t));
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -200000000000.0) {
tmp = t_1;
} else if (t_2 <= -5e-126) {
tmp = fma((y / z), -60.0, (120.0 * a));
} else if (t_2 <= 2e+23) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -200000000000.0) tmp = t_1; elseif (t_2 <= -5e-126) tmp = fma(Float64(y / z), -60.0, Float64(120.0 * a)); elseif (t_2 <= 2e+23) tmp = Float64(120.0 * a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -200000000000.0], t$95$1, If[LessEqual[t$95$2, -5e-126], N[(N[(y / z), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+23], N[(120.0 * a), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - y\right) \cdot \frac{60}{z - t}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -200000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-126}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -60, 120 \cdot a\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -2e11 or 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.8%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6475.5
Applied rewrites75.5%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/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
lower-/.f64N/A
lift--.f6476.0
Applied rewrites76.0%
if -2e11 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.00000000000000006e-126Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6457.4
Applied rewrites57.4%
if -5.00000000000000006e-126 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6477.3
Applied rewrites77.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x y) z) 60.0)) (t_2 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_2 -5.5e+111)
t_1
(if (<= t_2 2e+23)
(* 120.0 a)
(if (<= t_2 5e+103) (* (/ (- x y) t) -60.0) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - y) / z) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5.5e+111) {
tmp = t_1;
} else if (t_2 <= 2e+23) {
tmp = 120.0 * a;
} else if (t_2 <= 5e+103) {
tmp = ((x - y) / 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) / z) * 60.0d0
t_2 = (60.0d0 * (x - y)) / (z - t)
if (t_2 <= (-5.5d+111)) then
tmp = t_1
else if (t_2 <= 2d+23) then
tmp = 120.0d0 * a
else if (t_2 <= 5d+103) then
tmp = ((x - y) / 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) / z) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5.5e+111) {
tmp = t_1;
} else if (t_2 <= 2e+23) {
tmp = 120.0 * a;
} else if (t_2 <= 5e+103) {
tmp = ((x - y) / t) * -60.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((x - y) / z) * 60.0 t_2 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_2 <= -5.5e+111: tmp = t_1 elif t_2 <= 2e+23: tmp = 120.0 * a elif t_2 <= 5e+103: tmp = ((x - y) / t) * -60.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - y) / z) * 60.0) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -5.5e+111) tmp = t_1; elseif (t_2 <= 2e+23) tmp = Float64(120.0 * a); elseif (t_2 <= 5e+103) tmp = Float64(Float64(Float64(x - y) / t) * -60.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((x - y) / z) * 60.0; t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -5.5e+111) tmp = t_1; elseif (t_2 <= 2e+23) tmp = 120.0 * a; elseif (t_2 <= 5e+103) tmp = ((x - y) / 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] / z), $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, -5.5e+111], t$95$1, If[LessEqual[t$95$2, 2e+23], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$2, 5e+103], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z} \cdot 60\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -5.5 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+103}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.4999999999999998e111 or 5e103 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.4%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6484.0
Applied rewrites84.0%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6448.6
Applied rewrites48.6%
if -5.4999999999999998e111 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6468.4
Applied rewrites68.4%
if 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5e103Initial program 99.7%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6458.5
Applied rewrites58.5%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6428.0
Applied rewrites28.0%
(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 -5.5e+111)
t_1
(if (<= t_2 2e+23)
(* 120.0 a)
(if (<= t_2 5e+103) t_1 (/ (* x 60.0) z))))))
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 <= -5.5e+111) {
tmp = t_1;
} else if (t_2 <= 2e+23) {
tmp = 120.0 * a;
} else if (t_2 <= 5e+103) {
tmp = t_1;
} else {
tmp = (x * 60.0) / z;
}
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 <= (-5.5d+111)) then
tmp = t_1
else if (t_2 <= 2d+23) then
tmp = 120.0d0 * a
else if (t_2 <= 5d+103) then
tmp = t_1
else
tmp = (x * 60.0d0) / z
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 <= -5.5e+111) {
tmp = t_1;
} else if (t_2 <= 2e+23) {
tmp = 120.0 * a;
} else if (t_2 <= 5e+103) {
tmp = t_1;
} else {
tmp = (x * 60.0) / z;
}
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 <= -5.5e+111: tmp = t_1 elif t_2 <= 2e+23: tmp = 120.0 * a elif t_2 <= 5e+103: tmp = t_1 else: tmp = (x * 60.0) / z 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 <= -5.5e+111) tmp = t_1; elseif (t_2 <= 2e+23) tmp = Float64(120.0 * a); elseif (t_2 <= 5e+103) tmp = t_1; else tmp = Float64(Float64(x * 60.0) / z); 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 <= -5.5e+111) tmp = t_1; elseif (t_2 <= 2e+23) tmp = 120.0 * a; elseif (t_2 <= 5e+103) tmp = t_1; else tmp = (x * 60.0) / z; 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, -5.5e+111], t$95$1, If[LessEqual[t$95$2, 2e+23], N[(120.0 * a), $MachinePrecision], If[LessEqual[t$95$2, 5e+103], t$95$1, N[(N[(x * 60.0), $MachinePrecision] / z), $MachinePrecision]]]]]]
\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 -5.5 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 60}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.4999999999999998e111 or 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5e103Initial program 98.8%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6476.6
Applied rewrites76.6%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6443.4
Applied rewrites43.4%
if -5.4999999999999998e111 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6468.4
Applied rewrites68.4%
if 5e103 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.8
Applied rewrites57.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6426.5
Applied rewrites26.5%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.1
Applied rewrites26.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 (- INFINITY))
(* (/ x z) 60.0)
(if (<= t_1 -5.5e+111)
(* (/ y z) -60.0)
(if (<= t_1 1e+90) (* 120.0 a) (/ (* x 60.0) z))))))
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 <= -((double) INFINITY)) {
tmp = (x / z) * 60.0;
} else if (t_1 <= -5.5e+111) {
tmp = (y / z) * -60.0;
} else if (t_1 <= 1e+90) {
tmp = 120.0 * a;
} else {
tmp = (x * 60.0) / z;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = (x / z) * 60.0;
} else if (t_1 <= -5.5e+111) {
tmp = (y / z) * -60.0;
} else if (t_1 <= 1e+90) {
tmp = 120.0 * a;
} else {
tmp = (x * 60.0) / z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -math.inf: tmp = (x / z) * 60.0 elif t_1 <= -5.5e+111: tmp = (y / z) * -60.0 elif t_1 <= 1e+90: tmp = 120.0 * a else: tmp = (x * 60.0) / z 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 <= Float64(-Inf)) tmp = Float64(Float64(x / z) * 60.0); elseif (t_1 <= -5.5e+111) tmp = Float64(Float64(y / z) * -60.0); elseif (t_1 <= 1e+90) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x * 60.0) / z); 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 <= -Inf) tmp = (x / z) * 60.0; elseif (t_1 <= -5.5e+111) tmp = (y / z) * -60.0; elseif (t_1 <= 1e+90) tmp = 120.0 * a; else tmp = (x * 60.0) / z; 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, (-Infinity)], N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, -5.5e+111], N[(N[(y / z), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+90], N[(120.0 * a), $MachinePrecision], N[(N[(x * 60.0), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x}{z} \cdot 60\\
\mathbf{elif}\;t\_1 \leq -5.5 \cdot 10^{+111}:\\
\;\;\;\;\frac{y}{z} \cdot -60\\
\mathbf{elif}\;t\_1 \leq 10^{+90}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 60}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -inf.0Initial program 95.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6474.2
Applied rewrites74.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6442.3
Applied rewrites42.3%
if -inf.0 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.4999999999999998e111Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6422.4
Applied rewrites22.4%
if -5.4999999999999998e111 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999966e89Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6466.2
Applied rewrites66.2%
if 9.99999999999999966e89 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.7
Applied rewrites57.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6426.0
Applied rewrites26.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.6
Applied rewrites25.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ x z) 60.0)) (t_2 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -5.5e+111)
(* (/ y z) -60.0)
(if (<= t_2 1e+90) (* 120.0 a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x / z) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -5.5e+111) {
tmp = (y / z) * -60.0;
} else if (t_2 <= 1e+90) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x / z) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -5.5e+111) {
tmp = (y / z) * -60.0;
} else if (t_2 <= 1e+90) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x / z) * 60.0 t_2 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -5.5e+111: tmp = (y / z) * -60.0 elif t_2 <= 1e+90: tmp = 120.0 * a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x / z) * 60.0) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -5.5e+111) tmp = Float64(Float64(y / z) * -60.0); elseif (t_2 <= 1e+90) tmp = Float64(120.0 * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x / z) * 60.0; t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -5.5e+111) tmp = (y / z) * -60.0; elseif (t_2 <= 1e+90) tmp = 120.0 * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / z), $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, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -5.5e+111], N[(N[(y / z), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[t$95$2, 1e+90], N[(120.0 * a), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot 60\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5.5 \cdot 10^{+111}:\\
\;\;\;\;\frac{y}{z} \cdot -60\\
\mathbf{elif}\;t\_2 \leq 10^{+90}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -inf.0 or 9.99999999999999966e89 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6429.2
Applied rewrites29.2%
if -inf.0 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.4999999999999998e111Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6422.4
Applied rewrites22.4%
if -5.4999999999999998e111 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999966e89Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6466.2
Applied rewrites66.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- x y) (/ 60.0 (- z t)))) (t_2 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_2 -5.5e+111)
t_1
(if (<= t_2 2e+23) (fma (/ x (- z t)) 60.0 (* 120.0 a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - y) * (60.0 / (z - t));
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5.5e+111) {
tmp = t_1;
} else if (t_2 <= 2e+23) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -5.5e+111) tmp = t_1; elseif (t_2 <= 2e+23) tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5.5e+111], t$95$1, If[LessEqual[t$95$2, 2e+23], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - y\right) \cdot \frac{60}{z - t}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -5.5 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.4999999999999998e111 or 1.9999999999999998e23 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.6%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6479.3
Applied rewrites79.3%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/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
lower-/.f64N/A
lift--.f6480.0
Applied rewrites80.0%
if -5.4999999999999998e111 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.9999999999999998e23Initial program 99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+125)
(* (/ x t) -60.0)
(if (<= t_1 1e+90) (* 120.0 a) (* (/ x z) 60.0)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+125) {
tmp = (x / t) * -60.0;
} else if (t_1 <= 1e+90) {
tmp = 120.0 * a;
} else {
tmp = (x / z) * 60.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+125)) then
tmp = (x / t) * (-60.0d0)
else if (t_1 <= 1d+90) then
tmp = 120.0d0 * a
else
tmp = (x / z) * 60.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+125) {
tmp = (x / t) * -60.0;
} else if (t_1 <= 1e+90) {
tmp = 120.0 * a;
} else {
tmp = (x / z) * 60.0;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -5e+125: tmp = (x / t) * -60.0 elif t_1 <= 1e+90: tmp = 120.0 * a else: tmp = (x / z) * 60.0 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+125) tmp = Float64(Float64(x / t) * -60.0); elseif (t_1 <= 1e+90) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x / z) * 60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+125) tmp = (x / t) * -60.0; elseif (t_1 <= 1e+90) tmp = 120.0 * a; else tmp = (x / z) * 60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+125], N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+90], N[(120.0 * a), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+125}:\\
\;\;\;\;\frac{x}{t} \cdot -60\\
\mathbf{elif}\;t\_1 \leq 10^{+90}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot 60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.99999999999999962e125Initial program 98.3%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6438.0
Applied rewrites38.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6429.2
Applied rewrites29.2%
if -4.99999999999999962e125 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.99999999999999966e89Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6465.7
Applied rewrites65.7%
if 9.99999999999999966e89 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.7
Applied rewrites57.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6426.0
Applied rewrites26.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+125)
(* (/ x t) -60.0)
(if (<= t_1 2e+90) (* 120.0 a) (* (/ y t) 60.0)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+125) {
tmp = (x / t) * -60.0;
} else if (t_1 <= 2e+90) {
tmp = 120.0 * a;
} else {
tmp = (y / t) * 60.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+125)) then
tmp = (x / t) * (-60.0d0)
else if (t_1 <= 2d+90) then
tmp = 120.0d0 * a
else
tmp = (y / t) * 60.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+125) {
tmp = (x / t) * -60.0;
} else if (t_1 <= 2e+90) {
tmp = 120.0 * a;
} else {
tmp = (y / t) * 60.0;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -5e+125: tmp = (x / t) * -60.0 elif t_1 <= 2e+90: tmp = 120.0 * a else: tmp = (y / t) * 60.0 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+125) tmp = Float64(Float64(x / t) * -60.0); elseif (t_1 <= 2e+90) tmp = Float64(120.0 * a); else tmp = Float64(Float64(y / t) * 60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+125) tmp = (x / t) * -60.0; elseif (t_1 <= 2e+90) tmp = 120.0 * a; else tmp = (y / t) * 60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+125], N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+90], N[(120.0 * a), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+125}:\\
\;\;\;\;\frac{x}{t} \cdot -60\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+90}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.99999999999999962e125Initial program 98.3%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6438.0
Applied rewrites38.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6429.2
Applied rewrites29.2%
if -4.99999999999999962e125 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.99999999999999993e90Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6465.7
Applied rewrites65.7%
if 1.99999999999999993e90 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 98.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6441.4
Applied rewrites41.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6424.4
Applied rewrites24.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y t) 60.0)) (t_2 (/ (* 60.0 (- x y)) (- z t)))) (if (<= t_2 -5e+254) t_1 (if (<= t_2 2e+90) (* 120.0 a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / t) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5e+254) {
tmp = t_1;
} else if (t_2 <= 2e+90) {
tmp = 120.0 * a;
} 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 = (y / t) * 60.0d0
t_2 = (60.0d0 * (x - y)) / (z - t)
if (t_2 <= (-5d+254)) then
tmp = t_1
else if (t_2 <= 2d+90) then
tmp = 120.0d0 * a
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 = (y / t) * 60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5e+254) {
tmp = t_1;
} else if (t_2 <= 2e+90) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / t) * 60.0 t_2 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_2 <= -5e+254: tmp = t_1 elif t_2 <= 2e+90: tmp = 120.0 * a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / t) * 60.0) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -5e+254) tmp = t_1; elseif (t_2 <= 2e+90) tmp = Float64(120.0 * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / t) * 60.0; t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -5e+254) tmp = t_1; elseif (t_2 <= 2e+90) tmp = 120.0 * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / 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, -5e+254], t$95$1, If[LessEqual[t$95$2, 2e+90], N[(120.0 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot 60\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+254}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+90}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.99999999999999994e254 or 1.99999999999999993e90 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 97.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6444.4
Applied rewrites44.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6427.4
Applied rewrites27.4%
if -4.99999999999999994e254 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.99999999999999993e90Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.3
Applied rewrites61.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y (- z t)) -60.0 (* 120.0 a))))
(if (<= y -2.1e+70)
t_1
(if (<= y 2.15e+71) (fma (/ x (- z t)) 60.0 (* 120.0 a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / (z - t)), -60.0, (120.0 * a));
double tmp;
if (y <= -2.1e+70) {
tmp = t_1;
} else if (y <= 2.15e+71) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / Float64(z - t)), -60.0, Float64(120.0 * a)) tmp = 0.0 if (y <= -2.1e+70) tmp = t_1; elseif (y <= 2.15e+71) tmp = fma(Float64(x / Float64(z - 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[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.1e+70], t$95$1, If[LessEqual[y, 2.15e+71], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{z - t}, -60, 120 \cdot a\right)\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.10000000000000008e70 or 2.14999999999999992e71 < y Initial program 99.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6486.7
Applied rewrites86.7%
if -2.10000000000000008e70 < y < 2.14999999999999992e71Initial program 99.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6491.3
Applied rewrites91.3%
(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.3
Applied rewrites50.3%
(FPCore (x y z t a) :precision binary64 (+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (60.0d0 / ((z - t) / (x - y))) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
def code(x, y, z, t, a): return (60.0 / ((z - t) / (x - y))) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(60.0 / Float64(Float64(z - t) / Float64(x - y))) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = (60.0 / ((z - t) / (x - y))) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(60.0 / N[(N[(z - t), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60}{\frac{z - t}{x - y}} + a \cdot 120
\end{array}
herbie shell --seed 2025091
(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)))