
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (- x y) (/ 60.0 (- z t)) (* 120.0 a)))
double code(double x, double y, double z, double t, double a) {
return fma((x - y), (60.0 / (z - t)), (120.0 * a));
}
function code(x, y, z, t, a) return fma(Float64(x - y), Float64(60.0 / Float64(z - t)), Float64(120.0 * a)) end
code[x_, y_, z_, t_, a_] := N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - y, \frac{60}{z - t}, 120 \cdot a\right)
\end{array}
Initial program 99.3%
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%
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f6499.8
Applied rewrites99.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 -5e+305)
t_1
(if (<= t_2 -1e+141)
(* (/ x z) 60.0)
(if (<= t_2 4e+166) (* 120.0 a) 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 <= -5e+305) {
tmp = t_1;
} else if (t_2 <= -1e+141) {
tmp = (x / z) * 60.0;
} else if (t_2 <= 4e+166) {
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 = ((x - y) / t) * (-60.0d0)
t_2 = (60.0d0 * (x - y)) / (z - t)
if (t_2 <= (-5d+305)) then
tmp = t_1
else if (t_2 <= (-1d+141)) then
tmp = (x / z) * 60.0d0
else if (t_2 <= 4d+166) 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 = ((x - y) / t) * -60.0;
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -5e+305) {
tmp = t_1;
} else if (t_2 <= -1e+141) {
tmp = (x / z) * 60.0;
} else if (t_2 <= 4e+166) {
tmp = 120.0 * a;
} 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 <= -5e+305: tmp = t_1 elif t_2 <= -1e+141: tmp = (x / z) * 60.0 elif t_2 <= 4e+166: tmp = 120.0 * a 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 <= -5e+305) tmp = t_1; elseif (t_2 <= -1e+141) tmp = Float64(Float64(x / z) * 60.0); elseif (t_2 <= 4e+166) 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 - y) / t) * -60.0; t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -5e+305) tmp = t_1; elseif (t_2 <= -1e+141) tmp = (x / z) * 60.0; elseif (t_2 <= 4e+166) 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[(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, -5e+305], t$95$1, If[LessEqual[t$95$2, -1e+141], N[(N[(x / z), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$2, 4e+166], N[(120.0 * a), $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 -5 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+141}:\\
\;\;\;\;\frac{x}{z} \cdot 60\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+166}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.00000000000000009e305 or 3.99999999999999976e166 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 96.8%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6490.2
Applied rewrites90.2%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6458.4
Applied rewrites58.4%
if -5.00000000000000009e305 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -1.00000000000000002e141Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6450.9
Applied rewrites50.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6421.8
Applied rewrites21.8%
if -1.00000000000000002e141 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 3.99999999999999976e166Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6462.5
Applied rewrites62.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -0.000115)
(fma (- x y) (/ 60.0 z) (* 120.0 a))
(if (<= z -1.02e-113)
(+ (* (/ x (- z t)) 60.0) (* a 120.0))
(if (<= z 9.2e-101)
(fma a 120.0 (* (/ (- x y) t) -60.0))
(fma (/ (- x y) z) 60.0 (* 120.0 a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.000115) {
tmp = fma((x - y), (60.0 / z), (120.0 * a));
} else if (z <= -1.02e-113) {
tmp = ((x / (z - t)) * 60.0) + (a * 120.0);
} else if (z <= 9.2e-101) {
tmp = fma(a, 120.0, (((x - y) / t) * -60.0));
} else {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.000115) tmp = fma(Float64(x - y), Float64(60.0 / z), Float64(120.0 * a)); elseif (z <= -1.02e-113) tmp = Float64(Float64(Float64(x / Float64(z - t)) * 60.0) + Float64(a * 120.0)); elseif (z <= 9.2e-101) tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / t) * -60.0)); else tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.000115], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.02e-113], N[(N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e-101], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.000115:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{60}{z}, 120 \cdot a\right)\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-113}:\\
\;\;\;\;\frac{x}{z - t} \cdot 60 + a \cdot 120\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-101}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\end{array}
\end{array}
if z < -1.15e-4Initial program 99.3%
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%
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites86.1%
if -1.15e-4 < z < -1.02e-113Initial program 99.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6471.8
Applied rewrites71.8%
if -1.02e-113 < z < 9.1999999999999998e-101Initial 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.5
Applied rewrites99.5%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6488.7
Applied rewrites88.7%
if 9.1999999999999998e-101 < z Initial program 99.3%
Taylor expanded in z around inf
*-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 -66000000.0)
(* 120.0 a)
(if (<= a 1.26e-81)
(* (- x y) (/ 60.0 (- z t)))
(if (<= a 2.05e+71)
(fma (/ x z) 60.0 (* 120.0 a))
(fma (/ y z) -60.0 (* a 120.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -66000000.0) {
tmp = 120.0 * a;
} else if (a <= 1.26e-81) {
tmp = (x - y) * (60.0 / (z - t));
} else if (a <= 2.05e+71) {
tmp = fma((x / z), 60.0, (120.0 * a));
} else {
tmp = fma((y / z), -60.0, (a * 120.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -66000000.0) tmp = Float64(120.0 * a); elseif (a <= 1.26e-81) tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); elseif (a <= 2.05e+71) tmp = fma(Float64(x / z), 60.0, Float64(120.0 * a)); else tmp = fma(Float64(y / z), -60.0, Float64(a * 120.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -66000000.0], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 1.26e-81], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.05e+71], N[(N[(x / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * -60.0 + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -66000000:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 1.26 \cdot 10^{-81}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\mathbf{elif}\;a \leq 2.05 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -60, a \cdot 120\right)\\
\end{array}
\end{array}
if a < -6.6e7Initial program 99.5%
Taylor expanded in z around inf
lower-*.f6475.7
Applied rewrites75.7%
if -6.6e7 < a < 1.2599999999999999e-81Initial program 99.3%
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%
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--.f6477.0
Applied rewrites77.0%
if 1.2599999999999999e-81 < a < 2.0500000000000001e71Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
Taylor expanded in x around inf
Applied rewrites51.2%
if 2.0500000000000001e71 < a Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6475.7
Applied rewrites75.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6474.7
Applied rewrites74.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ x (- z t)) 60.0)))
(if (<= x -5.6e+194)
t_1
(if (<= x -3.6e-38)
(* 120.0 a)
(if (<= x 7e+157) (fma (/ y z) -60.0 (* a 120.0)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x / (z - t)) * 60.0;
double tmp;
if (x <= -5.6e+194) {
tmp = t_1;
} else if (x <= -3.6e-38) {
tmp = 120.0 * a;
} else if (x <= 7e+157) {
tmp = fma((y / z), -60.0, (a * 120.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x / Float64(z - t)) * 60.0) tmp = 0.0 if (x <= -5.6e+194) tmp = t_1; elseif (x <= -3.6e-38) tmp = Float64(120.0 * a); elseif (x <= 7e+157) tmp = fma(Float64(y / z), -60.0, Float64(a * 120.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision]}, If[LessEqual[x, -5.6e+194], t$95$1, If[LessEqual[x, -3.6e-38], N[(120.0 * a), $MachinePrecision], If[LessEqual[x, 7e+157], N[(N[(y / z), $MachinePrecision] * -60.0 + N[(a * 120.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z - t} \cdot 60\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+194}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-38}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -60, a \cdot 120\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.60000000000000021e194 or 7.00000000000000004e157 < x Initial program 98.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6464.6
Applied rewrites64.6%
if -5.60000000000000021e194 < x < -3.6000000000000001e-38Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6448.1
Applied rewrites48.1%
if -3.6000000000000001e-38 < x < 7.00000000000000004e157Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6466.3
Applied rewrites66.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6463.6
Applied rewrites63.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9e-51)
(fma (- x y) (/ 60.0 z) (* 120.0 a))
(if (<= z 9.2e-101)
(fma a 120.0 (* (/ (- x y) t) -60.0))
(fma (/ (- x y) z) 60.0 (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e-51) {
tmp = fma((x - y), (60.0 / z), (120.0 * a));
} else if (z <= 9.2e-101) {
tmp = fma(a, 120.0, (((x - y) / t) * -60.0));
} else {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e-51) tmp = fma(Float64(x - y), Float64(60.0 / z), Float64(120.0 * a)); elseif (z <= 9.2e-101) tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / t) * -60.0)); else tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e-51], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e-101], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{60}{z}, 120 \cdot a\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-101}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\end{array}
\end{array}
if z < -8.99999999999999948e-51Initial program 99.3%
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%
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites83.5%
if -8.99999999999999948e-51 < z < 9.1999999999999998e-101Initial 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.5
Applied rewrites99.5%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6486.0
Applied rewrites86.0%
if 9.1999999999999998e-101 < z Initial program 99.3%
Taylor expanded in z around inf
*-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
(let* ((t_1 (fma (/ (- x y) z) 60.0 (* 120.0 a))))
(if (<= z -9e-51)
t_1
(if (<= z 9.2e-101) (fma a 120.0 (* (/ (- x y) t) -60.0)) 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 <= -9e-51) {
tmp = t_1;
} else if (z <= 9.2e-101) {
tmp = fma(a, 120.0, (((x - y) / t) * -60.0));
} 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 <= -9e-51) tmp = t_1; elseif (z <= 9.2e-101) tmp = fma(a, 120.0, 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 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e-51], t$95$1, If[LessEqual[z, 9.2e-101], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $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 -9 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-101}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.99999999999999948e-51 or 9.1999999999999998e-101 < z Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
if -8.99999999999999948e-51 < z < 9.1999999999999998e-101Initial 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.5
Applied rewrites99.5%
Taylor expanded in z around 0
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6486.0
Applied rewrites86.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) z) 60.0 (* 120.0 a))))
(if (<= z -9e-51)
t_1
(if (<= z 9.2e-101) (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 <= -9e-51) {
tmp = t_1;
} else if (z <= 9.2e-101) {
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 <= -9e-51) tmp = t_1; elseif (z <= 9.2e-101) 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, -9e-51], t$95$1, If[LessEqual[z, 9.2e-101], 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 -9 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-101}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.99999999999999948e-51 or 9.1999999999999998e-101 < z Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
if -8.99999999999999948e-51 < z < 9.1999999999999998e-101Initial program 99.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6485.9
Applied rewrites85.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x z) 60.0 (* 120.0 a))))
(if (<= z -1.85e-50)
t_1
(if (<= z 1.7e-66) (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 / z), 60.0, (120.0 * a));
double tmp;
if (z <= -1.85e-50) {
tmp = t_1;
} else if (z <= 1.7e-66) {
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(x / z), 60.0, Float64(120.0 * a)) tmp = 0.0 if (z <= -1.85e-50) tmp = t_1; elseif (z <= 1.7e-66) 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[(x / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.85e-50], t$95$1, If[LessEqual[z, 1.7e-66], 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}{z}, 60, 120 \cdot a\right)\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.85e-50 or 1.69999999999999999e-66 < 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.5
Applied rewrites83.5%
Taylor expanded in x around inf
Applied rewrites69.9%
if -1.85e-50 < z < 1.69999999999999999e-66Initial program 99.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6484.9
Applied rewrites84.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -66000000.0)
(* 120.0 a)
(if (<= a 1.6e+71)
(* (- x y) (/ 60.0 (- z t)))
(fma (/ y z) -60.0 (* a 120.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -66000000.0) {
tmp = 120.0 * a;
} else if (a <= 1.6e+71) {
tmp = (x - y) * (60.0 / (z - t));
} else {
tmp = fma((y / z), -60.0, (a * 120.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -66000000.0) tmp = Float64(120.0 * a); elseif (a <= 1.6e+71) tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); else tmp = fma(Float64(y / z), -60.0, Float64(a * 120.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -66000000.0], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 1.6e+71], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * -60.0 + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -66000000:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{+71}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -60, a \cdot 120\right)\\
\end{array}
\end{array}
if a < -6.6e7Initial program 99.5%
Taylor expanded in z around inf
lower-*.f6475.7
Applied rewrites75.7%
if -6.6e7 < a < 1.60000000000000012e71Initial program 99.3%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6471.1
Applied rewrites71.1%
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--.f6471.5
Applied rewrites71.5%
if 1.60000000000000012e71 < a Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6475.7
Applied rewrites75.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6474.7
Applied rewrites74.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.8e-128) (* 120.0 a) (if (<= a 1.15e-45) (* (/ (- x y) z) 60.0) (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.8e-128) {
tmp = 120.0 * a;
} else if (a <= 1.15e-45) {
tmp = ((x - y) / z) * 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 <= (-4.8d-128)) then
tmp = 120.0d0 * a
else if (a <= 1.15d-45) then
tmp = ((x - y) / z) * 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 <= -4.8e-128) {
tmp = 120.0 * a;
} else if (a <= 1.15e-45) {
tmp = ((x - y) / z) * 60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.8e-128: tmp = 120.0 * a elif a <= 1.15e-45: tmp = ((x - y) / z) * 60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.8e-128) tmp = Float64(120.0 * a); elseif (a <= 1.15e-45) tmp = Float64(Float64(Float64(x - y) / z) * 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 <= -4.8e-128) tmp = 120.0 * a; elseif (a <= 1.15e-45) tmp = ((x - y) / z) * 60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.8e-128], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 1.15e-45], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{-128}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{-45}:\\
\;\;\;\;\frac{x - y}{z} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -4.7999999999999996e-128 or 1.14999999999999996e-45 < a Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6466.6
Applied rewrites66.6%
if -4.7999999999999996e-128 < a < 1.14999999999999996e-45Initial program 99.2%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6479.4
Applied rewrites79.4%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6442.2
Applied rewrites42.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ x z) 60.0))) (if (<= x -5.6e+204) t_1 (if (<= x 1.15e+219) (* 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 tmp;
if (x <= -5.6e+204) {
tmp = t_1;
} else if (x <= 1.15e+219) {
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) :: tmp
t_1 = (x / z) * 60.0d0
if (x <= (-5.6d+204)) then
tmp = t_1
else if (x <= 1.15d+219) 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 = (x / z) * 60.0;
double tmp;
if (x <= -5.6e+204) {
tmp = t_1;
} else if (x <= 1.15e+219) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x / z) * 60.0 tmp = 0 if x <= -5.6e+204: tmp = t_1 elif x <= 1.15e+219: 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) tmp = 0.0 if (x <= -5.6e+204) tmp = t_1; elseif (x <= 1.15e+219) 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; tmp = 0.0; if (x <= -5.6e+204) tmp = t_1; elseif (x <= 1.15e+219) 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]}, If[LessEqual[x, -5.6e+204], t$95$1, If[LessEqual[x, 1.15e+219], N[(120.0 * a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot 60\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+219}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.60000000000000049e204 or 1.15e219 < x Initial program 98.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f6457.6
Applied rewrites57.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
if -5.60000000000000049e204 < x < 1.15e219Initial program 99.5%
Taylor expanded in z around inf
lower-*.f6454.7
Applied rewrites54.7%
(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.3%
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 (* 120.0 a))
double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = 120.0d0 * a
end function
public static double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
def code(x, y, z, t, a): return 120.0 * a
function code(x, y, z, t, a) return Float64(120.0 * a) end
function tmp = code(x, y, z, t, a) tmp = 120.0 * a; end
code[x_, y_, z_, t_, a_] := N[(120.0 * a), $MachinePrecision]
\begin{array}{l}
\\
120 \cdot a
\end{array}
Initial program 99.3%
Taylor expanded in z around inf
lower-*.f6450.4
Applied rewrites50.4%
(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 2025095
(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)))