
(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(y - z) * Float64(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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Herbie found 15 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(y - z) * Float64(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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z)))
(t_2 (fma t_1 (- y z) x))
(t_3 (+ x (* (- y z) t_1))))
(if (<= t_3 -5e-48)
t_2
(if (<= t_3 -5e-291)
(*
(-
(+ (+ (- (/ (* (- y z) x) (* (- a z) t))) (/ x t)) (/ y (- a z)))
(/ z (- a z)))
t)
(if (<= t_3 0.0) (+ (* -1.0 (* x (/ (- a y) z))) t) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = fma(t_1, (y - z), x);
double t_3 = x + ((y - z) * t_1);
double tmp;
if (t_3 <= -5e-48) {
tmp = t_2;
} else if (t_3 <= -5e-291) {
tmp = (((-(((y - z) * x) / ((a - z) * t)) + (x / t)) + (y / (a - z))) - (z / (a - z))) * t;
} else if (t_3 <= 0.0) {
tmp = (-1.0 * (x * ((a - y) / z))) + t;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = fma(t_1, Float64(y - z), x) t_3 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_3 <= -5e-48) tmp = t_2; elseif (t_3 <= -5e-291) tmp = Float64(Float64(Float64(Float64(Float64(-Float64(Float64(Float64(y - z) * x) / Float64(Float64(a - z) * t))) + Float64(x / t)) + Float64(y / Float64(a - z))) - Float64(z / Float64(a - z))) * t); elseif (t_3 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(x * Float64(Float64(a - y) / z))) + t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-48], t$95$2, If[LessEqual[t$95$3, -5e-291], N[(N[(N[(N[((-N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]) + N[(x / t), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(N[(-1.0 * N[(x * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
t_3 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-48}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-291}:\\
\;\;\;\;\left(\left(\left(\left(-\frac{\left(y - z\right) \cdot x}{\left(a - z\right) \cdot t}\right) + \frac{x}{t}\right) + \frac{y}{a - z}\right) - \frac{z}{a - z}\right) \cdot t\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;-1 \cdot \left(x \cdot \frac{a - y}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.9999999999999999e-48 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.5
Applied rewrites91.5%
if -4.9999999999999999e-48 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.0000000000000003e-291Initial program 77.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.4%
if -5.0000000000000003e-291 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 4.3%
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
lower-+.f64N/A
Applied rewrites83.1%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6496.3
Applied rewrites96.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+176)
(* (/ (- y z) (- a z)) t)
(if (<= z 1.35e+95)
(+ x (* (- y z) (/ (- t x) (- a z))))
(+ (* -1.0 (* x (/ (- a y) z))) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+176) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 1.35e+95) {
tmp = x + ((y - z) * ((t - x) / (a - z)));
} else {
tmp = (-1.0 * (x * ((a - y) / z))) + t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-5d+176)) then
tmp = ((y - z) / (a - z)) * t
else if (z <= 1.35d+95) then
tmp = x + ((y - z) * ((t - x) / (a - z)))
else
tmp = ((-1.0d0) * (x * ((a - y) / z))) + 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 <= -5e+176) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 1.35e+95) {
tmp = x + ((y - z) * ((t - x) / (a - z)));
} else {
tmp = (-1.0 * (x * ((a - y) / z))) + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e+176: tmp = ((y - z) / (a - z)) * t elif z <= 1.35e+95: tmp = x + ((y - z) * ((t - x) / (a - z))) else: tmp = (-1.0 * (x * ((a - y) / z))) + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+176) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); elseif (z <= 1.35e+95) tmp = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))); else tmp = Float64(Float64(-1.0 * Float64(x * Float64(Float64(a - y) / z))) + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5e+176) tmp = ((y - z) / (a - z)) * t; elseif (z <= 1.35e+95) tmp = x + ((y - z) * ((t - x) / (a - z))); else tmp = (-1.0 * (x * ((a - y) / z))) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+176], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1.35e+95], N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(x * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+176}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+95}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(x \cdot \frac{a - y}{z}\right) + t\\
\end{array}
\end{array}
if z < -5e176Initial program 54.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.1%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6468.5
Applied rewrites68.5%
if -5e176 < z < 1.35e95Initial program 88.0%
if 1.35e95 < z Initial program 61.8%
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
lower-+.f64N/A
Applied rewrites63.3%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6474.6
Applied rewrites74.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+176)
(* (/ (- y z) (- a z)) t)
(if (<= z 1.35e+95)
(fma (/ (- t x) (- a z)) (- y z) x)
(+ (* -1.0 (* x (/ (- a y) z))) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+176) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 1.35e+95) {
tmp = fma(((t - x) / (a - z)), (y - z), x);
} else {
tmp = (-1.0 * (x * ((a - y) / z))) + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+176) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); elseif (z <= 1.35e+95) tmp = fma(Float64(Float64(t - x) / Float64(a - z)), Float64(y - z), x); else tmp = Float64(Float64(-1.0 * Float64(x * Float64(Float64(a - y) / z))) + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+176], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1.35e+95], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(-1.0 * N[(x * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+176}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(x \cdot \frac{a - y}{z}\right) + t\\
\end{array}
\end{array}
if z < -5e176Initial program 54.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.1%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6468.5
Applied rewrites68.5%
if -5e176 < z < 1.35e95Initial program 88.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6488.0
Applied rewrites88.0%
if 1.35e95 < z Initial program 61.8%
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
lower-+.f64N/A
Applied rewrites63.3%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6474.6
Applied rewrites74.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.4e+35)
(* (/ (- y z) (- a z)) t)
(if (<= z 9.5e+93)
(+ x (* y (/ (- t x) (- a z))))
(+ (* -1.0 (* x (/ (- a y) z))) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.4e+35) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 9.5e+93) {
tmp = x + (y * ((t - x) / (a - z)));
} else {
tmp = (-1.0 * (x * ((a - y) / z))) + t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-6.4d+35)) then
tmp = ((y - z) / (a - z)) * t
else if (z <= 9.5d+93) then
tmp = x + (y * ((t - x) / (a - z)))
else
tmp = ((-1.0d0) * (x * ((a - y) / z))) + 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 <= -6.4e+35) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 9.5e+93) {
tmp = x + (y * ((t - x) / (a - z)));
} else {
tmp = (-1.0 * (x * ((a - y) / z))) + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.4e+35: tmp = ((y - z) / (a - z)) * t elif z <= 9.5e+93: tmp = x + (y * ((t - x) / (a - z))) else: tmp = (-1.0 * (x * ((a - y) / z))) + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.4e+35) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); elseif (z <= 9.5e+93) tmp = Float64(x + Float64(y * Float64(Float64(t - x) / Float64(a - z)))); else tmp = Float64(Float64(-1.0 * Float64(x * Float64(Float64(a - y) / z))) + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.4e+35) tmp = ((y - z) / (a - z)) * t; elseif (z <= 9.5e+93) tmp = x + (y * ((t - x) / (a - z))); else tmp = (-1.0 * (x * ((a - y) / z))) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.4e+35], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 9.5e+93], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(x * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+35}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+93}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(x \cdot \frac{a - y}{z}\right) + t\\
\end{array}
\end{array}
if z < -6.39999999999999965e35Initial program 67.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.3%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.3
Applied rewrites61.3%
if -6.39999999999999965e35 < z < 9.4999999999999991e93Initial program 90.0%
Taylor expanded in y around inf
Applied rewrites79.4%
if 9.4999999999999991e93 < z Initial program 61.8%
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
lower-+.f64N/A
Applied rewrites63.2%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6474.4
Applied rewrites74.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- y z) (- a z)) t)))
(if (<= z -1.6e+162)
t_1
(if (<= z -3.7e-140)
(fma (/ t (- a z)) (- y z) x)
(if (<= z 5.6e-24)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 2.3e+19) (- t (/ (* y (- t x)) z)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) / (a - z)) * t;
double tmp;
if (z <= -1.6e+162) {
tmp = t_1;
} else if (z <= -3.7e-140) {
tmp = fma((t / (a - z)), (y - z), x);
} else if (z <= 5.6e-24) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 2.3e+19) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) / Float64(a - z)) * t) tmp = 0.0 if (z <= -1.6e+162) tmp = t_1; elseif (z <= -3.7e-140) tmp = fma(Float64(t / Float64(a - z)), Float64(y - z), x); elseif (z <= 5.6e-24) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 2.3e+19) tmp = Float64(t - 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[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -1.6e+162], t$95$1, If[LessEqual[z, -3.7e-140], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.6e-24], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.3e+19], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-140}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+19}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6000000000000001e162 or 2.3e19 < z Initial program 64.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites58.7%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6463.8
Applied rewrites63.8%
if -1.6000000000000001e162 < z < -3.69999999999999977e-140Initial program 85.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6485.1
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites66.5%
if -3.69999999999999977e-140 < z < 5.6000000000000003e-24Initial program 91.4%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6482.8
Applied rewrites82.8%
if 5.6000000000000003e-24 < z < 2.3e19Initial program 87.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
lower-+.f64N/A
Applied rewrites49.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.4e+35)
(* (/ (- y z) (- a z)) t)
(if (<= z 9.5e+93)
(+ x (* y (/ (- t x) (- a z))))
(+ (/ (* x (- y a)) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.4e+35) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 9.5e+93) {
tmp = x + (y * ((t - x) / (a - z)));
} else {
tmp = ((x * (y - a)) / z) + t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-6.4d+35)) then
tmp = ((y - z) / (a - z)) * t
else if (z <= 9.5d+93) then
tmp = x + (y * ((t - x) / (a - z)))
else
tmp = ((x * (y - a)) / z) + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.4e+35) {
tmp = ((y - z) / (a - z)) * t;
} else if (z <= 9.5e+93) {
tmp = x + (y * ((t - x) / (a - z)));
} else {
tmp = ((x * (y - a)) / z) + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.4e+35: tmp = ((y - z) / (a - z)) * t elif z <= 9.5e+93: tmp = x + (y * ((t - x) / (a - z))) else: tmp = ((x * (y - a)) / z) + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.4e+35) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); elseif (z <= 9.5e+93) tmp = Float64(x + Float64(y * Float64(Float64(t - x) / Float64(a - z)))); else tmp = Float64(Float64(Float64(x * Float64(y - a)) / z) + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.4e+35) tmp = ((y - z) / (a - z)) * t; elseif (z <= 9.5e+93) tmp = x + (y * ((t - x) / (a - z))); else tmp = ((x * (y - a)) / z) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.4e+35], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 9.5e+93], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+35}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+93}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - a\right)}{z} + t\\
\end{array}
\end{array}
if z < -6.39999999999999965e35Initial program 67.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.3%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.3
Applied rewrites61.3%
if -6.39999999999999965e35 < z < 9.4999999999999991e93Initial program 90.0%
Taylor expanded in y around inf
Applied rewrites79.4%
if 9.4999999999999991e93 < z Initial program 61.8%
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
lower-+.f64N/A
Applied rewrites63.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f6465.5
Applied rewrites65.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- y z) (- a z)) t)))
(if (<= z -7.4e+34)
t_1
(if (<= z 5.6e-24)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 2.3e+19) (- t (/ (* y (- t x)) z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) / (a - z)) * t;
double tmp;
if (z <= -7.4e+34) {
tmp = t_1;
} else if (z <= 5.6e-24) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 2.3e+19) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) / Float64(a - z)) * t) tmp = 0.0 if (z <= -7.4e+34) tmp = t_1; elseif (z <= 5.6e-24) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 2.3e+19) tmp = Float64(t - 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[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -7.4e+34], t$95$1, If[LessEqual[z, 5.6e-24], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.3e+19], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+19}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.40000000000000017e34 or 2.3e19 < z Initial program 67.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.1%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.7
Applied rewrites61.7%
if -7.40000000000000017e34 < z < 5.6000000000000003e-24Initial program 91.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6478.0
Applied rewrites78.0%
if 5.6000000000000003e-24 < z < 2.3e19Initial program 87.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
lower-+.f64N/A
Applied rewrites49.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6445.7
Applied rewrites45.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- y z) (- a z)) t)))
(if (<= z -7.4e+34)
t_1
(if (<= z 9e-77)
(fma y (/ (- t x) a) x)
(if (<= z 2.3e+19) (- t (/ (* y (- t x)) z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) / (a - z)) * t;
double tmp;
if (z <= -7.4e+34) {
tmp = t_1;
} else if (z <= 9e-77) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 2.3e+19) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) / Float64(a - z)) * t) tmp = 0.0 if (z <= -7.4e+34) tmp = t_1; elseif (z <= 9e-77) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 2.3e+19) tmp = Float64(t - 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[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -7.4e+34], t$95$1, If[LessEqual[z, 9e-77], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.3e+19], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+19}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.40000000000000017e34 or 2.3e19 < z Initial program 67.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.1%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.7
Applied rewrites61.7%
if -7.40000000000000017e34 < z < 9.0000000000000001e-77Initial program 91.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.7
Applied rewrites73.7%
if 9.0000000000000001e-77 < z < 2.3e19Initial program 88.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
lower-+.f64N/A
Applied rewrites47.5%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6443.7
Applied rewrites43.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (/ (- y z) a) x)))
(if (<= a -1.02e+51)
t_1
(if (<= a 2.15e-35)
(- t (/ (* y (- t x)) z))
(if (<= a 2.25e+194) (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, ((y - z) / a), x);
double tmp;
if (a <= -1.02e+51) {
tmp = t_1;
} else if (a <= 2.15e-35) {
tmp = t - ((y * (t - x)) / z);
} else if (a <= 2.25e+194) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.02e+51) tmp = t_1; elseif (a <= 2.15e-35) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); elseif (a <= 2.25e+194) 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[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.02e+51], t$95$1, If[LessEqual[a, 2.15e-35], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.25e+194], 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(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.02 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.15 \cdot 10^{-35}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;a \leq 2.25 \cdot 10^{+194}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.02e51 or 2.2499999999999999e194 < a Initial program 89.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6481.0
Applied rewrites81.0%
Taylor expanded in x around 0
Applied rewrites75.1%
if -1.02e51 < a < 2.1500000000000001e-35Initial program 73.3%
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
lower-+.f64N/A
Applied rewrites71.3%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6467.7
Applied rewrites67.7%
if 2.1500000000000001e-35 < a < 2.2499999999999999e194Initial program 84.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6457.3
Applied rewrites57.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.05e+36)
t
(if (<= z 9e-77)
(fma y (/ (- t x) a) x)
(if (<= z 7.8e+93) (* y (/ (- x t) z)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.05e+36) {
tmp = t;
} else if (z <= 9e-77) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 7.8e+93) {
tmp = y * ((x - t) / z);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.05e+36) tmp = t; elseif (z <= 9e-77) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 7.8e+93) tmp = Float64(y * Float64(Float64(x - t) / z)); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.05e+36], t, If[LessEqual[z, 9e-77], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.8e+93], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+36}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+93}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.05000000000000006e36 or 7.8000000000000005e93 < z Initial program 64.9%
Taylor expanded in z around inf
Applied rewrites47.7%
if -2.05000000000000006e36 < z < 9.0000000000000001e-77Initial program 91.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.5
Applied rewrites73.5%
if 9.0000000000000001e-77 < z < 7.8000000000000005e93Initial program 85.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
lower-+.f64N/A
Applied rewrites51.4%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6432.0
Applied rewrites32.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.1e+36)
t
(if (<= z 9e-77)
(fma t (/ y a) x)
(if (<= z 7.8e+93) (* y (/ (- x t) z)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+36) {
tmp = t;
} else if (z <= 9e-77) {
tmp = fma(t, (y / a), x);
} else if (z <= 7.8e+93) {
tmp = y * ((x - t) / z);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+36) tmp = t; elseif (z <= 9e-77) tmp = fma(t, Float64(y / a), x); elseif (z <= 7.8e+93) tmp = Float64(y * Float64(Float64(x - t) / z)); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+36], t, If[LessEqual[z, 9e-77], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.8e+93], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+36}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+93}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.10000000000000004e36 or 7.8000000000000005e93 < z Initial program 64.9%
Taylor expanded in z around inf
Applied rewrites47.7%
if -2.10000000000000004e36 < z < 9.0000000000000001e-77Initial program 91.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.1
Applied rewrites79.1%
Taylor expanded in x around 0
Applied rewrites66.2%
Taylor expanded in y around inf
Applied rewrites62.7%
if 9.0000000000000001e-77 < z < 7.8000000000000005e93Initial program 85.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
lower-+.f64N/A
Applied rewrites51.4%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6432.0
Applied rewrites32.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e+36) t (if (<= z 1.3e+82) (fma t (/ y a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+36) {
tmp = t;
} else if (z <= 1.3e+82) {
tmp = fma(t, (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+36) tmp = t; elseif (z <= 1.3e+82) tmp = fma(t, Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+36], t, If[LessEqual[z, 1.3e+82], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+36}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.10000000000000004e36 or 1.2999999999999999e82 < z Initial program 65.2%
Taylor expanded in z around inf
Applied rewrites47.2%
if -2.10000000000000004e36 < z < 1.2999999999999999e82Initial program 90.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6473.9
Applied rewrites73.9%
Taylor expanded in x around 0
Applied rewrites62.5%
Taylor expanded in y around inf
Applied rewrites57.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e+35) t (if (<= z 2e-132) x (if (<= z 3500000000.0) (* (/ y a) t) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+35) {
tmp = t;
} else if (z <= 2e-132) {
tmp = x;
} else if (z <= 3500000000.0) {
tmp = (y / a) * t;
} 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 <= (-1d+35)) then
tmp = t
else if (z <= 2d-132) then
tmp = x
else if (z <= 3500000000.0d0) then
tmp = (y / a) * t
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 <= -1e+35) {
tmp = t;
} else if (z <= 2e-132) {
tmp = x;
} else if (z <= 3500000000.0) {
tmp = (y / a) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e+35: tmp = t elif z <= 2e-132: tmp = x elif z <= 3500000000.0: tmp = (y / a) * t else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+35) tmp = t; elseif (z <= 2e-132) tmp = x; elseif (z <= 3500000000.0) tmp = Float64(Float64(y / a) * t); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e+35) tmp = t; elseif (z <= 2e-132) tmp = x; elseif (z <= 3500000000.0) tmp = (y / a) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+35], t, If[LessEqual[z, 2e-132], x, If[LessEqual[z, 3500000000.0], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-132}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3500000000:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -9.9999999999999997e34 or 3.5e9 < z Initial program 68.0%
Taylor expanded in z around inf
Applied rewrites44.2%
if -9.9999999999999997e34 < z < 2e-132Initial program 91.3%
Taylor expanded in a around inf
Applied rewrites34.7%
if 2e-132 < z < 3.5e9Initial program 89.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.9%
Taylor expanded in x around 0
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6447.2
Applied rewrites47.2%
Taylor expanded in z around 0
lower-/.f6424.3
Applied rewrites24.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e+35) t (if (<= z 950000000000.0) x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+35) {
tmp = t;
} else if (z <= 950000000000.0) {
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 <= (-1d+35)) then
tmp = t
else if (z <= 950000000000.0d0) 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 <= -1e+35) {
tmp = t;
} else if (z <= 950000000000.0) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e+35: tmp = t elif z <= 950000000000.0: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+35) tmp = t; elseif (z <= 950000000000.0) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e+35) tmp = t; elseif (z <= 950000000000.0) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+35], t, If[LessEqual[z, 950000000000.0], x, t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 950000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -9.9999999999999997e34 or 9.5e11 < z Initial program 67.9%
Taylor expanded in z around inf
Applied rewrites44.3%
if -9.9999999999999997e34 < z < 9.5e11Initial program 90.8%
Taylor expanded in a around inf
Applied rewrites33.6%
(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 80.1%
Taylor expanded in z around inf
Applied rewrites25.1%
herbie shell --seed 2025120
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))