
(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 16 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 -2e-262)
t_1
(if (<= t_2 1e-262)
(fma
(/ (- (fma a (/ (* (- t x) (- y a)) z) (* (- t x) y)) (* (- t x) a)) z)
-1.0
t)
(if (<= t_2 2e+289) 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 <= -2e-262) {
tmp = t_1;
} else if (t_2 <= 1e-262) {
tmp = fma(((fma(a, (((t - x) * (y - a)) / z), ((t - x) * y)) - ((t - x) * a)) / z), -1.0, t);
} else if (t_2 <= 2e+289) {
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 <= -2e-262) tmp = t_1; elseif (t_2 <= 1e-262) tmp = fma(Float64(Float64(fma(a, Float64(Float64(Float64(t - x) * Float64(y - a)) / z), Float64(Float64(t - x) * y)) - Float64(Float64(t - x) * a)) / z), -1.0, t); elseif (t_2 <= 2e+289) 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, -2e-262], t$95$1, If[LessEqual[t$95$2, 1e-262], N[(N[(N[(N[(a * N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - N[(N[(t - x), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], If[LessEqual[t$95$2, 2e+289], 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 -2 \cdot 10^{-262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-262}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(a, \frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, \left(t - x\right) \cdot y\right) - \left(t - x\right) \cdot a}{z}, -1, t\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+289}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2.00000000000000002e-262 or 2.0000000000000001e289 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 62.4%
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.5
Applied rewrites85.5%
if -2.00000000000000002e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.00000000000000001e-262Initial program 15.9%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites88.7%
if 1.00000000000000001e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 2.0000000000000001e289Initial program 96.5%
(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-262)
t_1
(if (<= t_2 1e-262)
(fma (/ (* (- t x) (- y a)) z) -1.0 t)
(if (<= t_2 2e+289) 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 <= -2e-262) {
tmp = t_1;
} else if (t_2 <= 1e-262) {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
} else if (t_2 <= 2e+289) {
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 <= -2e-262) tmp = t_1; elseif (t_2 <= 1e-262) tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); elseif (t_2 <= 2e+289) 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, -2e-262], t$95$1, If[LessEqual[t$95$2, 1e-262], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], If[LessEqual[t$95$2, 2e+289], 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 -2 \cdot 10^{-262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-262}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+289}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2.00000000000000002e-262 or 2.0000000000000001e289 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 62.4%
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.5
Applied rewrites85.5%
if -2.00000000000000002e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.00000000000000001e-262Initial program 15.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 rewrites88.8%
if 1.00000000000000001e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 2.0000000000000001e289Initial program 96.5%
(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-262)
t_1
(if (<= t_2 1e-262) (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-262) {
tmp = t_1;
} else if (t_2 <= 1e-262) {
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-262) tmp = t_1; elseif (t_2 <= 1e-262) 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-262], t$95$1, If[LessEqual[t$95$2, 1e-262], 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^{-262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-262}:\\
\;\;\;\;\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))) < -2.00000000000000002e-262 or 1.00000000000000001e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 72.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--.f6486.4
Applied rewrites86.4%
if -2.00000000000000002e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.00000000000000001e-262Initial program 15.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 rewrites88.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ t (- a z)) x)))
(if (<= z -5.7e+172)
(fma (/ (- t x) z) a t)
(if (<= z -1.12e-170)
t_1
(if (<= z 9e-173)
(+ x (/ (* (- t x) y) a))
(if (<= z 1.65e+118) t_1 (* t (/ (- y z) (- a z)))))))))
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 (z <= -5.7e+172) {
tmp = fma(((t - x) / z), a, t);
} else if (z <= -1.12e-170) {
tmp = t_1;
} else if (z <= 9e-173) {
tmp = x + (((t - x) * y) / a);
} else if (z <= 1.65e+118) {
tmp = t_1;
} else {
tmp = t * ((y - z) / (a - z));
}
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 (z <= -5.7e+172) tmp = fma(Float64(Float64(t - x) / z), a, t); elseif (z <= -1.12e-170) tmp = t_1; elseif (z <= 9e-173) tmp = Float64(x + Float64(Float64(Float64(t - x) * y) / a)); elseif (z <= 1.65e+118) tmp = t_1; else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); 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[z, -5.7e+172], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision], If[LessEqual[z, -1.12e-170], t$95$1, If[LessEqual[z, 9e-173], N[(x + N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+118], t$95$1, N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{if}\;z \leq -5.7 \cdot 10^{+172}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-173}:\\
\;\;\;\;x + \frac{\left(t - x\right) \cdot y}{a}\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -5.7e172Initial program 27.5%
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 rewrites65.1%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6416.4
Applied rewrites16.4%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6467.1
Applied rewrites67.1%
if -5.7e172 < z < -1.12000000000000009e-170 or 9.00000000000000037e-173 < z < 1.65e118Initial program 77.8%
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.7
Applied rewrites86.7%
Taylor expanded in x around 0
Applied rewrites67.6%
if -1.12000000000000009e-170 < z < 9.00000000000000037e-173Initial program 91.6%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6483.0
Applied rewrites83.0%
if 1.65e118 < z Initial program 32.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--.f6462.2
Applied rewrites62.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6467.1
Applied rewrites67.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) z) a t)))
(if (<= z -6.8e+115)
t_1
(if (<= z -1.55e-12)
x
(if (<= z 4.3e-256) (/ (* y t) (- a z)) (if (<= z 4.4e+116) x t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / z), a, t);
double tmp;
if (z <= -6.8e+115) {
tmp = t_1;
} else if (z <= -1.55e-12) {
tmp = x;
} else if (z <= 4.3e-256) {
tmp = (y * t) / (a - z);
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / z), a, t) tmp = 0.0 if (z <= -6.8e+115) tmp = t_1; elseif (z <= -1.55e-12) tmp = x; elseif (z <= 4.3e-256) tmp = Float64(Float64(y * t) / Float64(a - z)); elseif (z <= 4.4e+116) tmp = x; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision]}, If[LessEqual[z, -6.8e+115], t$95$1, If[LessEqual[z, -1.55e-12], x, If[LessEqual[z, 4.3e-256], N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+116], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-256}:\\
\;\;\;\;\frac{y \cdot t}{a - z}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.8000000000000001e115 or 4.4e116 < z Initial program 34.2%
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 rewrites63.0%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6418.0
Applied rewrites18.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6461.7
Applied rewrites61.7%
if -6.8000000000000001e115 < z < -1.5500000000000001e-12 or 4.3000000000000001e-256 < z < 4.4e116Initial program 79.6%
Taylor expanded in a around inf
Applied rewrites28.6%
if -1.5500000000000001e-12 < z < 4.3000000000000001e-256Initial program 90.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.3
Applied rewrites38.3%
Taylor expanded in y around inf
Applied rewrites31.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.1e+128)
(fma (/ (- t x) z) a t)
(if (<= z -1.3e-170)
(fma y (/ t (- a z)) x)
(if (<= z 2.1e-45) (+ x (/ (* (- t x) y) a)) (* t (/ (- y z) (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.1e+128) {
tmp = fma(((t - x) / z), a, t);
} else if (z <= -1.3e-170) {
tmp = fma(y, (t / (a - z)), x);
} else if (z <= 2.1e-45) {
tmp = x + (((t - x) * y) / a);
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.1e+128) tmp = fma(Float64(Float64(t - x) / z), a, t); elseif (z <= -1.3e-170) tmp = fma(y, Float64(t / Float64(a - z)), x); elseif (z <= 2.1e-45) tmp = Float64(x + Float64(Float64(Float64(t - x) * y) / a)); else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.1e+128], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision], If[LessEqual[z, -1.3e-170], N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.1e-45], N[(x + N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-170}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-45}:\\
\;\;\;\;x + \frac{\left(t - x\right) \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -6.1000000000000003e128Initial program 33.1%
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 rewrites63.5%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6417.4
Applied rewrites17.4%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6462.0
Applied rewrites62.0%
if -6.1000000000000003e128 < z < -1.3000000000000001e-170Initial program 80.1%
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--.f6487.4
Applied rewrites87.4%
Taylor expanded in x around 0
Applied rewrites67.9%
Taylor expanded in y around inf
Applied rewrites52.1%
if -1.3000000000000001e-170 < z < 2.09999999999999995e-45Initial program 90.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6475.7
Applied rewrites75.7%
if 2.09999999999999995e-45 < z Initial program 50.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--.f6472.3
Applied rewrites72.3%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.0
Applied rewrites61.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.1e+128)
(fma (/ (- t x) z) a t)
(if (<= z -1.6e-170)
(fma y (/ t (- a z)) x)
(if (<= z 4.2e-45) (fma y (/ (- t x) a) x) (* t (/ (- y z) (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.1e+128) {
tmp = fma(((t - x) / z), a, t);
} else if (z <= -1.6e-170) {
tmp = fma(y, (t / (a - z)), x);
} else if (z <= 4.2e-45) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.1e+128) tmp = fma(Float64(Float64(t - x) / z), a, t); elseif (z <= -1.6e-170) tmp = fma(y, Float64(t / Float64(a - z)), x); elseif (z <= 4.2e-45) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.1e+128], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision], If[LessEqual[z, -1.6e-170], N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.2e-45], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-170}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-45}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -6.1000000000000003e128Initial program 33.1%
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 rewrites63.5%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6417.4
Applied rewrites17.4%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6462.0
Applied rewrites62.0%
if -6.1000000000000003e128 < z < -1.6e-170Initial program 80.1%
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--.f6487.4
Applied rewrites87.4%
Taylor expanded in x around 0
Applied rewrites67.9%
Taylor expanded in y around inf
Applied rewrites52.1%
if -1.6e-170 < z < 4.1999999999999999e-45Initial program 90.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6479.7
Applied rewrites79.7%
if 4.1999999999999999e-45 < z Initial program 50.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--.f6472.3
Applied rewrites72.3%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.1
Applied rewrites61.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) z) a t)))
(if (<= z -6.1e+128)
t_1
(if (<= z -1.6e-170)
(fma y (/ t (- a z)) x)
(if (<= z 4.7e+116) (fma y (/ (- t x) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / z), a, t);
double tmp;
if (z <= -6.1e+128) {
tmp = t_1;
} else if (z <= -1.6e-170) {
tmp = fma(y, (t / (a - z)), x);
} else if (z <= 4.7e+116) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / z), a, t) tmp = 0.0 if (z <= -6.1e+128) tmp = t_1; elseif (z <= -1.6e-170) tmp = fma(y, Float64(t / Float64(a - z)), x); elseif (z <= 4.7e+116) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision]}, If[LessEqual[z, -6.1e+128], t$95$1, If[LessEqual[z, -1.6e-170], N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.7e+116], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{if}\;z \leq -6.1 \cdot 10^{+128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-170}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.1000000000000003e128 or 4.7000000000000003e116 < z Initial program 33.0%
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 rewrites63.4%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6417.6
Applied rewrites17.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6462.9
Applied rewrites62.9%
if -6.1000000000000003e128 < z < -1.6e-170Initial program 80.1%
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--.f6487.4
Applied rewrites87.4%
Taylor expanded in x around 0
Applied rewrites67.9%
Taylor expanded in y around inf
Applied rewrites52.1%
if -1.6e-170 < z < 4.7000000000000003e116Initial program 85.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6469.3
Applied rewrites69.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) z) a t)))
(if (<= z -5.7e+172)
t_1
(if (<= z 1.3e+212) (fma (- y z) (/ (- t x) (- a z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / z), a, t);
double tmp;
if (z <= -5.7e+172) {
tmp = t_1;
} else if (z <= 1.3e+212) {
tmp = fma((y - z), ((t - x) / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / z), a, t) tmp = 0.0 if (z <= -5.7e+172) tmp = t_1; elseif (z <= 1.3e+212) tmp = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision]}, If[LessEqual[z, -5.7e+172], t$95$1, If[LessEqual[z, 1.3e+212], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{if}\;z \leq -5.7 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+212}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.7e172 or 1.2999999999999999e212 < z Initial program 25.6%
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 rewrites64.7%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6416.0
Applied rewrites16.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6470.5
Applied rewrites70.5%
if -5.7e172 < z < 1.2999999999999999e212Initial program 78.3%
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.6
Applied rewrites86.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.5e+160)
t
(if (<= z -1.55e-12)
x
(if (<= z 4.3e-256) (/ (* y t) (- a z)) (if (<= z 4.4e+116) x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+160) {
tmp = t;
} else if (z <= -1.55e-12) {
tmp = x;
} else if (z <= 4.3e-256) {
tmp = (y * t) / (a - z);
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = 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 (z <= (-3.5d+160)) then
tmp = t
else if (z <= (-1.55d-12)) then
tmp = x
else if (z <= 4.3d-256) then
tmp = (y * t) / (a - z)
else if (z <= 4.4d+116) then
tmp = x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+160) {
tmp = t;
} else if (z <= -1.55e-12) {
tmp = x;
} else if (z <= 4.3e-256) {
tmp = (y * t) / (a - z);
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+160: tmp = t elif z <= -1.55e-12: tmp = x elif z <= 4.3e-256: tmp = (y * t) / (a - z) elif z <= 4.4e+116: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+160) tmp = t; elseif (z <= -1.55e-12) tmp = x; elseif (z <= 4.3e-256) tmp = Float64(Float64(y * t) / Float64(a - z)); elseif (z <= 4.4e+116) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.5e+160) tmp = t; elseif (z <= -1.55e-12) tmp = x; elseif (z <= 4.3e-256) tmp = (y * t) / (a - z); elseif (z <= 4.4e+116) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+160], t, If[LessEqual[z, -1.55e-12], x, If[LessEqual[z, 4.3e-256], N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+116], x, t]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+160}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-256}:\\
\;\;\;\;\frac{y \cdot t}{a - z}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.50000000000000026e160 or 4.4e116 < z Initial program 31.5%
Taylor expanded in z around inf
Applied rewrites56.4%
if -3.50000000000000026e160 < z < -1.5500000000000001e-12 or 4.3000000000000001e-256 < z < 4.4e116Initial program 77.5%
Taylor expanded in a around inf
Applied rewrites27.8%
if -1.5500000000000001e-12 < z < 4.3000000000000001e-256Initial program 90.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.3
Applied rewrites38.3%
Taylor expanded in y around inf
Applied rewrites31.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ t (- a z)) x)))
(if (<= a -1.72e-6)
t_1
(if (<= a 7.6e-105) (+ t (- (/ (* y (- t x)) 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 <= -1.72e-6) {
tmp = t_1;
} else if (a <= 7.6e-105) {
tmp = t + -((y * (t - x)) / 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 <= -1.72e-6) tmp = t_1; elseif (a <= 7.6e-105) tmp = Float64(t + Float64(-Float64(Float64(y * Float64(t - x)) / 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, -1.72e-6], t$95$1, If[LessEqual[a, 7.6e-105], N[(t + (-N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / 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 -1.72 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-105}:\\
\;\;\;\;t + \left(-\frac{y \cdot \left(t - x\right)}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.72e-6 or 7.5999999999999995e-105 < a 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--.f6486.3
Applied rewrites86.3%
Taylor expanded in x around 0
Applied rewrites74.4%
if -1.72e-6 < a < 7.5999999999999995e-105Initial program 66.5%
Taylor expanded in z around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.1%
Taylor expanded in a around 0
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6472.7
Applied rewrites72.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.1e+128)
(fma (/ (- t x) z) a t)
(if (<= z 4.4e+79)
(fma (- t x) (/ (- y z) a) x)
(* t (/ (- y z) (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.1e+128) {
tmp = fma(((t - x) / z), a, t);
} else if (z <= 4.4e+79) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.1e+128) tmp = fma(Float64(Float64(t - x) / z), a, t); elseif (z <= 4.4e+79) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.1e+128], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision], If[LessEqual[z, 4.4e+79], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}
\end{array}
if z < -6.1000000000000003e128Initial program 33.1%
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 rewrites63.5%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6417.4
Applied rewrites17.4%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6462.0
Applied rewrites62.0%
if -6.1000000000000003e128 < z < 4.3999999999999998e79Initial program 84.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6470.9
Applied rewrites70.9%
if 4.3999999999999998e79 < z Initial program 37.1%
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--.f6465.2
Applied rewrites65.2%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6466.2
Applied rewrites66.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.5e+160)
t
(if (<= z -1.05e-258)
x
(if (<= z 4.3e-256) (/ (* t y) a) (if (<= z 4.4e+116) x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+160) {
tmp = t;
} else if (z <= -1.05e-258) {
tmp = x;
} else if (z <= 4.3e-256) {
tmp = (t * y) / a;
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = 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 (z <= (-3.5d+160)) then
tmp = t
else if (z <= (-1.05d-258)) then
tmp = x
else if (z <= 4.3d-256) then
tmp = (t * y) / a
else if (z <= 4.4d+116) then
tmp = x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+160) {
tmp = t;
} else if (z <= -1.05e-258) {
tmp = x;
} else if (z <= 4.3e-256) {
tmp = (t * y) / a;
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+160: tmp = t elif z <= -1.05e-258: tmp = x elif z <= 4.3e-256: tmp = (t * y) / a elif z <= 4.4e+116: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+160) tmp = t; elseif (z <= -1.05e-258) tmp = x; elseif (z <= 4.3e-256) tmp = Float64(Float64(t * y) / a); elseif (z <= 4.4e+116) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.5e+160) tmp = t; elseif (z <= -1.05e-258) tmp = x; elseif (z <= 4.3e-256) tmp = (t * y) / a; elseif (z <= 4.4e+116) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+160], t, If[LessEqual[z, -1.05e-258], x, If[LessEqual[z, 4.3e-256], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 4.4e+116], x, t]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+160}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-258}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-256}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.50000000000000026e160 or 4.4e116 < z Initial program 31.5%
Taylor expanded in z around inf
Applied rewrites56.4%
if -3.50000000000000026e160 < z < -1.05e-258 or 4.3000000000000001e-256 < z < 4.4e116Initial program 81.2%
Taylor expanded in a around inf
Applied rewrites30.4%
if -1.05e-258 < z < 4.3000000000000001e-256Initial program 91.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6438.7
Applied rewrites38.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6436.7
Applied rewrites36.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- t x) z) a t))) (if (<= z -6e+128) t_1 (if (<= z 4.7e+116) (fma y (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / z), a, t);
double tmp;
if (z <= -6e+128) {
tmp = t_1;
} else if (z <= 4.7e+116) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / z), a, t) tmp = 0.0 if (z <= -6e+128) tmp = t_1; elseif (z <= 4.7e+116) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision]}, If[LessEqual[z, -6e+128], t$95$1, If[LessEqual[z, 4.7e+116], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{+128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.9999999999999997e128 or 4.7000000000000003e116 < z Initial program 33.0%
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 rewrites63.4%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6417.6
Applied rewrites17.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f6462.9
Applied rewrites62.9%
if -5.9999999999999997e128 < z < 4.7000000000000003e116Initial program 83.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.2
Applied rewrites63.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.5e+160) t (if (<= z 4.4e+116) x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+160) {
tmp = t;
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = 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 (z <= (-3.5d+160)) then
tmp = t
else if (z <= 4.4d+116) then
tmp = x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+160) {
tmp = t;
} else if (z <= 4.4e+116) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+160: tmp = t elif z <= 4.4e+116: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+160) tmp = t; elseif (z <= 4.4e+116) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.5e+160) tmp = t; elseif (z <= 4.4e+116) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+160], t, If[LessEqual[z, 4.4e+116], x, t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+160}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.50000000000000026e160 or 4.4e116 < z Initial program 31.5%
Taylor expanded in z around inf
Applied rewrites56.4%
if -3.50000000000000026e160 < z < 4.4e116Initial program 82.5%
Taylor expanded in a around inf
Applied rewrites31.2%
(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 68.3%
Taylor expanded in z around inf
Applied rewrites25.2%
(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 2025093
(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))))