
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-296)
t_2
(if (<= t_2 0.0)
(fma (/ (* (- t x) (- y a)) z) -1.0 t)
(if (<= t_2 1e+285) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-296) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
} else if (t_2 <= 1e+285) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-296) tmp = t_2; elseif (t_2 <= 0.0) tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); elseif (t_2 <= 1e+285) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-296], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], If[LessEqual[t$95$2, 1e+285], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+285}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0 or 9.9999999999999998e284 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 41.0%
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--.f6482.8
Applied rewrites82.8%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2e-296 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 9.9999999999999998e284Initial program 97.0%
if -2e-296 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 5.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites97.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 -2e-296)
t_1
(if (<= t_2 0.0) (fma (/ (* (- t x) (- y a)) z) -1.0 t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -2e-296) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= -2e-296) tmp = t_1; elseif (t_2 <= 0.0) tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-296], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2e-296 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 73.9%
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--.f6486.3
Applied rewrites86.3%
if -2e-296 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 5.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites97.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 -2e-296)
t_1
(if (<= t_2 0.0) (fma (/ (* y (- t x)) z) -1.0 t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -2e-296) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = fma(((y * (t - x)) / z), -1.0, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= -2e-296) tmp = t_1; elseif (t_2 <= 0.0) tmp = fma(Float64(Float64(y * Float64(t - x)) / z), -1.0, t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-296], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-296}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{y \cdot \left(t - x\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2e-296 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 73.9%
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--.f6486.3
Applied rewrites86.3%
if -2e-296 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 5.9%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites97.6%
Taylor expanded in a around 0
lower-*.f64N/A
lift--.f6467.8
Applied rewrites67.8%
(FPCore (x y z t a) :precision binary64 (fma -1.0 (* x (- (/ y (- a z)) (+ 1.0 (/ z (- a z))))) (* t (/ (- y z) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return fma(-1.0, (x * ((y / (a - z)) - (1.0 + (z / (a - z))))), (t * ((y - z) / (a - z))));
}
function code(x, y, z, t, a) return fma(-1.0, Float64(x * Float64(Float64(y / Float64(a - z)) - Float64(1.0 + Float64(z / Float64(a - z))))), Float64(t * Float64(Float64(y - z) / Float64(a - z)))) end
code[x_, y_, z_, t_, a_] := N[(-1.0 * N[(x * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(1.0 + N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1, x \cdot \left(\frac{y}{a - z} - \left(1 + \frac{z}{a - z}\right)\right), t \cdot \frac{y - z}{a - z}\right)
\end{array}
Initial program 69.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--.f6481.1
Applied rewrites81.1%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites80.2%
Taylor expanded in t around 0
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
Applied rewrites91.1%
(FPCore (x y z t a)
:precision binary64
(if (<= a -6e+79)
x
(if (<= a -0.35)
(/ (* (- y z) t) a)
(if (<= a 1.06e-101)
(* (/ (- y a) z) x)
(if (<= a 3e+26) (/ (* y t) (- a z)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6e+79) {
tmp = x;
} else if (a <= -0.35) {
tmp = ((y - z) * t) / a;
} else if (a <= 1.06e-101) {
tmp = ((y - a) / z) * x;
} else if (a <= 3e+26) {
tmp = (y * t) / (a - z);
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-6d+79)) then
tmp = x
else if (a <= (-0.35d0)) then
tmp = ((y - z) * t) / a
else if (a <= 1.06d-101) then
tmp = ((y - a) / z) * x
else if (a <= 3d+26) then
tmp = (y * t) / (a - z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6e+79) {
tmp = x;
} else if (a <= -0.35) {
tmp = ((y - z) * t) / a;
} else if (a <= 1.06e-101) {
tmp = ((y - a) / z) * x;
} else if (a <= 3e+26) {
tmp = (y * t) / (a - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -6e+79: tmp = x elif a <= -0.35: tmp = ((y - z) * t) / a elif a <= 1.06e-101: tmp = ((y - a) / z) * x elif a <= 3e+26: tmp = (y * t) / (a - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6e+79) tmp = x; elseif (a <= -0.35) tmp = Float64(Float64(Float64(y - z) * t) / a); elseif (a <= 1.06e-101) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (a <= 3e+26) tmp = Float64(Float64(y * t) / Float64(a - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -6e+79) tmp = x; elseif (a <= -0.35) tmp = ((y - z) * t) / a; elseif (a <= 1.06e-101) tmp = ((y - a) / z) * x; elseif (a <= 3e+26) tmp = (y * t) / (a - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6e+79], x, If[LessEqual[a, -0.35], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 1.06e-101], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3e+26], N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6 \cdot 10^{+79}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -0.35:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a}\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{-101}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+26}:\\
\;\;\;\;\frac{y \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5.99999999999999948e79 or 2.99999999999999997e26 < a Initial program 68.7%
Taylor expanded in a around inf
Applied rewrites47.2%
if -5.99999999999999948e79 < a < -0.34999999999999998Initial program 75.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6441.6
Applied rewrites41.6%
Taylor expanded in z around 0
Applied rewrites23.4%
if -0.34999999999999998 < a < 1.0600000000000001e-101Initial program 68.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6432.3
Applied rewrites32.3%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6432.5
Applied rewrites32.5%
if 1.0600000000000001e-101 < a < 2.99999999999999997e26Initial program 71.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6447.5
Applied rewrites47.5%
Taylor expanded in y around inf
Applied rewrites25.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y t) (- a z))))
(if (<= a -3.4e+59)
x
(if (<= a -5.6e-136)
t_1
(if (<= a 1.06e-101) (* (/ (- y a) z) x) (if (<= a 3e+26) t_1 x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * t) / (a - z);
double tmp;
if (a <= -3.4e+59) {
tmp = x;
} else if (a <= -5.6e-136) {
tmp = t_1;
} else if (a <= 1.06e-101) {
tmp = ((y - a) / z) * x;
} else if (a <= 3e+26) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y * t) / (a - z)
if (a <= (-3.4d+59)) then
tmp = x
else if (a <= (-5.6d-136)) then
tmp = t_1
else if (a <= 1.06d-101) then
tmp = ((y - a) / z) * x
else if (a <= 3d+26) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * t) / (a - z);
double tmp;
if (a <= -3.4e+59) {
tmp = x;
} else if (a <= -5.6e-136) {
tmp = t_1;
} else if (a <= 1.06e-101) {
tmp = ((y - a) / z) * x;
} else if (a <= 3e+26) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * t) / (a - z) tmp = 0 if a <= -3.4e+59: tmp = x elif a <= -5.6e-136: tmp = t_1 elif a <= 1.06e-101: tmp = ((y - a) / z) * x elif a <= 3e+26: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * t) / Float64(a - z)) tmp = 0.0 if (a <= -3.4e+59) tmp = x; elseif (a <= -5.6e-136) tmp = t_1; elseif (a <= 1.06e-101) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (a <= 3e+26) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * t) / (a - z); tmp = 0.0; if (a <= -3.4e+59) tmp = x; elseif (a <= -5.6e-136) tmp = t_1; elseif (a <= 1.06e-101) tmp = ((y - a) / z) * x; elseif (a <= 3e+26) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.4e+59], x, If[LessEqual[a, -5.6e-136], t$95$1, If[LessEqual[a, 1.06e-101], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3e+26], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot t}{a - z}\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{+59}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -5.6 \cdot 10^{-136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{-101}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.40000000000000006e59 or 2.99999999999999997e26 < a Initial program 69.1%
Taylor expanded in a around inf
Applied rewrites46.7%
if -3.40000000000000006e59 < a < -5.6000000000000002e-136 or 1.0600000000000001e-101 < a < 2.99999999999999997e26Initial program 71.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in y around inf
Applied rewrites25.3%
if -5.6000000000000002e-136 < a < 1.0600000000000001e-101Initial program 68.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6431.5
Applied rewrites31.5%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6434.2
Applied rewrites34.2%
(FPCore (x y z t a)
:precision binary64
(if (<= a -6.5e+81)
(fma (- y z) (/ t (- a z)) x)
(if (<= a -5.5e-136)
(* t (/ (- y z) (- a z)))
(if (<= a 1.05e-34)
(fma (/ (* y (- t x)) z) -1.0 t)
(fma (- t x) (/ (- y z) a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.5e+81) {
tmp = fma((y - z), (t / (a - z)), x);
} else if (a <= -5.5e-136) {
tmp = t * ((y - z) / (a - z));
} else if (a <= 1.05e-34) {
tmp = fma(((y * (t - x)) / z), -1.0, t);
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.5e+81) tmp = fma(Float64(y - z), Float64(t / Float64(a - z)), x); elseif (a <= -5.5e-136) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); elseif (a <= 1.05e-34) tmp = fma(Float64(Float64(y * Float64(t - x)) / z), -1.0, t); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.5e+81], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, -5.5e-136], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.05e-34], N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{elif}\;a \leq -5.5 \cdot 10^{-136}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y \cdot \left(t - x\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if a < -6.4999999999999996e81Initial program 67.7%
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--.f6489.2
Applied rewrites89.2%
Taylor expanded in x around 0
Applied rewrites80.5%
if -6.4999999999999996e81 < a < -5.4999999999999999e-136Initial program 71.7%
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--.f6479.4
Applied rewrites79.4%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6455.9
Applied rewrites55.9%
if -5.4999999999999999e-136 < a < 1.05e-34Initial program 69.0%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites66.4%
Taylor expanded in a around 0
lower-*.f64N/A
lift--.f6475.4
Applied rewrites75.4%
if 1.05e-34 < a Initial program 69.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6472.3
Applied rewrites72.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ t (- a z)) x)))
(if (<= a -6.5e+81)
t_1
(if (<= a 1.05e-215)
(* t (/ (- y z) (- a z)))
(if (<= a 4e-175) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), (t / (a - z)), x);
double tmp;
if (a <= -6.5e+81) {
tmp = t_1;
} else if (a <= 1.05e-215) {
tmp = t * ((y - z) / (a - z));
} else if (a <= 4e-175) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(t / Float64(a - z)), x) tmp = 0.0 if (a <= -6.5e+81) tmp = t_1; elseif (a <= 1.05e-215) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); elseif (a <= 4e-175) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -6.5e+81], t$95$1, If[LessEqual[a, 1.05e-215], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4e-175], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{if}\;a \leq -6.5 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-215}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;a \leq 4 \cdot 10^{-175}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.4999999999999996e81 or 4e-175 < a Initial program 69.7%
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--.f6485.2
Applied rewrites85.2%
Taylor expanded in x around 0
Applied rewrites72.6%
if -6.4999999999999996e81 < a < 1.05e-215Initial program 69.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--.f6475.9
Applied rewrites75.9%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.5
Applied rewrites61.5%
if 1.05e-215 < a < 4e-175Initial program 65.1%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6455.2
Applied rewrites55.2%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.05e+82)
x
(if (<= a -13.0)
t
(if (<= a 7.2e-43)
(* (/ (- y a) z) x)
(if (<= a 3e+26) (/ (* t y) a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= -13.0) {
tmp = t;
} else if (a <= 7.2e-43) {
tmp = ((y - a) / z) * x;
} else if (a <= 3e+26) {
tmp = (t * y) / a;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.05d+82)) then
tmp = x
else if (a <= (-13.0d0)) then
tmp = t
else if (a <= 7.2d-43) then
tmp = ((y - a) / z) * x
else if (a <= 3d+26) then
tmp = (t * y) / a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= -13.0) {
tmp = t;
} else if (a <= 7.2e-43) {
tmp = ((y - a) / z) * x;
} else if (a <= 3e+26) {
tmp = (t * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.05e+82: tmp = x elif a <= -13.0: tmp = t elif a <= 7.2e-43: tmp = ((y - a) / z) * x elif a <= 3e+26: tmp = (t * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.05e+82) tmp = x; elseif (a <= -13.0) tmp = t; elseif (a <= 7.2e-43) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (a <= 3e+26) tmp = Float64(Float64(t * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.05e+82) tmp = x; elseif (a <= -13.0) tmp = t; elseif (a <= 7.2e-43) tmp = ((y - a) / z) * x; elseif (a <= 3e+26) tmp = (t * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.05e+82], x, If[LessEqual[a, -13.0], t, If[LessEqual[a, 7.2e-43], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3e+26], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -13:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{-43}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+26}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.04999999999999998e82 or 2.99999999999999997e26 < a Initial program 68.6%
Taylor expanded in a around inf
Applied rewrites47.2%
if -2.04999999999999998e82 < a < -13Initial program 75.6%
Taylor expanded in z around inf
Applied rewrites26.5%
if -13 < a < 7.1999999999999998e-43Initial program 69.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6432.1
Applied rewrites32.1%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6431.8
Applied rewrites31.8%
if 7.1999999999999998e-43 < a < 2.99999999999999997e26Initial program 71.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6444.4
Applied rewrites44.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6419.3
Applied rewrites19.3%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.05e+82)
x
(if (<= a -8.8e-106)
t
(if (<= a 5.7e-43) (* (/ y z) x) (if (<= a 3e+26) (/ (* t y) a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= -8.8e-106) {
tmp = t;
} else if (a <= 5.7e-43) {
tmp = (y / z) * x;
} else if (a <= 3e+26) {
tmp = (t * y) / a;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.05d+82)) then
tmp = x
else if (a <= (-8.8d-106)) then
tmp = t
else if (a <= 5.7d-43) then
tmp = (y / z) * x
else if (a <= 3d+26) then
tmp = (t * y) / a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= -8.8e-106) {
tmp = t;
} else if (a <= 5.7e-43) {
tmp = (y / z) * x;
} else if (a <= 3e+26) {
tmp = (t * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.05e+82: tmp = x elif a <= -8.8e-106: tmp = t elif a <= 5.7e-43: tmp = (y / z) * x elif a <= 3e+26: tmp = (t * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.05e+82) tmp = x; elseif (a <= -8.8e-106) tmp = t; elseif (a <= 5.7e-43) tmp = Float64(Float64(y / z) * x); elseif (a <= 3e+26) tmp = Float64(Float64(t * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.05e+82) tmp = x; elseif (a <= -8.8e-106) tmp = t; elseif (a <= 5.7e-43) tmp = (y / z) * x; elseif (a <= 3e+26) tmp = (t * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.05e+82], x, If[LessEqual[a, -8.8e-106], t, If[LessEqual[a, 5.7e-43], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3e+26], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -8.8 \cdot 10^{-106}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 5.7 \cdot 10^{-43}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+26}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.04999999999999998e82 or 2.99999999999999997e26 < a Initial program 68.6%
Taylor expanded in a around inf
Applied rewrites47.2%
if -2.04999999999999998e82 < a < -8.79999999999999977e-106Initial program 72.4%
Taylor expanded in z around inf
Applied rewrites29.6%
if -8.79999999999999977e-106 < a < 5.6999999999999999e-43Initial program 68.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6431.4
Applied rewrites31.4%
Taylor expanded in a around 0
lower-/.f6430.4
Applied rewrites30.4%
if 5.6999999999999999e-43 < a < 2.99999999999999997e26Initial program 71.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6444.6
Applied rewrites44.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6419.3
Applied rewrites19.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t y) a)))
(if (<= a -3.4e+59)
x
(if (<= a -5.6e-136)
t_1
(if (<= a 5.7e-43) (/ (* x y) z) (if (<= a 3e+26) t_1 x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double tmp;
if (a <= -3.4e+59) {
tmp = x;
} else if (a <= -5.6e-136) {
tmp = t_1;
} else if (a <= 5.7e-43) {
tmp = (x * y) / z;
} else if (a <= 3e+26) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (t * y) / a
if (a <= (-3.4d+59)) then
tmp = x
else if (a <= (-5.6d-136)) then
tmp = t_1
else if (a <= 5.7d-43) then
tmp = (x * y) / z
else if (a <= 3d+26) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double tmp;
if (a <= -3.4e+59) {
tmp = x;
} else if (a <= -5.6e-136) {
tmp = t_1;
} else if (a <= 5.7e-43) {
tmp = (x * y) / z;
} else if (a <= 3e+26) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a tmp = 0 if a <= -3.4e+59: tmp = x elif a <= -5.6e-136: tmp = t_1 elif a <= 5.7e-43: tmp = (x * y) / z elif a <= 3e+26: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) tmp = 0.0 if (a <= -3.4e+59) tmp = x; elseif (a <= -5.6e-136) tmp = t_1; elseif (a <= 5.7e-43) tmp = Float64(Float64(x * y) / z); elseif (a <= 3e+26) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; tmp = 0.0; if (a <= -3.4e+59) tmp = x; elseif (a <= -5.6e-136) tmp = t_1; elseif (a <= 5.7e-43) tmp = (x * y) / z; elseif (a <= 3e+26) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[a, -3.4e+59], x, If[LessEqual[a, -5.6e-136], t$95$1, If[LessEqual[a, 5.7e-43], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 3e+26], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{+59}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -5.6 \cdot 10^{-136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.7 \cdot 10^{-43}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.40000000000000006e59 or 2.99999999999999997e26 < a Initial program 69.1%
Taylor expanded in a around inf
Applied rewrites46.7%
if -3.40000000000000006e59 < a < -5.6000000000000002e-136 or 5.6999999999999999e-43 < a < 2.99999999999999997e26Initial program 71.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6445.6
Applied rewrites45.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6419.6
Applied rewrites19.6%
if -5.6000000000000002e-136 < a < 5.6999999999999999e-43Initial program 69.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6431.5
Applied rewrites31.5%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6427.8
Applied rewrites27.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* t (/ (- y z) a)))))
(if (<= a -2.05e+82)
t_1
(if (<= a 1.05e-215)
(* t (/ (- y z) (- a z)))
(if (<= a 1e+31) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t * ((y - z) / a));
double tmp;
if (a <= -2.05e+82) {
tmp = t_1;
} else if (a <= 1.05e-215) {
tmp = t * ((y - z) / (a - z));
} else if (a <= 1e+31) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (t * ((y - z) / a))
if (a <= (-2.05d+82)) then
tmp = t_1
else if (a <= 1.05d-215) then
tmp = t * ((y - z) / (a - z))
else if (a <= 1d+31) then
tmp = ((t - x) * y) / (a - z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t * ((y - z) / a));
double tmp;
if (a <= -2.05e+82) {
tmp = t_1;
} else if (a <= 1.05e-215) {
tmp = t * ((y - z) / (a - z));
} else if (a <= 1e+31) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t * ((y - z) / a)) tmp = 0 if a <= -2.05e+82: tmp = t_1 elif a <= 1.05e-215: tmp = t * ((y - z) / (a - z)) elif a <= 1e+31: tmp = ((t - x) * y) / (a - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t * Float64(Float64(y - z) / a))) tmp = 0.0 if (a <= -2.05e+82) tmp = t_1; elseif (a <= 1.05e-215) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); elseif (a <= 1e+31) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t * ((y - z) / a)); tmp = 0.0; if (a <= -2.05e+82) tmp = t_1; elseif (a <= 1.05e-215) tmp = t * ((y - z) / (a - z)); elseif (a <= 1e+31) tmp = ((t - x) * y) / (a - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.05e+82], t$95$1, If[LessEqual[a, 1.05e-215], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1e+31], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot \frac{y - z}{a}\\
\mathbf{if}\;a \leq -2.05 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-215}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;a \leq 10^{+31}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.04999999999999998e82 or 9.9999999999999996e30 < a Initial program 68.5%
Taylor expanded in a around inf
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.1
Applied rewrites79.1%
Taylor expanded in x around 0
Applied rewrites71.6%
if -2.04999999999999998e82 < a < 1.05e-215Initial program 69.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--.f6475.9
Applied rewrites75.9%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
if 1.05e-215 < a < 9.9999999999999996e30Initial program 71.3%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6450.6
Applied rewrites50.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -3.9e+79)
t_1
(if (<= a -6e-123)
(/ (* (- y z) t) (- a z))
(if (<= a 3.6e-35) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -3.9e+79) {
tmp = t_1;
} else if (a <= -6e-123) {
tmp = ((y - z) * t) / (a - z);
} else if (a <= 3.6e-35) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -3.9e+79) tmp = t_1; elseif (a <= -6e-123) tmp = Float64(Float64(Float64(y - z) * t) / Float64(a - z)); elseif (a <= 3.6e-35) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.9e+79], t$95$1, If[LessEqual[a, -6e-123], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.6e-35], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -3.9 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -6 \cdot 10^{-123}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.8999999999999997e79 or 3.60000000000000019e-35 < a Initial program 69.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6466.8
Applied rewrites66.8%
if -3.8999999999999997e79 < a < -5.99999999999999968e-123Initial program 72.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6444.8
Applied rewrites44.8%
if -5.99999999999999968e-123 < a < 3.60000000000000019e-35Initial program 68.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6454.6
Applied rewrites54.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ (- y z) a) x)))
(if (<= a -1.65e+83)
t_1
(if (<= a 1.9e-34) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -1.65e+83) {
tmp = t_1;
} else if (a <= 1.9e-34) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.65e+83) tmp = t_1; elseif (a <= 1.9e-34) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.65e+83], t$95$1, If[LessEqual[a, 1.9e-34], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.65 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.9 \cdot 10^{-34}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.64999999999999992e83 or 1.9000000000000001e-34 < a Initial program 69.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6475.7
Applied rewrites75.7%
if -1.64999999999999992e83 < a < 1.9000000000000001e-34Initial program 69.9%
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--.f6475.4
Applied rewrites75.4%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.05e+82)
x
(if (<= a 1.45e-213)
t
(if (<= a 4e-175) (/ (* x y) z) (if (<= a 1e+119) (+ x t) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= 1.45e-213) {
tmp = t;
} else if (a <= 4e-175) {
tmp = (x * y) / z;
} else if (a <= 1e+119) {
tmp = x + t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.05d+82)) then
tmp = x
else if (a <= 1.45d-213) then
tmp = t
else if (a <= 4d-175) then
tmp = (x * y) / z
else if (a <= 1d+119) then
tmp = x + t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= 1.45e-213) {
tmp = t;
} else if (a <= 4e-175) {
tmp = (x * y) / z;
} else if (a <= 1e+119) {
tmp = x + t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.05e+82: tmp = x elif a <= 1.45e-213: tmp = t elif a <= 4e-175: tmp = (x * y) / z elif a <= 1e+119: tmp = x + t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.05e+82) tmp = x; elseif (a <= 1.45e-213) tmp = t; elseif (a <= 4e-175) tmp = Float64(Float64(x * y) / z); elseif (a <= 1e+119) tmp = Float64(x + t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.05e+82) tmp = x; elseif (a <= 1.45e-213) tmp = t; elseif (a <= 4e-175) tmp = (x * y) / z; elseif (a <= 1e+119) tmp = x + t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.05e+82], x, If[LessEqual[a, 1.45e-213], t, If[LessEqual[a, 4e-175], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 1e+119], N[(x + t), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.45 \cdot 10^{-213}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 4 \cdot 10^{-175}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;a \leq 10^{+119}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.04999999999999998e82 or 9.99999999999999944e118 < a Initial program 67.9%
Taylor expanded in a around inf
Applied rewrites51.5%
if -2.04999999999999998e82 < a < 1.45e-213Initial program 69.6%
Taylor expanded in z around inf
Applied rewrites34.2%
if 1.45e-213 < a < 4e-175Initial program 64.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6428.4
Applied rewrites28.4%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6427.9
Applied rewrites27.9%
if 4e-175 < a < 9.99999999999999944e118Initial program 72.1%
Taylor expanded in z around inf
lift--.f6421.6
Applied rewrites21.6%
Taylor expanded in x around 0
Applied rewrites32.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.25e+164) (* (+ 1.0 (/ z (- a z))) x) (if (<= a 1.9e-34) (* t (/ (- y z) (- a z))) (fma y (/ (- t x) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.25e+164) {
tmp = (1.0 + (z / (a - z))) * x;
} else if (a <= 1.9e-34) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = fma(y, ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.25e+164) tmp = Float64(Float64(1.0 + Float64(z / Float64(a - z))) * x); elseif (a <= 1.9e-34) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = fma(y, Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.25e+164], N[(N[(1.0 + N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 1.9e-34], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.25 \cdot 10^{+164}:\\
\;\;\;\;\left(1 + \frac{z}{a - z}\right) \cdot x\\
\mathbf{elif}\;a \leq 1.9 \cdot 10^{-34}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -2.24999999999999988e164Initial program 66.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6463.1
Applied rewrites63.1%
Taylor expanded in y around 0
lower-+.f64N/A
lower-/.f64N/A
lift--.f6457.5
Applied rewrites57.5%
if -2.24999999999999988e164 < a < 1.9000000000000001e-34Initial program 69.9%
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--.f6476.4
Applied rewrites76.4%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6459.0
Applied rewrites59.0%
if 1.9000000000000001e-34 < a Initial program 69.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6464.7
Applied rewrites64.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -1.85e+59)
t_1
(if (<= a 3.6e-35) (/ (* (- t x) y) (- a z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.85e+59) {
tmp = t_1;
} else if (a <= 3.6e-35) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.85e+59) tmp = t_1; elseif (a <= 3.6e-35) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.85e+59], t$95$1, If[LessEqual[a, 3.6e-35], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.85 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.84999999999999999e59 or 3.60000000000000019e-35 < a Initial program 69.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6466.6
Applied rewrites66.6%
if -1.84999999999999999e59 < a < 3.60000000000000019e-35Initial program 69.6%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6452.6
Applied rewrites52.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- t x) a) x))) (if (<= a -5.5e-136) t_1 (if (<= a 2.8e-78) (* (/ (- y a) z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -5.5e-136) {
tmp = t_1;
} else if (a <= 2.8e-78) {
tmp = ((y - a) / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -5.5e-136) tmp = t_1; elseif (a <= 2.8e-78) tmp = Float64(Float64(Float64(y - a) / z) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.5e-136], t$95$1, If[LessEqual[a, 2.8e-78], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -5.5 \cdot 10^{-136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{-78}:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.4999999999999999e-136 or 2.80000000000000024e-78 < a Initial program 69.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6459.9
Applied rewrites59.9%
if -5.4999999999999999e-136 < a < 2.80000000000000024e-78Initial program 68.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6431.5
Applied rewrites31.5%
Taylor expanded in z around -inf
lower-/.f64N/A
lift--.f6433.8
Applied rewrites33.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.05e+82) x (if (<= a 6.2e-9) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= 6.2e-9) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.05d+82)) then
tmp = x
else if (a <= 6.2d-9) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.05e+82) {
tmp = x;
} else if (a <= 6.2e-9) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.05e+82: tmp = x elif a <= 6.2e-9: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.05e+82) tmp = x; elseif (a <= 6.2e-9) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.05e+82) tmp = x; elseif (a <= 6.2e-9) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.05e+82], x, If[LessEqual[a, 6.2e-9], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{-9}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.04999999999999998e82 or 6.2000000000000001e-9 < a Initial program 68.8%
Taylor expanded in a around inf
Applied rewrites45.1%
if -2.04999999999999998e82 < a < 6.2000000000000001e-9Initial program 70.0%
Taylor expanded in z around inf
Applied rewrites33.7%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 69.5%
Taylor expanded in z around inf
Applied rewrites24.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ y z) (- t x)))))
(if (< z -1.2536131056095036e+188)
t_1
(if (< z 4.446702369113811e+64)
(+ x (/ (- y z) (/ (- a z) (- t x))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x))
if (z < (-1.2536131056095036d+188)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - ((y / z) * (t - x)) tmp = 0 if z < -1.2536131056095036e+188: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x + ((y - z) / ((a - z) / (t - x))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y / z) * Float64(t - x))) tmp = 0.0 if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - ((y / z) * (t - x)); tmp = 0.0; if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x + ((y - z) / ((a - z) / (t - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y / z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -1.2536131056095036e+188], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025105
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -125361310560950360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- t (* (/ y z) (- t x))) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x))))))
(+ x (/ (* (- y z) (- t x)) (- a z))))