
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / 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 = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - t\right)}{a}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / 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 = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - t\right)}{a}
(FPCore (x y z t a) :precision binary64 (134-z0z1z2z3z4 (/ 1 a) x a (- t z) y))
\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{a}\right), x, a, \left(t - z\right), y\right)
Initial program 93.6%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
*-commutativeN/A
*-rgt-identityN/A
associate-*l*N/A
*-commutativeN/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lower-134-z0z1z2z3z4N/A
lower-/.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (<=
t_1
-19999999999999999022865849278470264106778320922372433398933167781147023447499918366556775778344680456191750897534276513413896506501104986185271471852552907987540733076746850001554473076458172448768)
(+ x (* (/ (- z t) a) y))
(if (<=
t_1
1999999999999999876516601650563957080654054728944248956588832425077742983649199427273641055007816510603264)
(+ x (/ t_1 a))
(- x (* (/ y a) (- t z)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -2e+196) {
tmp = x + (((z - t) / a) * y);
} else if (t_1 <= 2e+105) {
tmp = x + (t_1 / a);
} else {
tmp = x - ((y / a) * (t - 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 = y * (z - t)
if (t_1 <= (-2d+196)) then
tmp = x + (((z - t) / a) * y)
else if (t_1 <= 2d+105) then
tmp = x + (t_1 / a)
else
tmp = x - ((y / a) * (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -2e+196) {
tmp = x + (((z - t) / a) * y);
} else if (t_1 <= 2e+105) {
tmp = x + (t_1 / a);
} else {
tmp = x - ((y / a) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -2e+196: tmp = x + (((z - t) / a) * y) elif t_1 <= 2e+105: tmp = x + (t_1 / a) else: tmp = x - ((y / a) * (t - z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -2e+196) tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * y)); elseif (t_1 <= 2e+105) tmp = Float64(x + Float64(t_1 / a)); else tmp = Float64(x - Float64(Float64(y / a) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -2e+196) tmp = x + (((z - t) / a) * y); elseif (t_1 <= 2e+105) tmp = x + (t_1 / a); else tmp = x - ((y / a) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -19999999999999999022865849278470264106778320922372433398933167781147023447499918366556775778344680456191750897534276513413896506501104986185271471852552907987540733076746850001554473076458172448768], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1999999999999999876516601650563957080654054728944248956588832425077742983649199427273641055007816510603264], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -19999999999999999022865849278470264106778320922372433398933167781147023447499918366556775778344680456191750897534276513413896506501104986185271471852552907987540733076746850001554473076458172448768:\\
\;\;\;\;x + \frac{z - t}{a} \cdot y\\
\mathbf{elif}\;t\_1 \leq 1999999999999999876516601650563957080654054728944248956588832425077742983649199427273641055007816510603264:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
if (*.f64 y (-.f64 z t)) < -1.9999999999999999e196Initial program 93.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
Applied rewrites93.6%
if -1.9999999999999999e196 < (*.f64 y (-.f64 z t)) < 1.9999999999999999e105Initial program 93.6%
if 1.9999999999999999e105 < (*.f64 y (-.f64 z t)) Initial program 93.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.2%
Applied rewrites97.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- z t) a) y))))
(if (<= a -2535301200456459/2535301200456458802993406410752)
t_1
(if (<=
a
5993757216606705/199791907220223502808422222706762643567910281130558153654986045416023791284464999687699590596063486154228923591770023865308670443474450259602571264)
(+ x (/ (* y (- z t)) a))
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((z - t) / a) * y);
double tmp;
if (a <= -1e-15) {
tmp = t_1;
} else if (a <= 3e-131) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((z - t) / a) * y)
if (a <= (-1d-15)) then
tmp = t_1
else if (a <= 3d-131) then
tmp = x + ((y * (z - t)) / a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((z - t) / a) * y);
double tmp;
if (a <= -1e-15) {
tmp = t_1;
} else if (a <= 3e-131) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((z - t) / a) * y) tmp = 0 if a <= -1e-15: tmp = t_1 elif a <= 3e-131: tmp = x + ((y * (z - t)) / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(z - t) / a) * y)) tmp = 0.0 if (a <= -1e-15) tmp = t_1; elseif (a <= 3e-131) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((z - t) / a) * y); tmp = 0.0; if (a <= -1e-15) tmp = t_1; elseif (a <= 3e-131) tmp = x + ((y * (z - t)) / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2535301200456459/2535301200456458802993406410752], t$95$1, If[LessEqual[a, 5993757216606705/199791907220223502808422222706762643567910281130558153654986045416023791284464999687699590596063486154228923591770023865308670443474450259602571264], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x + \frac{z - t}{a} \cdot y\\
\mathbf{if}\;a \leq \frac{-2535301200456459}{2535301200456458802993406410752}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq \frac{5993757216606705}{199791907220223502808422222706762643567910281130558153654986045416023791284464999687699590596063486154228923591770023865308670443474450259602571264}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -1.0000000000000001e-15 or 3e-131 < a Initial program 93.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
Applied rewrites93.6%
if -1.0000000000000001e-15 < a < 3e-131Initial program 93.6%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ (- z t) a) y)))
double code(double x, double y, double z, double t, double a) {
return x + (((z - t) / a) * y);
}
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 = x + (((z - t) / a) * y)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((z - t) / a) * y);
}
def code(x, y, z, t, a): return x + (((z - t) / a) * y)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(z - t) / a) * y)) end
function tmp = code(x, y, z, t, a) tmp = x + (((z - t) / a) * y); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
x + \frac{z - t}{a} \cdot y
Initial program 93.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
Applied rewrites93.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ y a) (- z t))))
(if (<=
t_1
-999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056)
t_2
(if (<=
t_1
-375375841440235/3753758414402350114985578847754628430655879796774751768338949695381315781309615853973705099290165690424277009592352731309591345333151121630880730453319952580019863461295451288668314174944572706159989883958951313077165169522342308559632306943619798833037312)
(- x (* (/ y a) t))
(if (<=
t_1
4999999999999999817033982815443287105513571612636783896840181921713543250771443712)
(+ x (* (/ z a) y))
t_2)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (y / a) * (z - t);
double tmp;
if (t_1 <= -1e+99) {
tmp = t_2;
} else if (t_1 <= -1e-241) {
tmp = x - ((y / a) * t);
} else if (t_1 <= 5e+81) {
tmp = x + ((z / a) * y);
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y * (z - t)) / a
t_2 = (y / a) * (z - t)
if (t_1 <= (-1d+99)) then
tmp = t_2
else if (t_1 <= (-1d-241)) then
tmp = x - ((y / a) * t)
else if (t_1 <= 5d+81) then
tmp = x + ((z / a) * y)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (y / a) * (z - t);
double tmp;
if (t_1 <= -1e+99) {
tmp = t_2;
} else if (t_1 <= -1e-241) {
tmp = x - ((y / a) * t);
} else if (t_1 <= 5e+81) {
tmp = x + ((z / a) * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (y / a) * (z - t) tmp = 0 if t_1 <= -1e+99: tmp = t_2 elif t_1 <= -1e-241: tmp = x - ((y / a) * t) elif t_1 <= 5e+81: tmp = x + ((z / a) * y) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) t_2 = Float64(Float64(y / a) * Float64(z - t)) tmp = 0.0 if (t_1 <= -1e+99) tmp = t_2; elseif (t_1 <= -1e-241) tmp = Float64(x - Float64(Float64(y / a) * t)); elseif (t_1 <= 5e+81) tmp = Float64(x + Float64(Float64(z / a) * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; t_2 = (y / a) * (z - t); tmp = 0.0; if (t_1 <= -1e+99) tmp = t_2; elseif (t_1 <= -1e-241) tmp = x - ((y / a) * t); elseif (t_1 <= 5e+81) tmp = x + ((z / a) * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056], t$95$2, If[LessEqual[t$95$1, -375375841440235/3753758414402350114985578847754628430655879796774751768338949695381315781309615853973705099290165690424277009592352731309591345333151121630880730453319952580019863461295451288668314174944572706159989883958951313077165169522342308559632306943619798833037312], N[(x - N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4999999999999999817033982815443287105513571612636783896840181921713543250771443712], N[(x + N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{-375375841440235}{3753758414402350114985578847754628430655879796774751768338949695381315781309615853973705099290165690424277009592352731309591345333151121630880730453319952580019863461295451288668314174944572706159989883958951313077165169522342308559632306943619798833037312}:\\
\;\;\;\;x - \frac{y}{a} \cdot t\\
\mathbf{elif}\;t\_1 \leq 4999999999999999817033982815443287105513571612636783896840181921713543250771443712:\\
\;\;\;\;x + \frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.9999999999999997e98 or 4.9999999999999998e81 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6459.7%
Applied rewrites59.7%
if -9.9999999999999997e98 < (/.f64 (*.f64 y (-.f64 z t)) a) < -9.9999999999999997e-242Initial program 93.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.2%
Applied rewrites97.2%
Taylor expanded in z around 0
Applied rewrites71.1%
if -9.9999999999999997e-242 < (/.f64 (*.f64 y (-.f64 z t)) a) < 4.9999999999999998e81Initial program 93.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
Applied rewrites93.6%
Taylor expanded in z around inf
lower-/.f6468.9%
Applied rewrites68.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ y a) (- z t))))
(if (<= t_1 -40000000000000001215144113708014667563008)
t_2
(if (<=
t_1
4999999999999999817033982815443287105513571612636783896840181921713543250771443712)
(+ x (* (/ z a) y))
t_2))))double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (y / a) * (z - t);
double tmp;
if (t_1 <= -4e+40) {
tmp = t_2;
} else if (t_1 <= 5e+81) {
tmp = x + ((z / a) * y);
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y * (z - t)) / a
t_2 = (y / a) * (z - t)
if (t_1 <= (-4d+40)) then
tmp = t_2
else if (t_1 <= 5d+81) then
tmp = x + ((z / a) * y)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (y / a) * (z - t);
double tmp;
if (t_1 <= -4e+40) {
tmp = t_2;
} else if (t_1 <= 5e+81) {
tmp = x + ((z / a) * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (y / a) * (z - t) tmp = 0 if t_1 <= -4e+40: tmp = t_2 elif t_1 <= 5e+81: tmp = x + ((z / a) * y) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) t_2 = Float64(Float64(y / a) * Float64(z - t)) tmp = 0.0 if (t_1 <= -4e+40) tmp = t_2; elseif (t_1 <= 5e+81) tmp = Float64(x + Float64(Float64(z / a) * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; t_2 = (y / a) * (z - t); tmp = 0.0; if (t_1 <= -4e+40) tmp = t_2; elseif (t_1 <= 5e+81) tmp = x + ((z / a) * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000000000001215144113708014667563008], t$95$2, If[LessEqual[t$95$1, 4999999999999999817033982815443287105513571612636783896840181921713543250771443712], N[(x + N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -40000000000000001215144113708014667563008:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4999999999999999817033982815443287105513571612636783896840181921713543250771443712:\\
\;\;\;\;x + \frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000001e40 or 4.9999999999999998e81 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6459.7%
Applied rewrites59.7%
if -4.0000000000000001e40 < (/.f64 (*.f64 y (-.f64 z t)) a) < 4.9999999999999998e81Initial program 93.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
Applied rewrites93.6%
Taylor expanded in z around inf
lower-/.f6468.9%
Applied rewrites68.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (<=
t_1
-19999999999999999022865849278470264106778320922372433398933167781147023447499918366556775778344680456191750897534276513413896506501104986185271471852552907987540733076746850001554473076458172448768)
(* (/ (- z t) a) y)
(if (<=
t_1
4999999999999999650599673463152198642336665750694884246307948430823614916415456951880981793447127233788614017024)
(/ t_1 a)
(* (/ y a) (- z t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -2e+196) {
tmp = ((z - t) / a) * y;
} else if (t_1 <= 5e+111) {
tmp = t_1 / a;
} else {
tmp = (y / a) * (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 = y * (z - t)
if (t_1 <= (-2d+196)) then
tmp = ((z - t) / a) * y
else if (t_1 <= 5d+111) then
tmp = t_1 / a
else
tmp = (y / a) * (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 = y * (z - t);
double tmp;
if (t_1 <= -2e+196) {
tmp = ((z - t) / a) * y;
} else if (t_1 <= 5e+111) {
tmp = t_1 / a;
} else {
tmp = (y / a) * (z - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -2e+196: tmp = ((z - t) / a) * y elif t_1 <= 5e+111: tmp = t_1 / a else: tmp = (y / a) * (z - t) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -2e+196) tmp = Float64(Float64(Float64(z - t) / a) * y); elseif (t_1 <= 5e+111) tmp = Float64(t_1 / a); else tmp = Float64(Float64(y / a) * Float64(z - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -2e+196) tmp = ((z - t) / a) * y; elseif (t_1 <= 5e+111) tmp = t_1 / a; else tmp = (y / a) * (z - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -19999999999999999022865849278470264106778320922372433398933167781147023447499918366556775778344680456191750897534276513413896506501104986185271471852552907987540733076746850001554473076458172448768], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 4999999999999999650599673463152198642336665750694884246307948430823614916415456951880981793447127233788614017024], N[(t$95$1 / a), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -19999999999999999022865849278470264106778320922372433398933167781147023447499918366556775778344680456191750897534276513413896506501104986185271471852552907987540733076746850001554473076458172448768:\\
\;\;\;\;\frac{z - t}{a} \cdot y\\
\mathbf{elif}\;t\_1 \leq 4999999999999999650599673463152198642336665750694884246307948430823614916415456951880981793447127233788614017024:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(z - t\right)\\
\end{array}
if (*.f64 y (-.f64 z t)) < -1.9999999999999999e196Initial program 93.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f6457.1%
Applied rewrites57.1%
if -1.9999999999999999e196 < (*.f64 y (-.f64 z t)) < 4.9999999999999997e111Initial program 93.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
if 4.9999999999999997e111 < (*.f64 y (-.f64 z t)) Initial program 93.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6459.7%
Applied rewrites59.7%
(FPCore (x y z t a) :precision binary64 (* (/ y a) (- z t)))
double code(double x, double y, double z, double t, double a) {
return (y / a) * (z - t);
}
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 = (y / a) * (z - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / a) * (z - t);
}
def code(x, y, z, t, a): return (y / a) * (z - t)
function code(x, y, z, t, a) return Float64(Float64(y / a) * Float64(z - t)) end
function tmp = code(x, y, z, t, a) tmp = (y / a) * (z - t); end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]
\frac{y}{a} \cdot \left(z - t\right)
Initial program 93.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6459.7%
Applied rewrites59.7%
(FPCore (x y z t a) :precision binary64 (* (/ y a) z))
double code(double x, double y, double z, double t, double a) {
return (y / a) * z;
}
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 = (y / a) * z
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / a) * z;
}
def code(x, y, z, t, a): return (y / a) * z
function code(x, y, z, t, a) return Float64(Float64(y / a) * z) end
function tmp = code(x, y, z, t, a) tmp = (y / a) * z; end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]
\frac{y}{a} \cdot z
Initial program 93.6%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
*-commutativeN/A
*-rgt-identityN/A
associate-*l*N/A
*-commutativeN/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lower-134-z0z1z2z3z4N/A
lower-/.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f6432.3%
Applied rewrites32.3%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6435.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-/.f6435.0%
Applied rewrites35.0%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
(+ x (/ (* y (- z t)) a)))