
(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 8 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 (- z t) y))
\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{a}\right), x, a, \left(z - t\right), y\right)
Initial program 93.6%
lift--.f64N/A
lift-/.f64N/A
sub-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
lower-134-z0z1z2z3z4N/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) (- 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 = x - (((z - t) / a) * y);
} else if (t_1 <= 2e+105) {
tmp = x - (t_1 / a);
} else {
tmp = x - ((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 = x - (((z - t) / a) * y)
else if (t_1 <= 2d+105) then
tmp = x - (t_1 / a)
else
tmp = x - ((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 = x - (((z - t) / a) * y);
} else if (t_1 <= 2e+105) {
tmp = x - (t_1 / a);
} else {
tmp = x - ((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 = x - (((z - t) / a) * y) elif t_1 <= 2e+105: tmp = x - (t_1 / a) else: tmp = x - ((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(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(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 = x - (((z - t) / a) * y); elseif (t_1 <= 2e+105) tmp = x - (t_1 / a); else tmp = x - ((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[(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[(z - t), $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(z - t\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
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6497.2%
Applied rewrites97.2%
(FPCore (x y z t a) :precision binary64 (- x (* (/ y a) (- z t))))
double code(double x, double y, double z, double t, double a) {
return x - ((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 = x - ((y / a) * (z - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y / a) * (z - t));
}
def code(x, y, z, t, a): return x - ((y / a) * (z - t))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y / a) * Float64(z - t))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y / a) * (z - t)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \frac{y}{a} \cdot \left(z - t\right)
Initial program 93.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6497.2%
Applied rewrites97.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ y a) (- t z))))
(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) * (t - z);
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) * (t - z)
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) * (t - z);
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) * (t - z) 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(t - z)) 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) * (t - z); 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[(t - z), $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(t - z\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%
lift--.f64N/A
lift-/.f64N/A
sub-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
lower-134-z0z1z2z3z4N/A
lower-/.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
lift--.f64N/A
sub-negate-revN/A
*-lft-identityN/A
lift-/.f64N/A
*-lft-identityN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.6%
Applied rewrites59.6%
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
*-commutativeN/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-/.f6469.0%
Applied rewrites69.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t z))) (t_2 (- x (/ (* y (- z t)) a))))
(if (<=
t_2
-100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336)
t_1
(if (<=
t_2
9999999999999999964372420736895110140590976995965873111133270039707753382929110612616471611327211972294570543930316627036907428807379455975076991793273996897499632136492752791807556010476755711238558435947154812096741376)
(/ (* y (- t z)) a)
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double t_2 = x - ((y * (z - t)) / a);
double tmp;
if (t_2 <= -1e+308) {
tmp = t_1;
} else if (t_2 <= 1e+220) {
tmp = (y * (t - z)) / a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y / a) * (t - z)
t_2 = x - ((y * (z - t)) / a)
if (t_2 <= (-1d+308)) then
tmp = t_1
else if (t_2 <= 1d+220) then
tmp = (y * (t - z)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double t_2 = x - ((y * (z - t)) / a);
double tmp;
if (t_2 <= -1e+308) {
tmp = t_1;
} else if (t_2 <= 1e+220) {
tmp = (y * (t - z)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (t - z) t_2 = x - ((y * (z - t)) / a) tmp = 0 if t_2 <= -1e+308: tmp = t_1 elif t_2 <= 1e+220: tmp = (y * (t - z)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(t - z)) t_2 = Float64(x - Float64(Float64(y * Float64(z - t)) / a)) tmp = 0.0 if (t_2 <= -1e+308) tmp = t_1; elseif (t_2 <= 1e+220) tmp = Float64(Float64(y * Float64(t - z)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (t - z); t_2 = x - ((y * (z - t)) / a); tmp = 0.0; if (t_2 <= -1e+308) tmp = t_1; elseif (t_2 <= 1e+220) tmp = (y * (t - z)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336], t$95$1, If[LessEqual[t$95$2, 9999999999999999964372420736895110140590976995965873111133270039707753382929110612616471611327211972294570543930316627036907428807379455975076991793273996897499632136492752791807556010476755711238558435947154812096741376], N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(t - z\right)\\
t_2 := x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_2 \leq -100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 9999999999999999964372420736895110140590976995965873111133270039707753382929110612616471611327211972294570543930316627036907428807379455975076991793273996897499632136492752791807556010476755711238558435947154812096741376:\\
\;\;\;\;\frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) < -1e308 or 1e220 < (-.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) Initial program 93.6%
lift--.f64N/A
lift-/.f64N/A
sub-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
lower-134-z0z1z2z3z4N/A
lower-/.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
lift--.f64N/A
sub-negate-revN/A
*-lft-identityN/A
lift-/.f64N/A
*-lft-identityN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.6%
Applied rewrites59.6%
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6459.7%
Applied rewrites59.7%
if -1e308 < (-.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) < 1e220Initial program 93.6%
lift--.f64N/A
lift-/.f64N/A
sub-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
lower-134-z0z1z2z3z4N/A
lower-/.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
(FPCore (x y z t a) :precision binary64 (* (/ y a) (- t z)))
double code(double x, double y, double z, double t, double a) {
return (y / a) * (t - 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) * (t - z)
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / a) * (t - z);
}
def code(x, y, z, t, a): return (y / a) * (t - z)
function code(x, y, z, t, a) return Float64(Float64(y / a) * Float64(t - z)) end
function tmp = code(x, y, z, t, a) tmp = (y / a) * (t - z); end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]
\frac{y}{a} \cdot \left(t - z\right)
Initial program 93.6%
lift--.f64N/A
lift-/.f64N/A
sub-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
lower-134-z0z1z2z3z4N/A
lower-/.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.9%
Applied rewrites56.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
lift--.f64N/A
sub-negate-revN/A
*-lft-identityN/A
lift-/.f64N/A
*-lft-identityN/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6459.6%
Applied rewrites59.6%
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6459.7%
Applied rewrites59.7%
(FPCore (x y z t a) :precision binary64 (* (/ y a) t))
double code(double x, double y, double z, double t, double a) {
return (y / a) * 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) * t
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / a) * t;
}
def code(x, y, z, t, a): return (y / a) * t
function code(x, y, z, t, a) return Float64(Float64(y / a) * t) end
function tmp = code(x, y, z, t, a) tmp = (y / a) * t; end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]
\frac{y}{a} \cdot t
Initial program 93.6%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6431.7%
Applied rewrites31.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6434.0%
Applied rewrites34.0%
(FPCore (x y z t a) :precision binary64 (* (/ t a) y))
double code(double x, double y, double z, double t, double a) {
return (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 = (t / a) * y
end function
public static double code(double x, double y, double z, double t, double a) {
return (t / a) * y;
}
def code(x, y, z, t, a): return (t / a) * y
function code(x, y, z, t, a) return Float64(Float64(t / a) * y) end
function tmp = code(x, y, z, t, a) tmp = (t / a) * y; end
code[x_, y_, z_, t_, a_] := N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]
\frac{t}{a} \cdot y
Initial program 93.6%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6431.7%
Applied rewrites31.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6431.8%
Applied rewrites31.8%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
(- x (/ (* y (- z t)) a)))