
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60 (- x y)) (- z t)) (* a 120)))
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 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120), $MachinePrecision]), $MachinePrecision]
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60 (- x y)) (- z t)) (* a 120)))
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 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120), $MachinePrecision]), $MachinePrecision]
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
(FPCore (x y z t a) :precision binary64 (+ (134-z0z1z2z3z4 (/ -1 (- z t)) y 60 x 60) (* a 120)))
\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{-1}{z - t}\right), y, 60, x, 60\right) + a \cdot 120
Initial program 99.4%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
*-commutativeN/A
*-rgt-identityN/A
distribute-lft-neg-outN/A
*-rgt-identityN/A
lift-*.f64N/A
lift--.f64N/A
distribute-rgt-out--N/A
sub-negateN/A
lower-134-z0z1z2z3z4N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6499.8%
Applied rewrites99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* -60 (/ y (- z t))) (* a 120))))
(if (<= y -920000000000000000)
t_1
(if (<=
y
6643344963566725/7067388259113537318333190002971674063309935587502475832486424805170479104)
(+ (* 60 (/ x (- z t))) (* a 120))
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (-60.0 * (y / (z - t))) + (a * 120.0);
double tmp;
if (y <= -9.2e+17) {
tmp = t_1;
} else if (y <= 9.4e-58) {
tmp = (60.0 * (x / (z - t))) + (a * 120.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) :: tmp
t_1 = ((-60.0d0) * (y / (z - t))) + (a * 120.0d0)
if (y <= (-9.2d+17)) then
tmp = t_1
else if (y <= 9.4d-58) then
tmp = (60.0d0 * (x / (z - t))) + (a * 120.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 = (-60.0 * (y / (z - t))) + (a * 120.0);
double tmp;
if (y <= -9.2e+17) {
tmp = t_1;
} else if (y <= 9.4e-58) {
tmp = (60.0 * (x / (z - t))) + (a * 120.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (-60.0 * (y / (z - t))) + (a * 120.0) tmp = 0 if y <= -9.2e+17: tmp = t_1 elif y <= 9.4e-58: tmp = (60.0 * (x / (z - t))) + (a * 120.0) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-60.0 * Float64(y / Float64(z - t))) + Float64(a * 120.0)) tmp = 0.0 if (y <= -9.2e+17) tmp = t_1; elseif (y <= 9.4e-58) tmp = Float64(Float64(60.0 * Float64(x / Float64(z - t))) + Float64(a * 120.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (-60.0 * (y / (z - t))) + (a * 120.0); tmp = 0.0; if (y <= -9.2e+17) tmp = t_1; elseif (y <= 9.4e-58) tmp = (60.0 * (x / (z - t))) + (a * 120.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(-60 * N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -920000000000000000], t$95$1, If[LessEqual[y, 6643344963566725/7067388259113537318333190002971674063309935587502475832486424805170479104], N[(N[(60 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := -60 \cdot \frac{y}{z - t} + a \cdot 120\\
\mathbf{if}\;y \leq -920000000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq \frac{6643344963566725}{7067388259113537318333190002971674063309935587502475832486424805170479104}:\\
\;\;\;\;60 \cdot \frac{x}{z - t} + a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -9.2e17 or 9.3999999999999999e-58 < y Initial program 99.4%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.0%
Applied rewrites76.0%
if -9.2e17 < y < 9.3999999999999999e-58Initial program 99.4%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
*-commutativeN/A
*-rgt-identityN/A
distribute-lft-neg-outN/A
*-rgt-identityN/A
lift-*.f64N/A
lift--.f64N/A
distribute-rgt-out--N/A
sub-negateN/A
lower-134-z0z1z2z3z4N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.1%
Applied rewrites75.1%
(FPCore (x y z t a)
:precision binary64
(if (<=
y
-3099999999999999896533334876964249800205167308886334283362040000083741526987387902368537446004427030739951226815029036893217415655816957778969254797349185177254199416913729178243794021108446847282946886087200767078534297987530948083712)
(* -60 (/ y (- z t)))
(if (<=
y
-25499999999999999528024993055952010542249007939197233513958453954737868247668078447050309476321791611551296703204050146631997321389936393151246862110425088)
(+ (* -60 (/ y z)) (* a 120))
(if (<=
y
510000000000000022032816663106096486183925973148785287396432843573633510044500020291792739008901828466414977024)
(+ (* 60 (/ x (- z t))) (* a 120))
(* -60 (* (/ 1 (- z t)) (- y x)))))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.1e+234) {
tmp = -60.0 * (y / (z - t));
} else if (y <= -2.55e+154) {
tmp = (-60.0 * (y / z)) + (a * 120.0);
} else if (y <= 5.1e+110) {
tmp = (60.0 * (x / (z - t))) + (a * 120.0);
} else {
tmp = -60.0 * ((1.0 / (z - t)) * (y - x));
}
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 <= (-3.1d+234)) then
tmp = (-60.0d0) * (y / (z - t))
else if (y <= (-2.55d+154)) then
tmp = ((-60.0d0) * (y / z)) + (a * 120.0d0)
else if (y <= 5.1d+110) then
tmp = (60.0d0 * (x / (z - t))) + (a * 120.0d0)
else
tmp = (-60.0d0) * ((1.0d0 / (z - t)) * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.1e+234) {
tmp = -60.0 * (y / (z - t));
} else if (y <= -2.55e+154) {
tmp = (-60.0 * (y / z)) + (a * 120.0);
} else if (y <= 5.1e+110) {
tmp = (60.0 * (x / (z - t))) + (a * 120.0);
} else {
tmp = -60.0 * ((1.0 / (z - t)) * (y - x));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.1e+234: tmp = -60.0 * (y / (z - t)) elif y <= -2.55e+154: tmp = (-60.0 * (y / z)) + (a * 120.0) elif y <= 5.1e+110: tmp = (60.0 * (x / (z - t))) + (a * 120.0) else: tmp = -60.0 * ((1.0 / (z - t)) * (y - x)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.1e+234) tmp = Float64(-60.0 * Float64(y / Float64(z - t))); elseif (y <= -2.55e+154) tmp = Float64(Float64(-60.0 * Float64(y / z)) + Float64(a * 120.0)); elseif (y <= 5.1e+110) tmp = Float64(Float64(60.0 * Float64(x / Float64(z - t))) + Float64(a * 120.0)); else tmp = Float64(-60.0 * Float64(Float64(1.0 / Float64(z - t)) * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.1e+234) tmp = -60.0 * (y / (z - t)); elseif (y <= -2.55e+154) tmp = (-60.0 * (y / z)) + (a * 120.0); elseif (y <= 5.1e+110) tmp = (60.0 * (x / (z - t))) + (a * 120.0); else tmp = -60.0 * ((1.0 / (z - t)) * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3099999999999999896533334876964249800205167308886334283362040000083741526987387902368537446004427030739951226815029036893217415655816957778969254797349185177254199416913729178243794021108446847282946886087200767078534297987530948083712], N[(-60 * N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -25499999999999999528024993055952010542249007939197233513958453954737868247668078447050309476321791611551296703204050146631997321389936393151246862110425088], N[(N[(-60 * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * 120), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 510000000000000022032816663106096486183925973148785287396432843573633510044500020291792739008901828466414977024], N[(N[(60 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120), $MachinePrecision]), $MachinePrecision], N[(-60 * N[(N[(1 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;y \leq -3099999999999999896533334876964249800205167308886334283362040000083741526987387902368537446004427030739951226815029036893217415655816957778969254797349185177254199416913729178243794021108446847282946886087200767078534297987530948083712:\\
\;\;\;\;-60 \cdot \frac{y}{z - t}\\
\mathbf{elif}\;y \leq -25499999999999999528024993055952010542249007939197233513958453954737868247668078447050309476321791611551296703204050146631997321389936393151246862110425088:\\
\;\;\;\;-60 \cdot \frac{y}{z} + a \cdot 120\\
\mathbf{elif}\;y \leq 510000000000000022032816663106096486183925973148785287396432843573633510044500020291792739008901828466414977024:\\
\;\;\;\;60 \cdot \frac{x}{z - t} + a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;-60 \cdot \left(\frac{1}{z - t} \cdot \left(y - x\right)\right)\\
\end{array}
if y < -3.0999999999999999e234Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
Applied rewrites27.0%
if -3.0999999999999999e234 < y < -2.55e154Initial program 99.4%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.0%
Applied rewrites76.0%
Taylor expanded in z around inf
lower-/.f6455.4%
Applied rewrites55.4%
if -2.55e154 < y < 5.1000000000000002e110Initial program 99.4%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
*-commutativeN/A
*-rgt-identityN/A
distribute-lft-neg-outN/A
*-rgt-identityN/A
lift-*.f64N/A
lift--.f64N/A
distribute-rgt-out--N/A
sub-negateN/A
lower-134-z0z1z2z3z4N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.1%
Applied rewrites75.1%
if 5.1000000000000002e110 < y Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6450.1%
Applied rewrites50.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 60 (/ (- x y) (- z t))))
(t_2 (/ (* 60 (- x y)) (- z t))))
(if (<= t_2 -4000000000000000053150220288)
t_1
(if (<= t_2 39999999999999998543585179860992) (* 120 a) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = 60.0 * ((x - y) / (z - t));
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -4e+27) {
tmp = t_1;
} else if (t_2 <= 4e+31) {
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 = 60.0d0 * ((x - y) / (z - t))
t_2 = (60.0d0 * (x - y)) / (z - t)
if (t_2 <= (-4d+27)) then
tmp = t_1
else if (t_2 <= 4d+31) 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 = 60.0 * ((x - y) / (z - t));
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -4e+27) {
tmp = t_1;
} else if (t_2 <= 4e+31) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 60.0 * ((x - y) / (z - t)) t_2 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_2 <= -4e+27: tmp = t_1 elif t_2 <= 4e+31: tmp = 120.0 * a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t))) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -4e+27) tmp = t_1; elseif (t_2 <= 4e+31) tmp = Float64(120.0 * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 60.0 * ((x - y) / (z - t)); t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -4e+27) tmp = t_1; elseif (t_2 <= 4e+31) tmp = 120.0 * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4000000000000000053150220288], t$95$1, If[LessEqual[t$95$2, 39999999999999998543585179860992], N[(120 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := 60 \cdot \frac{x - y}{z - t}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -4000000000000000053150220288:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 39999999999999998543585179860992:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.0000000000000001e27 or 3.9999999999999999e31 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.4%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
if -4.0000000000000001e27 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 3.9999999999999999e31Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.2%
Applied rewrites51.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60 (- x y)) (- z t))))
(if (<=
t_1
-9999999999999999483531874467312143214394768377282087351960514613084929070487027419252537449089020883885200422613425626021888)
(* -60 (/ y (- z t)))
(if (<=
t_1
1999999999999999996434887128370482831977857737518825000873086679459880803811809298994231532284537120019554351933503330752464420864)
(* 120 a)
(* -60 (/ (- y x) 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 <= -1e+124) {
tmp = -60.0 * (y / (z - t));
} else if (t_1 <= 2e+129) {
tmp = 120.0 * a;
} else {
tmp = -60.0 * ((y - x) / 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) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-1d+124)) then
tmp = (-60.0d0) * (y / (z - t))
else if (t_1 <= 2d+129) then
tmp = 120.0d0 * a
else
tmp = (-60.0d0) * ((y - x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -1e+124) {
tmp = -60.0 * (y / (z - t));
} else if (t_1 <= 2e+129) {
tmp = 120.0 * a;
} else {
tmp = -60.0 * ((y - x) / z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -1e+124: tmp = -60.0 * (y / (z - t)) elif t_1 <= 2e+129: tmp = 120.0 * a else: tmp = -60.0 * ((y - x) / 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 <= -1e+124) tmp = Float64(-60.0 * Float64(y / Float64(z - t))); elseif (t_1 <= 2e+129) tmp = Float64(120.0 * a); else tmp = Float64(-60.0 * Float64(Float64(y - x) / 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 <= -1e+124) tmp = -60.0 * (y / (z - t)); elseif (t_1 <= 2e+129) tmp = 120.0 * a; else tmp = -60.0 * ((y - x) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -9999999999999999483531874467312143214394768377282087351960514613084929070487027419252537449089020883885200422613425626021888], N[(-60 * N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1999999999999999996434887128370482831977857737518825000873086679459880803811809298994231532284537120019554351933503330752464420864], N[(120 * a), $MachinePrecision], N[(-60 * N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -9999999999999999483531874467312143214394768377282087351960514613084929070487027419252537449089020883885200422613425626021888:\\
\;\;\;\;-60 \cdot \frac{y}{z - t}\\
\mathbf{elif}\;t\_1 \leq 1999999999999999996434887128370482831977857737518825000873086679459880803811809298994231532284537120019554351933503330752464420864:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;-60 \cdot \frac{y - x}{z}\\
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.9999999999999995e123Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
Applied rewrites27.0%
if -9.9999999999999995e123 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e129Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.2%
Applied rewrites51.2%
if 2e129 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6428.2%
Applied rewrites28.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -60 (/ (- y x) z))) (t_2 (/ (* 60 (- x y)) (- z t))))
(if (<=
t_2
-9999999999999999483531874467312143214394768377282087351960514613084929070487027419252537449089020883885200422613425626021888)
t_1
(if (<=
t_2
1999999999999999996434887128370482831977857737518825000873086679459880803811809298994231532284537120019554351933503330752464420864)
(* 120 a)
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = -60.0 * ((y - x) / z);
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -1e+124) {
tmp = t_1;
} else if (t_2 <= 2e+129) {
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 = (-60.0d0) * ((y - x) / z)
t_2 = (60.0d0 * (x - y)) / (z - t)
if (t_2 <= (-1d+124)) then
tmp = t_1
else if (t_2 <= 2d+129) 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 = -60.0 * ((y - x) / z);
double t_2 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_2 <= -1e+124) {
tmp = t_1;
} else if (t_2 <= 2e+129) {
tmp = 120.0 * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -60.0 * ((y - x) / z) t_2 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_2 <= -1e+124: tmp = t_1 elif t_2 <= 2e+129: tmp = 120.0 * a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-60.0 * Float64(Float64(y - x) / z)) t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_2 <= -1e+124) tmp = t_1; elseif (t_2 <= 2e+129) tmp = Float64(120.0 * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -60.0 * ((y - x) / z); t_2 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_2 <= -1e+124) tmp = t_1; elseif (t_2 <= 2e+129) tmp = 120.0 * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-60 * N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -9999999999999999483531874467312143214394768377282087351960514613084929070487027419252537449089020883885200422613425626021888], t$95$1, If[LessEqual[t$95$2, 1999999999999999996434887128370482831977857737518825000873086679459880803811809298994231532284537120019554351933503330752464420864], N[(120 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := -60 \cdot \frac{y - x}{z}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -9999999999999999483531874467312143214394768377282087351960514613084929070487027419252537449089020883885200422613425626021888:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 1999999999999999996434887128370482831977857737518825000873086679459880803811809298994231532284537120019554351933503330752464420864:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.9999999999999995e123 or 2e129 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6428.2%
Applied rewrites28.2%
if -9.9999999999999995e123 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2e129Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.2%
Applied rewrites51.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60 (- x y)) (- z t))))
(if (<=
t_1
-4999999999999999945435305910704598063392403130200679472590007732362651199555129074427056403228815030648329464160476949292016380761727168556302336)
(* -60 (/ y z))
(if (<=
t_1
100000000000000003441905430931245280917713770297417747470693647675065097962631447553892265814744827318497179085147422915077831721209019419643357959500300321574675254607872)
(* 120 a)
(* 60 (/ x (- 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 <= -5e+144) {
tmp = -60.0 * (y / z);
} else if (t_1 <= 1e+170) {
tmp = 120.0 * a;
} else {
tmp = 60.0 * (x / (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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+144)) then
tmp = (-60.0d0) * (y / z)
else if (t_1 <= 1d+170) then
tmp = 120.0d0 * a
else
tmp = 60.0d0 * (x / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+144) {
tmp = -60.0 * (y / z);
} else if (t_1 <= 1e+170) {
tmp = 120.0 * a;
} else {
tmp = 60.0 * (x / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -5e+144: tmp = -60.0 * (y / z) elif t_1 <= 1e+170: tmp = 120.0 * a else: tmp = 60.0 * (x / (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 <= -5e+144) tmp = Float64(-60.0 * Float64(y / z)); elseif (t_1 <= 1e+170) tmp = Float64(120.0 * a); else tmp = Float64(60.0 * Float64(x / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+144) tmp = -60.0 * (y / z); elseif (t_1 <= 1e+170) tmp = 120.0 * a; else tmp = 60.0 * (x / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4999999999999999945435305910704598063392403130200679472590007732362651199555129074427056403228815030648329464160476949292016380761727168556302336], N[(-60 * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 100000000000000003441905430931245280917713770297417747470693647675065097962631447553892265814744827318497179085147422915077831721209019419643357959500300321574675254607872], N[(120 * a), $MachinePrecision], N[(60 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -4999999999999999945435305910704598063392403130200679472590007732362651199555129074427056403228815030648329464160476949292016380761727168556302336:\\
\;\;\;\;-60 \cdot \frac{y}{z}\\
\mathbf{elif}\;t\_1 \leq 100000000000000003441905430931245280917713770297417747470693647675065097962631447553892265814744827318497179085147422915077831721209019419643357959500300321574675254607872:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x}{z - t}\\
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.9999999999999999e144Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6428.2%
Applied rewrites28.2%
Taylor expanded in x around 0
Applied rewrites16.1%
if -4.9999999999999999e144 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1e170Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.2%
Applied rewrites51.2%
if 1e170 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
add-to-fractionN/A
mult-flipN/A
*-commutativeN/A
+-commutativeN/A
add-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites98.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6426.2%
Applied rewrites26.2%
(FPCore (x y z t a)
:precision binary64
(if (<=
(/ (* 60 (- x y)) (- z t))
-4999999999999999945435305910704598063392403130200679472590007732362651199555129074427056403228815030648329464160476949292016380761727168556302336)
(* -60 (/ y z))
(* 120 a)))double code(double x, double y, double z, double t, double a) {
double tmp;
if (((60.0 * (x - y)) / (z - t)) <= -5e+144) {
tmp = -60.0 * (y / 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 (((60.0d0 * (x - y)) / (z - t)) <= (-5d+144)) then
tmp = (-60.0d0) * (y / 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 (((60.0 * (x - y)) / (z - t)) <= -5e+144) {
tmp = -60.0 * (y / z);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((60.0 * (x - y)) / (z - t)) <= -5e+144: tmp = -60.0 * (y / z) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) <= -5e+144) tmp = Float64(-60.0 * Float64(y / z)); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((60.0 * (x - y)) / (z - t)) <= -5e+144) tmp = -60.0 * (y / z); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(60 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], -4999999999999999945435305910704598063392403130200679472590007732362651199555129074427056403228815030648329464160476949292016380761727168556302336], N[(-60 * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(120 * a), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{60 \cdot \left(x - y\right)}{z - t} \leq -4999999999999999945435305910704598063392403130200679472590007732362651199555129074427056403228815030648329464160476949292016380761727168556302336:\\
\;\;\;\;-60 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.9999999999999999e144Initial program 99.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6428.2%
Applied rewrites28.2%
Taylor expanded in x around 0
Applied rewrites16.1%
if -4.9999999999999999e144 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.2%
Applied rewrites51.2%
(FPCore (x y z t a) :precision binary64 (* 120 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 * a), $MachinePrecision]
120 \cdot a
Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.2%
Applied rewrites51.2%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
(+ (/ (* 60 (- x y)) (- z t)) (* a 120)))