
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
(FPCore (x y z t a) :precision binary64 (fma a 120.0 (* (/ 60.0 (- z t)) (- x y))))
double code(double x, double y, double z, double t, double a) {
return fma(a, 120.0, ((60.0 / (z - t)) * (x - y)));
}
function code(x, y, z, t, a) return fma(a, 120.0, Float64(Float64(60.0 / Float64(z - t)) * Float64(x - y))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \frac{60}{z - t} \cdot \left(x - y\right)\right)
\end{array}
Initial program 99.0%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
remove-double-negN/A
lower-fma.f6499.5
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (or (<= t_1 -2e+172) (not (<= t_1 5e+188)))
(* (/ y t) 60.0)
(* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -2e+172) || !(t_1 <= 5e+188)) {
tmp = (y / t) * 60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if ((t_1 <= (-2d+172)) .or. (.not. (t_1 <= 5d+188))) then
tmp = (y / t) * 60.0d0
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if ((t_1 <= -2e+172) || !(t_1 <= 5e+188)) {
tmp = (y / t) * 60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if (t_1 <= -2e+172) or not (t_1 <= 5e+188): tmp = (y / t) * 60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if ((t_1 <= -2e+172) || !(t_1 <= 5e+188)) tmp = Float64(Float64(y / t) * 60.0); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if ((t_1 <= -2e+172) || ~((t_1 <= 5e+188))) tmp = (y / t) * 60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+172], N[Not[LessEqual[t$95$1, 5e+188]], $MachinePrecision]], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+172} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+188}\right):\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -2.0000000000000002e172 or 5.0000000000000001e188 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 96.0%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites59.4%
Taylor expanded in x around 0
Applied rewrites51.2%
Taylor expanded in z around 0
Applied rewrites29.9%
if -2.0000000000000002e172 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000001e188Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6465.0
Applied rewrites65.0%
Final simplification58.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 60.0 (- x y))))
(if (or (<= t_1 -2e+129) (not (<= t_1 5e+105)))
(* (- x y) (/ 60.0 (- z t)))
(* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = 60.0 * (x - y);
double tmp;
if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
tmp = (x - y) * (60.0 / (z - t));
} else {
tmp = 120.0 * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = 60.0d0 * (x - y)
if ((t_1 <= (-2d+129)) .or. (.not. (t_1 <= 5d+105))) then
tmp = (x - y) * (60.0d0 / (z - t))
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 60.0 * (x - y);
double tmp;
if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
tmp = (x - y) * (60.0 / (z - t));
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 60.0 * (x - y) tmp = 0 if (t_1 <= -2e+129) or not (t_1 <= 5e+105): tmp = (x - y) * (60.0 / (z - t)) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) t_1 = Float64(60.0 * Float64(x - y)) tmp = 0.0 if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 60.0 * (x - y); tmp = 0.0; if ((t_1 <= -2e+129) || ~((t_1 <= 5e+105))) tmp = (x - y) * (60.0 / (z - t)); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+129], N[Not[LessEqual[t$95$1, 5e+105]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 60 \cdot \left(x - y\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+129} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+105}\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (*.f64 #s(literal 60 binary64) (-.f64 x y)) < -2e129 or 5.00000000000000046e105 < (*.f64 #s(literal 60 binary64) (-.f64 x y)) Initial program 98.3%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6476.6
Applied rewrites76.6%
if -2e129 < (*.f64 #s(literal 60 binary64) (-.f64 x y)) < 5.00000000000000046e105Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6483.2
Applied rewrites83.2%
Final simplification79.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 60.0 (- x y))))
(if (or (<= t_1 -2e+129) (not (<= t_1 5e+105)))
(/ (* -60.0 (- y x)) (- z t))
(* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = 60.0 * (x - y);
double tmp;
if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
tmp = (-60.0 * (y - x)) / (z - t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = 60.0d0 * (x - y)
if ((t_1 <= (-2d+129)) .or. (.not. (t_1 <= 5d+105))) then
tmp = ((-60.0d0) * (y - x)) / (z - t)
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 60.0 * (x - y);
double tmp;
if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
tmp = (-60.0 * (y - x)) / (z - t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 60.0 * (x - y) tmp = 0 if (t_1 <= -2e+129) or not (t_1 <= 5e+105): tmp = (-60.0 * (y - x)) / (z - t) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) t_1 = Float64(60.0 * Float64(x - y)) tmp = 0.0 if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) tmp = Float64(Float64(-60.0 * Float64(y - x)) / Float64(z - t)); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 60.0 * (x - y); tmp = 0.0; if ((t_1 <= -2e+129) || ~((t_1 <= 5e+105))) tmp = (-60.0 * (y - x)) / (z - t); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+129], N[Not[LessEqual[t$95$1, 5e+105]], $MachinePrecision]], N[(N[(-60.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 60 \cdot \left(x - y\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+129} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+105}\right):\\
\;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if (*.f64 #s(literal 60 binary64) (-.f64 x y)) < -2e129 or 5.00000000000000046e105 < (*.f64 #s(literal 60 binary64) (-.f64 x y)) Initial program 98.3%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6476.6
Applied rewrites76.6%
Taylor expanded in z around inf
Applied rewrites42.1%
Taylor expanded in x around 0
Applied rewrites75.9%
if -2e129 < (*.f64 #s(literal 60 binary64) (-.f64 x y)) < 5.00000000000000046e105Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6483.2
Applied rewrites83.2%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4.6e+57) (not (<= x 6.5e+92))) (fma a 120.0 (/ (* x 60.0) (- z t))) (fma 120.0 a (* (/ y (- z t)) -60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.6e+57) || !(x <= 6.5e+92)) {
tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
} else {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4.6e+57) || !(x <= 6.5e+92)) tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t))); else tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4.6e+57], N[Not[LessEqual[x, 6.5e+92]], $MachinePrecision]], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+57} \lor \neg \left(x \leq 6.5 \cdot 10^{+92}\right):\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\end{array}
\end{array}
if x < -4.5999999999999998e57 or 6.49999999999999999e92 < x Initial program 98.7%
Taylor expanded in x around inf
lower-*.f6493.2
Applied rewrites93.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6493.3
Applied rewrites93.3%
if -4.5999999999999998e57 < x < 6.49999999999999999e92Initial program 99.2%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6497.3
Applied rewrites97.3%
Final simplification95.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.1e+159) (not (<= x 2.65e+109))) (/ (* -60.0 (- y x)) (- z t)) (fma 120.0 a (* (/ y (- z t)) -60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.1e+159) || !(x <= 2.65e+109)) {
tmp = (-60.0 * (y - x)) / (z - t);
} else {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.1e+159) || !(x <= 2.65e+109)) tmp = Float64(Float64(-60.0 * Float64(y - x)) / Float64(z - t)); else tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.1e+159], N[Not[LessEqual[x, 2.65e+109]], $MachinePrecision]], N[(N[(-60.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+159} \lor \neg \left(x \leq 2.65 \cdot 10^{+109}\right):\\
\;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\end{array}
\end{array}
if x < -1.1e159 or 2.65000000000000013e109 < x Initial program 98.4%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6476.5
Applied rewrites76.5%
Taylor expanded in z around inf
Applied rewrites41.5%
Taylor expanded in x around 0
Applied rewrites76.7%
if -1.1e159 < x < 2.65000000000000013e109Initial program 99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6495.0
Applied rewrites95.0%
Final simplification89.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -4.8e+212) (* (/ y (- z t)) -60.0) (if (<= y 2.8e+106) (* 120.0 a) (* (- y) (/ 60.0 (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.8e+212) {
tmp = (y / (z - t)) * -60.0;
} else if (y <= 2.8e+106) {
tmp = 120.0 * a;
} else {
tmp = -y * (60.0 / (z - t));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-4.8d+212)) then
tmp = (y / (z - t)) * (-60.0d0)
else if (y <= 2.8d+106) then
tmp = 120.0d0 * a
else
tmp = -y * (60.0d0 / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.8e+212) {
tmp = (y / (z - t)) * -60.0;
} else if (y <= 2.8e+106) {
tmp = 120.0 * a;
} else {
tmp = -y * (60.0 / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -4.8e+212: tmp = (y / (z - t)) * -60.0 elif y <= 2.8e+106: tmp = 120.0 * a else: tmp = -y * (60.0 / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.8e+212) tmp = Float64(Float64(y / Float64(z - t)) * -60.0); elseif (y <= 2.8e+106) tmp = Float64(120.0 * a); else tmp = Float64(Float64(-y) * Float64(60.0 / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -4.8e+212) tmp = (y / (z - t)) * -60.0; elseif (y <= 2.8e+106) tmp = 120.0 * a; else tmp = -y * (60.0 / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.8e+212], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[y, 2.8e+106], N[(120.0 * a), $MachinePrecision], N[((-y) * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+212}:\\
\;\;\;\;\frac{y}{z - t} \cdot -60\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+106}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if y < -4.8e212Initial program 95.1%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6486.2
Applied rewrites86.2%
Taylor expanded in z around inf
Applied rewrites67.6%
Taylor expanded in x around 0
Applied rewrites86.2%
if -4.8e212 < y < 2.79999999999999993e106Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6463.7
Applied rewrites63.7%
if 2.79999999999999993e106 < y Initial program 97.1%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6486.3
Applied rewrites86.3%
Taylor expanded in x around 0
Applied rewrites73.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4.8e+212) (not (<= y 2.8e+106))) (* (/ y (- z t)) -60.0) (* 120.0 a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.8e+212) || !(y <= 2.8e+106)) {
tmp = (y / (z - t)) * -60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-4.8d+212)) .or. (.not. (y <= 2.8d+106))) then
tmp = (y / (z - t)) * (-60.0d0)
else
tmp = 120.0d0 * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.8e+212) || !(y <= 2.8e+106)) {
tmp = (y / (z - t)) * -60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -4.8e+212) or not (y <= 2.8e+106): tmp = (y / (z - t)) * -60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4.8e+212) || !(y <= 2.8e+106)) tmp = Float64(Float64(y / Float64(z - t)) * -60.0); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -4.8e+212) || ~((y <= 2.8e+106))) tmp = (y / (z - t)) * -60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.8e+212], N[Not[LessEqual[y, 2.8e+106]], $MachinePrecision]], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+212} \lor \neg \left(y \leq 2.8 \cdot 10^{+106}\right):\\
\;\;\;\;\frac{y}{z - t} \cdot -60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if y < -4.8e212 or 2.79999999999999993e106 < y Initial program 96.4%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6486.3
Applied rewrites86.3%
Taylor expanded in z around inf
Applied rewrites54.7%
Taylor expanded in x around 0
Applied rewrites78.1%
if -4.8e212 < y < 2.79999999999999993e106Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6463.7
Applied rewrites63.7%
Final simplification67.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4.5e+218) (not (<= y 3.3e+157))) (* y (/ -60.0 z)) (* 120.0 a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.5e+218) || !(y <= 3.3e+157)) {
tmp = y * (-60.0 / z);
} 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 ((y <= (-4.5d+218)) .or. (.not. (y <= 3.3d+157))) then
tmp = y * ((-60.0d0) / z)
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 ((y <= -4.5e+218) || !(y <= 3.3e+157)) {
tmp = y * (-60.0 / z);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -4.5e+218) or not (y <= 3.3e+157): tmp = y * (-60.0 / z) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4.5e+218) || !(y <= 3.3e+157)) tmp = Float64(y * Float64(-60.0 / z)); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -4.5e+218) || ~((y <= 3.3e+157))) tmp = y * (-60.0 / z); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.5e+218], N[Not[LessEqual[y, 3.3e+157]], $MachinePrecision]], N[(y * N[(-60.0 / z), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+218} \lor \neg \left(y \leq 3.3 \cdot 10^{+157}\right):\\
\;\;\;\;y \cdot \frac{-60}{z}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if y < -4.50000000000000008e218 or 3.3000000000000002e157 < y Initial program 95.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in y around inf
Applied rewrites58.4%
Applied rewrites58.5%
if -4.50000000000000008e218 < y < 3.3000000000000002e157Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6461.5
Applied rewrites61.5%
Final simplification61.0%
(FPCore (x y z t a) :precision binary64 (* 120.0 a))
double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = 120.0d0 * a
end function
public static double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
def code(x, y, z, t, a): return 120.0 * a
function code(x, y, z, t, a) return Float64(120.0 * a) end
function tmp = code(x, y, z, t, a) tmp = 120.0 * a; end
code[x_, y_, z_, t_, a_] := N[(120.0 * a), $MachinePrecision]
\begin{array}{l}
\\
120 \cdot a
\end{array}
Initial program 99.0%
Taylor expanded in z around inf
lower-*.f6452.9
Applied rewrites52.9%
(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 2024359
(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)))