
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (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 = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (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 = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -1e-218)
t_1
(if (<= t_2 1e-301) (+ (- (/ (* (- y x) (- z a)) t)) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -1e-218) {
tmp = t_1;
} else if (t_2 <= 1e-301) {
tmp = -(((y - x) * (z - a)) / t) + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -1e-218) tmp = t_1; elseif (t_2 <= 1e-301) tmp = Float64(Float64(-Float64(Float64(Float64(y - x) * Float64(z - a)) / t)) + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-218], t$95$1, If[LessEqual[t$95$2, 1e-301], N[((-N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]) + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-218}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-301}:\\
\;\;\;\;\left(-\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}\right) + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1e-218 or 1.00000000000000007e-301 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 67.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6483.4
Applied rewrites83.4%
if -1e-218 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 1.00000000000000007e-301Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) z y)))
(if (<= t -1.12e+79)
t_1
(if (<= t -1.8e-64)
(+ x (/ (* y (- z t)) (- a t)))
(if (<= t 2.7e+23) (fma (- y x) (/ (- z t) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), z, y);
double tmp;
if (t <= -1.12e+79) {
tmp = t_1;
} else if (t <= -1.8e-64) {
tmp = x + ((y * (z - t)) / (a - t));
} else if (t <= 2.7e+23) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), z, y) tmp = 0.0 if (t <= -1.12e+79) tmp = t_1; elseif (t <= -1.8e-64) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))); elseif (t <= 2.7e+23) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t, -1.12e+79], t$95$1, If[LessEqual[t, -1.8e-64], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e+23], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{if}\;t \leq -1.12 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-64}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.12e79 or 2.6999999999999999e23 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if -1.12e79 < t < -1.7999999999999999e-64Initial program 67.5%
Taylor expanded in x around 0
Applied rewrites54.4%
if -1.7999999999999999e-64 < t < 2.6999999999999999e23Initial program 67.5%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) z y)))
(if (<= t -1.25e+43)
t_1
(if (<= t 2.7e+23) (fma (- y x) (/ (- z t) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), z, y);
double tmp;
if (t <= -1.25e+43) {
tmp = t_1;
} else if (t <= 2.7e+23) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), z, y) tmp = 0.0 if (t <= -1.25e+43) tmp = t_1; elseif (t <= 2.7e+23) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t, -1.25e+43], t$95$1, If[LessEqual[t, 2.7e+23], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.2500000000000001e43 or 2.6999999999999999e23 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if -1.2500000000000001e43 < t < 2.6999999999999999e23Initial program 67.5%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) z y)))
(if (<= t -7.5e-34)
t_1
(if (<= t 1950000000000.0) (fma (- y x) (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), z, y);
double tmp;
if (t <= -7.5e-34) {
tmp = t_1;
} else if (t <= 1950000000000.0) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), z, y) tmp = 0.0 if (t <= -7.5e-34) tmp = t_1; elseif (t <= 1950000000000.0) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t, -7.5e-34], t$95$1, If[LessEqual[t, 1950000000000.0], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1950000000000:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5000000000000004e-34 or 1.95e12 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if -7.5000000000000004e-34 < t < 1.95e12Initial program 67.5%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6452.5
Applied rewrites52.5%
Taylor expanded in z around inf
lower-/.f6448.0
Applied rewrites48.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) z y)))
(if (<= t -7.5e-34)
t_1
(if (<= t 1950000000000.0) (fma z (/ (- y x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), z, y);
double tmp;
if (t <= -7.5e-34) {
tmp = t_1;
} else if (t <= 1950000000000.0) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), z, y) tmp = 0.0 if (t <= -7.5e-34) tmp = t_1; elseif (t <= 1950000000000.0) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t, -7.5e-34], t$95$1, If[LessEqual[t, 1950000000000.0], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1950000000000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5000000000000004e-34 or 1.95e12 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if -7.5000000000000004e-34 < t < 1.95e12Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x y) t) z y)))
(if (<= t -7.5e-34)
t_1
(if (<= t 1200000000000.0) (* (- 1.0 (/ z a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), z, y);
double tmp;
if (t <= -7.5e-34) {
tmp = t_1;
} else if (t <= 1200000000000.0) {
tmp = (1.0 - (z / a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), z, y) tmp = 0.0 if (t <= -7.5e-34) tmp = t_1; elseif (t <= 1200000000000.0) tmp = Float64(Float64(1.0 - Float64(z / a)) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t, -7.5e-34], t$95$1, If[LessEqual[t, 1200000000000.0], N[(N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1200000000000:\\
\;\;\;\;\left(1 - \frac{z}{a}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5000000000000004e-34 or 1.2e12 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if -7.5000000000000004e-34 < t < 1.2e12Initial program 67.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
lower--.f64N/A
lower-/.f6435.7
Applied rewrites35.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -7.5e-34) (- y (/ (* z (- x)) t)) (if (<= t 2e+87) (* (- 1.0 (/ z a)) x) (* (- 1.0 (/ z t)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.5e-34) {
tmp = y - ((z * -x) / t);
} else if (t <= 2e+87) {
tmp = (1.0 - (z / a)) * x;
} else {
tmp = (1.0 - (z / t)) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-7.5d-34)) then
tmp = y - ((z * -x) / t)
else if (t <= 2d+87) then
tmp = (1.0d0 - (z / a)) * x
else
tmp = (1.0d0 - (z / t)) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.5e-34) {
tmp = y - ((z * -x) / t);
} else if (t <= 2e+87) {
tmp = (1.0 - (z / a)) * x;
} else {
tmp = (1.0 - (z / t)) * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7.5e-34: tmp = y - ((z * -x) / t) elif t <= 2e+87: tmp = (1.0 - (z / a)) * x else: tmp = (1.0 - (z / t)) * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.5e-34) tmp = Float64(y - Float64(Float64(z * Float64(-x)) / t)); elseif (t <= 2e+87) tmp = Float64(Float64(1.0 - Float64(z / a)) * x); else tmp = Float64(Float64(1.0 - Float64(z / t)) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7.5e-34) tmp = y - ((z * -x) / t); elseif (t <= 2e+87) tmp = (1.0 - (z / a)) * x; else tmp = (1.0 - (z / t)) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.5e-34], N[(y - N[(N[(z * (-x)), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+87], N[(N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-34}:\\
\;\;\;\;y - \frac{z \cdot \left(-x\right)}{t}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+87}:\\
\;\;\;\;\left(1 - \frac{z}{a}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{z}{t}\right) \cdot y\\
\end{array}
\end{array}
if t < -7.5000000000000004e-34Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6438.6
Applied rewrites38.6%
if -7.5000000000000004e-34 < t < 1.9999999999999999e87Initial program 67.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
lower--.f64N/A
lower-/.f6435.7
Applied rewrites35.7%
if 1.9999999999999999e87 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- 1.0 (/ z t)) y))) (if (<= t -7.5e-34) t_1 (if (<= t 2e+87) (* (- 1.0 (/ z a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 - (z / t)) * y;
double tmp;
if (t <= -7.5e-34) {
tmp = t_1;
} else if (t <= 2e+87) {
tmp = (1.0 - (z / a)) * x;
} 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 = (1.0d0 - (z / t)) * y
if (t <= (-7.5d-34)) then
tmp = t_1
else if (t <= 2d+87) then
tmp = (1.0d0 - (z / a)) * x
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 = (1.0 - (z / t)) * y;
double tmp;
if (t <= -7.5e-34) {
tmp = t_1;
} else if (t <= 2e+87) {
tmp = (1.0 - (z / a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (1.0 - (z / t)) * y tmp = 0 if t <= -7.5e-34: tmp = t_1 elif t <= 2e+87: tmp = (1.0 - (z / a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 - Float64(z / t)) * y) tmp = 0.0 if (t <= -7.5e-34) tmp = t_1; elseif (t <= 2e+87) tmp = Float64(Float64(1.0 - Float64(z / a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (1.0 - (z / t)) * y; tmp = 0.0; if (t <= -7.5e-34) tmp = t_1; elseif (t <= 2e+87) tmp = (1.0 - (z / a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t, -7.5e-34], t$95$1, If[LessEqual[t, 2e+87], N[(N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \frac{z}{t}\right) \cdot y\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+87}:\\
\;\;\;\;\left(1 - \frac{z}{a}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5000000000000004e-34 or 1.9999999999999999e87 < t Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
if -7.5000000000000004e-34 < t < 1.9999999999999999e87Initial program 67.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
lower--.f64N/A
lower-/.f6435.7
Applied rewrites35.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma z (/ y a) x))) (if (<= a -9.5e+14) t_1 (if (<= a 1e-50) (* (- 1.0 (/ z t)) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, (y / a), x);
double tmp;
if (a <= -9.5e+14) {
tmp = t_1;
} else if (a <= 1e-50) {
tmp = (1.0 - (z / t)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(y / a), x) tmp = 0.0 if (a <= -9.5e+14) tmp = t_1; elseif (a <= 1e-50) tmp = Float64(Float64(1.0 - Float64(z / t)) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -9.5e+14], t$95$1, If[LessEqual[a, 1e-50], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -9.5 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 10^{-50}:\\
\;\;\;\;\left(1 - \frac{z}{t}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -9.5e14 or 1.00000000000000001e-50 < a Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in x around 0
Applied rewrites38.8%
if -9.5e14 < a < 1.00000000000000001e-50Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- y x) 1.0 x))) (if (<= t -1.2e+87) t_1 (if (<= t 2.5e+87) (fma z (/ y a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), 1.0, x);
double tmp;
if (t <= -1.2e+87) {
tmp = t_1;
} else if (t <= 2.5e+87) {
tmp = fma(z, (y / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), 1.0, x) tmp = 0.0 if (t <= -1.2e+87) tmp = t_1; elseif (t <= 2.5e+87) tmp = fma(z, 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 - x), $MachinePrecision] * 1.0 + x), $MachinePrecision]}, If[LessEqual[t, -1.2e+87], t$95$1, If[LessEqual[t, 2.5e+87], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, 1, x\right)\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.19999999999999991e87 or 2.4999999999999999e87 < t Initial program 67.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6483.4
Applied rewrites83.4%
Taylor expanded in t around inf
Applied rewrites19.6%
if -1.19999999999999991e87 < t < 2.4999999999999999e87Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in x around 0
Applied rewrites38.8%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.25e+56) (- (* x (/ z a))) (if (<= x 8.4e-97) (fma (- y x) 1.0 x) (* z (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.25e+56) {
tmp = -(x * (z / a));
} else if (x <= 8.4e-97) {
tmp = fma((y - x), 1.0, x);
} else {
tmp = z * (x / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.25e+56) tmp = Float64(-Float64(x * Float64(z / a))); elseif (x <= 8.4e-97) tmp = fma(Float64(y - x), 1.0, x); else tmp = Float64(z * Float64(x / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.25e+56], (-N[(x * N[(z / a), $MachinePrecision]), $MachinePrecision]), If[LessEqual[x, 8.4e-97], N[(N[(y - x), $MachinePrecision] * 1.0 + x), $MachinePrecision], N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+56}:\\
\;\;\;\;-x \cdot \frac{z}{a}\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{-97}:\\
\;\;\;\;\mathsf{fma}\left(y - x, 1, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{t}\\
\end{array}
\end{array}
if x < -1.25000000000000006e56Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in z around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6423.8
Applied rewrites23.8%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6414.5
Applied rewrites14.5%
if -1.25000000000000006e56 < x < 8.4000000000000005e-97Initial program 67.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6483.4
Applied rewrites83.4%
Taylor expanded in t around inf
Applied rewrites19.6%
if 8.4000000000000005e-97 < x Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.7
Applied rewrites25.7%
Taylor expanded in x around inf
lower-/.f6418.1
Applied rewrites18.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.15e-117) (- (* x (/ z a))) (if (<= x 5.8e-97) (* y (/ z a)) (* z (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.15e-117) {
tmp = -(x * (z / a));
} else if (x <= 5.8e-97) {
tmp = y * (z / a);
} else {
tmp = z * (x / t);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (x <= (-1.15d-117)) then
tmp = -(x * (z / a))
else if (x <= 5.8d-97) then
tmp = y * (z / a)
else
tmp = z * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.15e-117) {
tmp = -(x * (z / a));
} else if (x <= 5.8e-97) {
tmp = y * (z / a);
} else {
tmp = z * (x / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.15e-117: tmp = -(x * (z / a)) elif x <= 5.8e-97: tmp = y * (z / a) else: tmp = z * (x / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.15e-117) tmp = Float64(-Float64(x * Float64(z / a))); elseif (x <= 5.8e-97) tmp = Float64(y * Float64(z / a)); else tmp = Float64(z * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.15e-117) tmp = -(x * (z / a)); elseif (x <= 5.8e-97) tmp = y * (z / a); else tmp = z * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.15e-117], (-N[(x * N[(z / a), $MachinePrecision]), $MachinePrecision]), If[LessEqual[x, 5.8e-97], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-117}:\\
\;\;\;\;-x \cdot \frac{z}{a}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-97}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{t}\\
\end{array}
\end{array}
if x < -1.14999999999999997e-117Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in z around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6423.8
Applied rewrites23.8%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6414.5
Applied rewrites14.5%
if -1.14999999999999997e-117 < x < 5.7999999999999999e-97Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6416.2
Applied rewrites16.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6418.7
Applied rewrites18.7%
if 5.7999999999999999e-97 < x Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.7
Applied rewrites25.7%
Taylor expanded in x around inf
lower-/.f6418.1
Applied rewrites18.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ z a)))) (if (<= y -4.2e+111) t_1 (if (<= y 2.75e+53) (* z (/ x t)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / a);
double tmp;
if (y <= -4.2e+111) {
tmp = t_1;
} else if (y <= 2.75e+53) {
tmp = z * (x / t);
} 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 = y * (z / a)
if (y <= (-4.2d+111)) then
tmp = t_1
else if (y <= 2.75d+53) then
tmp = z * (x / t)
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 * (z / a);
double tmp;
if (y <= -4.2e+111) {
tmp = t_1;
} else if (y <= 2.75e+53) {
tmp = z * (x / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / a) tmp = 0 if y <= -4.2e+111: tmp = t_1 elif y <= 2.75e+53: tmp = z * (x / t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / a)) tmp = 0.0 if (y <= -4.2e+111) tmp = t_1; elseif (y <= 2.75e+53) tmp = Float64(z * Float64(x / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / a); tmp = 0.0; if (y <= -4.2e+111) tmp = t_1; elseif (y <= 2.75e+53) tmp = z * (x / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.2e+111], t$95$1, If[LessEqual[y, 2.75e+53], N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{a}\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{+53}:\\
\;\;\;\;z \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.1999999999999999e111 or 2.74999999999999988e53 < y Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6416.2
Applied rewrites16.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6418.7
Applied rewrites18.7%
if -4.1999999999999999e111 < y < 2.74999999999999988e53Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.7
Applied rewrites25.7%
Taylor expanded in x around inf
lower-/.f6418.1
Applied rewrites18.1%
(FPCore (x y z t a) :precision binary64 (if (<= y 2.75e+53) (* (/ z t) x) (* y (/ z a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 2.75e+53) {
tmp = (z / t) * x;
} else {
tmp = y * (z / a);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= 2.75d+53) then
tmp = (z / t) * x
else
tmp = y * (z / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 2.75e+53) {
tmp = (z / t) * x;
} else {
tmp = y * (z / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 2.75e+53: tmp = (z / t) * x else: tmp = y * (z / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 2.75e+53) tmp = Float64(Float64(z / t) * x); else tmp = Float64(y * Float64(z / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 2.75e+53) tmp = (z / t) * x; else tmp = y * (z / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 2.75e+53], N[(N[(z / t), $MachinePrecision] * x), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.75 \cdot 10^{+53}:\\
\;\;\;\;\frac{z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if y < 2.74999999999999988e53Initial program 67.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in a around 0
lower-/.f6418.9
Applied rewrites18.9%
if 2.74999999999999988e53 < y Initial program 67.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6446.7
Applied rewrites46.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6416.2
Applied rewrites16.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6418.7
Applied rewrites18.7%
(FPCore (x y z t a) :precision binary64 (* z (/ x t)))
double code(double x, double y, double z, double t, double a) {
return z * (x / 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 = z * (x / t)
end function
public static double code(double x, double y, double z, double t, double a) {
return z * (x / t);
}
def code(x, y, z, t, a): return z * (x / t)
function code(x, y, z, t, a) return Float64(z * Float64(x / t)) end
function tmp = code(x, y, z, t, a) tmp = z * (x / t); end
code[x_, y_, z_, t_, a_] := N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \frac{x}{t}
\end{array}
Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.7
Applied rewrites25.7%
Taylor expanded in x around inf
lower-/.f6418.1
Applied rewrites18.1%
(FPCore (x y z t a) :precision binary64 (/ (* z x) t))
double code(double x, double y, double z, double t, double a) {
return (z * x) / 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 = (z * x) / t
end function
public static double code(double x, double y, double z, double t, double a) {
return (z * x) / t;
}
def code(x, y, z, t, a): return (z * x) / t
function code(x, y, z, t, a) return Float64(Float64(z * x) / t) end
function tmp = code(x, y, z, t, a) tmp = (z * x) / t; end
code[x_, y_, z_, t_, a_] := N[(N[(z * x), $MachinePrecision] / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{z \cdot x}{t}
\end{array}
Initial program 67.5%
Taylor expanded in t around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.7
Applied rewrites25.7%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f6416.6
Applied rewrites16.6%
herbie shell --seed 2025142
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y x) (- z t)) (- a t))))