
(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]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Herbie found 11 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]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (- z t) (/ y a) x))
double code(double x, double y, double z, double t, double a) {
return fma((z - t), (y / a), x);
}
function code(x, y, z, t, a) return fma(Float64(z - t), Float64(y / a), x) end
code[x_, y_, z_, t_, a_] := N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)
\end{array}
Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6497.3
Applied rewrites97.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) z x)))
(if (<= z -2.1e+57)
t_1
(if (<= z 3250000000000.0) (fma (- t) (/ y a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (z <= -2.1e+57) {
tmp = t_1;
} else if (z <= 3250000000000.0) {
tmp = fma(-t, (y / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (z <= -2.1e+57) tmp = t_1; elseif (z <= 3250000000000.0) tmp = fma(Float64(-t), Float64(y / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -2.1e+57], t$95$1, If[LessEqual[z, 3250000000000.0], N[((-t) * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3250000000000:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.09999999999999991e57 or 3.25e12 < z Initial program 93.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
if -2.09999999999999991e57 < z < 3.25e12Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6497.3
Applied rewrites97.3%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6471.5
Applied rewrites71.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) z x)))
(if (<= z -1.2e+57)
t_1
(if (<= z 3250000000000.0) (- x (* y (/ t a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (z <= -1.2e+57) {
tmp = t_1;
} else if (z <= 3250000000000.0) {
tmp = x - (y * (t / a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (z <= -1.2e+57) tmp = t_1; elseif (z <= 3250000000000.0) tmp = Float64(x - Float64(y * Float64(t / a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -1.2e+57], t$95$1, If[LessEqual[z, 3250000000000.0], N[(x - N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3250000000000:\\
\;\;\;\;x - y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.20000000000000002e57 or 3.25e12 < z Initial program 93.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
if -1.20000000000000002e57 < z < 3.25e12Initial program 93.2%
Taylor expanded in z around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -8e+133) (/ (* (- t) y) a) (if (<= t 1.05e+141) (fma (/ y a) z x) (* (/ y a) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e+133) {
tmp = (-t * y) / a;
} else if (t <= 1.05e+141) {
tmp = fma((y / a), z, x);
} else {
tmp = (y / a) * -t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e+133) tmp = Float64(Float64(Float64(-t) * y) / a); elseif (t <= 1.05e+141) tmp = fma(Float64(y / a), z, x); else tmp = Float64(Float64(y / a) * Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e+133], N[(N[((-t) * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t, 1.05e+141], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+133}:\\
\;\;\;\;\frac{\left(-t\right) \cdot y}{a}\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -8.0000000000000002e133Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in t around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6431.4
Applied rewrites31.4%
if -8.0000000000000002e133 < t < 1.0499999999999999e141Initial program 93.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
if 1.0499999999999999e141 < t Initial program 93.2%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6434.0
Applied rewrites34.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)))
(if (<= t_1 -2e+92)
(* (/ y a) (- t))
(if (<= t_1 1e-20)
x
(if (<= t_1 5e+127) (/ (* (- t) y) a) (* (/ y a) z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if (t_1 <= -2e+92) {
tmp = (y / a) * -t;
} else if (t_1 <= 1e-20) {
tmp = x;
} else if (t_1 <= 5e+127) {
tmp = (-t * y) / a;
} else {
tmp = (y / a) * 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)) / a
if (t_1 <= (-2d+92)) then
tmp = (y / a) * -t
else if (t_1 <= 1d-20) then
tmp = x
else if (t_1 <= 5d+127) then
tmp = (-t * y) / a
else
tmp = (y / a) * 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)) / a;
double tmp;
if (t_1 <= -2e+92) {
tmp = (y / a) * -t;
} else if (t_1 <= 1e-20) {
tmp = x;
} else if (t_1 <= 5e+127) {
tmp = (-t * y) / a;
} else {
tmp = (y / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a tmp = 0 if t_1 <= -2e+92: tmp = (y / a) * -t elif t_1 <= 1e-20: tmp = x elif t_1 <= 5e+127: tmp = (-t * y) / a else: tmp = (y / a) * z return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) tmp = 0.0 if (t_1 <= -2e+92) tmp = Float64(Float64(y / a) * Float64(-t)); elseif (t_1 <= 1e-20) tmp = x; elseif (t_1 <= 5e+127) tmp = Float64(Float64(Float64(-t) * y) / a); else tmp = Float64(Float64(y / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; tmp = 0.0; if (t_1 <= -2e+92) tmp = (y / a) * -t; elseif (t_1 <= 1e-20) tmp = x; elseif (t_1 <= 5e+127) tmp = (-t * y) / a; else tmp = (y / a) * z; 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]}, If[LessEqual[t$95$1, -2e+92], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[t$95$1, 1e-20], x, If[LessEqual[t$95$1, 5e+127], N[(N[((-t) * y), $MachinePrecision] / a), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+127}:\\
\;\;\;\;\frac{\left(-t\right) \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -2.0000000000000001e92Initial program 93.2%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6434.0
Applied rewrites34.0%
if -2.0000000000000001e92 < (/.f64 (*.f64 y (-.f64 z t)) a) < 9.99999999999999945e-21Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
if 9.99999999999999945e-21 < (/.f64 (*.f64 y (-.f64 z t)) a) < 5.0000000000000004e127Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in t around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6431.4
Applied rewrites31.4%
if 5.0000000000000004e127 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lift-/.f6434.4
Applied rewrites34.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)))
(if (<= t_1 -2e+92)
(* (/ y a) (- t))
(if (<= t_1 1e-20)
x
(if (<= t_1 5e+127) (- (* (/ t a) y)) (* (/ y a) z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if (t_1 <= -2e+92) {
tmp = (y / a) * -t;
} else if (t_1 <= 1e-20) {
tmp = x;
} else if (t_1 <= 5e+127) {
tmp = -((t / a) * y);
} else {
tmp = (y / a) * 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)) / a
if (t_1 <= (-2d+92)) then
tmp = (y / a) * -t
else if (t_1 <= 1d-20) then
tmp = x
else if (t_1 <= 5d+127) then
tmp = -((t / a) * y)
else
tmp = (y / a) * 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)) / a;
double tmp;
if (t_1 <= -2e+92) {
tmp = (y / a) * -t;
} else if (t_1 <= 1e-20) {
tmp = x;
} else if (t_1 <= 5e+127) {
tmp = -((t / a) * y);
} else {
tmp = (y / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a tmp = 0 if t_1 <= -2e+92: tmp = (y / a) * -t elif t_1 <= 1e-20: tmp = x elif t_1 <= 5e+127: tmp = -((t / a) * y) else: tmp = (y / a) * z return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) tmp = 0.0 if (t_1 <= -2e+92) tmp = Float64(Float64(y / a) * Float64(-t)); elseif (t_1 <= 1e-20) tmp = x; elseif (t_1 <= 5e+127) tmp = Float64(-Float64(Float64(t / a) * y)); else tmp = Float64(Float64(y / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; tmp = 0.0; if (t_1 <= -2e+92) tmp = (y / a) * -t; elseif (t_1 <= 1e-20) tmp = x; elseif (t_1 <= 5e+127) tmp = -((t / a) * y); else tmp = (y / a) * z; 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]}, If[LessEqual[t$95$1, -2e+92], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[t$95$1, 1e-20], x, If[LessEqual[t$95$1, 5e+127], (-N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]), N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+127}:\\
\;\;\;\;-\frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -2.0000000000000001e92Initial program 93.2%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6434.0
Applied rewrites34.0%
if -2.0000000000000001e92 < (/.f64 (*.f64 y (-.f64 z t)) a) < 9.99999999999999945e-21Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
if 9.99999999999999945e-21 < (/.f64 (*.f64 y (-.f64 z t)) a) < 5.0000000000000004e127Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in t around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6431.4
Applied rewrites31.4%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6431.6
Applied rewrites31.6%
if 5.0000000000000004e127 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lift-/.f6434.4
Applied rewrites34.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ y a) (- t))))
(if (<= t_1 -2e+92)
t_2
(if (<= t_1 1e-20) x (if (<= t_1 5e+127) t_2 (* (/ y a) z))))))
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;
double tmp;
if (t_1 <= -2e+92) {
tmp = t_2;
} else if (t_1 <= 1e-20) {
tmp = x;
} else if (t_1 <= 5e+127) {
tmp = t_2;
} else {
tmp = (y / a) * 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) :: t_2
real(8) :: tmp
t_1 = (y * (z - t)) / a
t_2 = (y / a) * -t
if (t_1 <= (-2d+92)) then
tmp = t_2
else if (t_1 <= 1d-20) then
tmp = x
else if (t_1 <= 5d+127) then
tmp = t_2
else
tmp = (y / a) * 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)) / a;
double t_2 = (y / a) * -t;
double tmp;
if (t_1 <= -2e+92) {
tmp = t_2;
} else if (t_1 <= 1e-20) {
tmp = x;
} else if (t_1 <= 5e+127) {
tmp = t_2;
} else {
tmp = (y / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (y / a) * -t tmp = 0 if t_1 <= -2e+92: tmp = t_2 elif t_1 <= 1e-20: tmp = x elif t_1 <= 5e+127: tmp = t_2 else: tmp = (y / a) * z 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)) tmp = 0.0 if (t_1 <= -2e+92) tmp = t_2; elseif (t_1 <= 1e-20) tmp = x; elseif (t_1 <= 5e+127) tmp = t_2; else tmp = Float64(Float64(y / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; t_2 = (y / a) * -t; tmp = 0.0; if (t_1 <= -2e+92) tmp = t_2; elseif (t_1 <= 1e-20) tmp = x; elseif (t_1 <= 5e+127) tmp = t_2; else tmp = (y / a) * z; 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] * (-t)), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+92], t$95$2, If[LessEqual[t$95$1, 1e-20], x, If[LessEqual[t$95$1, 5e+127], t$95$2, N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \frac{y}{a} \cdot \left(-t\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+127}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -2.0000000000000001e92 or 9.99999999999999945e-21 < (/.f64 (*.f64 y (-.f64 z t)) a) < 5.0000000000000004e127Initial program 93.2%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6434.0
Applied rewrites34.0%
if -2.0000000000000001e92 < (/.f64 (*.f64 y (-.f64 z t)) a) < 9.99999999999999945e-21Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
if 5.0000000000000004e127 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lift-/.f6434.4
Applied rewrites34.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ y a) z))) (if (<= t_1 -1e+98) t_2 (if (<= t_1 2e+62) x 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;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= 2e+62) {
tmp = x;
} 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
if (t_1 <= (-1d+98)) then
tmp = t_2
else if (t_1 <= 2d+62) then
tmp = x
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;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= 2e+62) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (y / a) * z tmp = 0 if t_1 <= -1e+98: tmp = t_2 elif t_1 <= 2e+62: tmp = x 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) * z) tmp = 0.0 if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= 2e+62) tmp = x; 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; tmp = 0.0; if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= 2e+62) tmp = x; 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] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+98], t$95$2, If[LessEqual[t$95$1, 2e+62], x, t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \frac{y}{a} \cdot z\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999998e97 or 2.00000000000000007e62 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites90.7%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lift-/.f6434.4
Applied rewrites34.4%
if -9.99999999999999998e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2.00000000000000007e62Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ z a) y)))
(if (<= t_1 -1e+98)
t_2
(if (<= t_1 2e+62) x (if (<= t_1 4e+301) (/ (* z y) a) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (z / a) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= 2e+62) {
tmp = x;
} else if (t_1 <= 4e+301) {
tmp = (z * y) / a;
} 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 = (z / a) * y
if (t_1 <= (-1d+98)) then
tmp = t_2
else if (t_1 <= 2d+62) then
tmp = x
else if (t_1 <= 4d+301) then
tmp = (z * y) / a
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 = (z / a) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= 2e+62) {
tmp = x;
} else if (t_1 <= 4e+301) {
tmp = (z * y) / a;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (z / a) * y tmp = 0 if t_1 <= -1e+98: tmp = t_2 elif t_1 <= 2e+62: tmp = x elif t_1 <= 4e+301: tmp = (z * y) / a 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(z / a) * y) tmp = 0.0 if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= 2e+62) tmp = x; elseif (t_1 <= 4e+301) tmp = Float64(Float64(z * y) / a); 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 = (z / a) * y; tmp = 0.0; if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= 2e+62) tmp = x; elseif (t_1 <= 4e+301) tmp = (z * y) / a; 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[(z / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+98], t$95$2, If[LessEqual[t$95$1, 2e+62], x, If[LessEqual[t$95$1, 4e+301], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \frac{z}{a} \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+301}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999998e97 or 4.00000000000000021e301 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6431.6
Applied rewrites31.6%
if -9.99999999999999998e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2.00000000000000007e62Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
if 2.00000000000000007e62 < (/.f64 (*.f64 y (-.f64 z t)) a) < 4.00000000000000021e301Initial program 93.2%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6431.6
Applied rewrites31.6%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.7
Applied rewrites31.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ z a) y))) (if (<= t_1 -1e+98) t_2 (if (<= t_1 2e+62) x t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (z / a) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= 2e+62) {
tmp = x;
} 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 = (z / a) * y
if (t_1 <= (-1d+98)) then
tmp = t_2
else if (t_1 <= 2d+62) then
tmp = x
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 = (z / a) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= 2e+62) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (z / a) * y tmp = 0 if t_1 <= -1e+98: tmp = t_2 elif t_1 <= 2e+62: tmp = x 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(z / a) * y) tmp = 0.0 if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= 2e+62) tmp = x; 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 = (z / a) * y; tmp = 0.0; if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= 2e+62) tmp = x; 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[(z / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+98], t$95$2, If[LessEqual[t$95$1, 2e+62], x, t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \frac{z}{a} \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999998e97 or 2.00000000000000007e62 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6431.6
Applied rewrites31.6%
if -9.99999999999999998e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2.00000000000000007e62Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.2%
Taylor expanded in x around inf
Applied rewrites39.9%
herbie shell --seed 2025123
(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)))