
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-251)
(fma (- y x) t_1 x)
(if (<= t_2 0.0)
(fma (/ (* (- y x) (- z a)) t) -1.0 y)
(+ x (* (- y x) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-251) {
tmp = fma((y - x), t_1, x);
} else if (t_2 <= 0.0) {
tmp = fma((((y - x) * (z - a)) / t), -1.0, y);
} else {
tmp = x + ((y - x) * t_1);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-251) tmp = fma(Float64(y - x), t_1, x); elseif (t_2 <= 0.0) tmp = fma(Float64(Float64(Float64(y - x) * Float64(z - a)) / t), -1.0, y); else tmp = Float64(x + Float64(Float64(y - x) * t_1)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-251], N[(N[(y - x), $MachinePrecision] * t$95$1 + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + y), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-251}:\\
\;\;\;\;\mathsf{fma}\left(y - x, t\_1, x\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, -1, y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.00000000000000003e-251Initial program 70.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--.f6489.4
Applied rewrites89.4%
if -2.00000000000000003e-251 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 10.7%
Taylor expanded in t 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 rewrites94.0%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 73.6%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.8
Applied rewrites90.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-251)
t_1
(if (<= t_2 0.0) (fma (/ (* (- y x) (- z a)) t) -1.0 y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-251) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = fma((((y - x) * (z - a)) / t), -1.0, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-251) tmp = t_1; elseif (t_2 <= 0.0) tmp = fma(Float64(Float64(Float64(y - x) * Float64(z - a)) / t), -1.0, y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-251], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-251}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, -1, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.00000000000000003e-251 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.2%
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--.f6490.1
Applied rewrites90.1%
if -2.00000000000000003e-251 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 10.7%
Taylor expanded in t 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 rewrites94.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-251) t_1 (if (<= t_2 0.0) y t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-251) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-251) tmp = t_1; elseif (t_2 <= 0.0) tmp = y; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-251], t$95$1, If[LessEqual[t$95$2, 0.0], y, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-251}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.00000000000000003e-251 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.2%
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--.f6490.1
Applied rewrites90.1%
if -2.00000000000000003e-251 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 10.7%
Taylor expanded in t around inf
Applied rewrites41.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.2e+157)
y
(if (<= t -3.2e-84)
(fma (/ z (- a t)) y x)
(if (<= t 2.15e+83) (fma (/ z a) (- y x) x) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+157) {
tmp = y;
} else if (t <= -3.2e-84) {
tmp = fma((z / (a - t)), y, x);
} else if (t <= 2.15e+83) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.2e+157) tmp = y; elseif (t <= -3.2e-84) tmp = fma(Float64(z / Float64(a - t)), y, x); elseif (t <= 2.15e+83) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.2e+157], y, If[LessEqual[t, -3.2e-84], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 2.15e+83], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+157}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-84}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - t}, y, x\right)\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.1999999999999999e157 or 2.15e83 < t Initial program 33.5%
Taylor expanded in t around inf
Applied rewrites52.5%
if -3.1999999999999999e157 < t < -3.1999999999999999e-84Initial program 69.4%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6484.5
Applied rewrites84.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--.f6484.6
Applied rewrites84.6%
Taylor expanded in z around inf
Applied rewrites58.3%
Taylor expanded in x around 0
Applied rewrites41.1%
if -3.1999999999999999e-84 < t < 2.15e83Initial program 87.9%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6493.9
Applied rewrites93.9%
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--.f6493.9
Applied rewrites93.9%
Taylor expanded in t around 0
lower-/.f6473.0
Applied rewrites73.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* y (/ (- z t) t)))))
(if (<= t -3.2e+155)
t_1
(if (<= t 2.15e+83) (fma (/ z (- a t)) (- y x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(y * ((z - t) / t));
double tmp;
if (t <= -3.2e+155) {
tmp = t_1;
} else if (t <= 2.15e+83) {
tmp = fma((z / (a - t)), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-Float64(y * Float64(Float64(z - t) / t))) tmp = 0.0 if (t <= -3.2e+155) tmp = t_1; elseif (t <= 2.15e+83) tmp = fma(Float64(z / Float64(a - t)), Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(y * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t, -3.2e+155], t$95$1, If[LessEqual[t, 2.15e+83], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -y \cdot \frac{z - t}{t}\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{+155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.20000000000000012e155 or 2.15e83 < t Initial program 33.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6435.8
Applied rewrites35.8%
Taylor expanded in a around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6458.0
Applied rewrites58.0%
if -3.20000000000000012e155 < t < 2.15e83Initial program 82.7%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.3
Applied rewrites91.3%
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.3
Applied rewrites91.3%
Taylor expanded in z around inf
Applied rewrites77.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* y (/ (- z t) t)))))
(if (<= t -3.3e+139)
t_1
(if (<= t 2.15e+83) (fma (- y x) (/ (- z t) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(y * ((z - t) / t));
double tmp;
if (t <= -3.3e+139) {
tmp = t_1;
} else if (t <= 2.15e+83) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-Float64(y * Float64(Float64(z - t) / t))) tmp = 0.0 if (t <= -3.3e+139) tmp = t_1; elseif (t <= 2.15e+83) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(y * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t, -3.3e+139], t$95$1, If[LessEqual[t, 2.15e+83], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -y \cdot \frac{z - t}{t}\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.3000000000000002e139 or 2.15e83 < t Initial program 34.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6435.9
Applied rewrites35.9%
Taylor expanded in a around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6457.5
Applied rewrites57.5%
if -3.3000000000000002e139 < t < 2.15e83Initial program 83.5%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6469.3
Applied rewrites69.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.2e+44)
y
(if (<= t -2.3e-166)
x
(if (<= t 1.25e-220)
(/ (* y z) a)
(if (<= t 6.8e-31) x (if (<= t 3.3e+155) (+ x y) y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+44) {
tmp = y;
} else if (t <= -2.3e-166) {
tmp = x;
} else if (t <= 1.25e-220) {
tmp = (y * z) / a;
} else if (t <= 6.8e-31) {
tmp = x;
} else if (t <= 3.3e+155) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-3.2d+44)) then
tmp = y
else if (t <= (-2.3d-166)) then
tmp = x
else if (t <= 1.25d-220) then
tmp = (y * z) / a
else if (t <= 6.8d-31) then
tmp = x
else if (t <= 3.3d+155) then
tmp = x + y
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+44) {
tmp = y;
} else if (t <= -2.3e-166) {
tmp = x;
} else if (t <= 1.25e-220) {
tmp = (y * z) / a;
} else if (t <= 6.8e-31) {
tmp = x;
} else if (t <= 3.3e+155) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.2e+44: tmp = y elif t <= -2.3e-166: tmp = x elif t <= 1.25e-220: tmp = (y * z) / a elif t <= 6.8e-31: tmp = x elif t <= 3.3e+155: tmp = x + y else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.2e+44) tmp = y; elseif (t <= -2.3e-166) tmp = x; elseif (t <= 1.25e-220) tmp = Float64(Float64(y * z) / a); elseif (t <= 6.8e-31) tmp = x; elseif (t <= 3.3e+155) tmp = Float64(x + y); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.2e+44) tmp = y; elseif (t <= -2.3e-166) tmp = x; elseif (t <= 1.25e-220) tmp = (y * z) / a; elseif (t <= 6.8e-31) tmp = x; elseif (t <= 3.3e+155) tmp = x + y; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.2e+44], y, If[LessEqual[t, -2.3e-166], x, If[LessEqual[t, 1.25e-220], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t, 6.8e-31], x, If[LessEqual[t, 3.3e+155], N[(x + y), $MachinePrecision], y]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+44}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -2.3 \cdot 10^{-166}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{-220}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-31}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+155}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.20000000000000004e44 or 3.2999999999999999e155 < t Initial program 36.9%
Taylor expanded in t around inf
Applied rewrites50.7%
if -3.20000000000000004e44 < t < -2.29999999999999999e-166 or 1.25e-220 < t < 6.8000000000000002e-31Initial program 87.0%
Taylor expanded in a around inf
Applied rewrites32.5%
if -2.29999999999999999e-166 < t < 1.25e-220Initial program 93.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6436.2
Applied rewrites36.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6432.9
Applied rewrites32.9%
if 6.8000000000000002e-31 < t < 3.2999999999999999e155Initial program 63.5%
Taylor expanded in t around inf
lift--.f6421.4
Applied rewrites21.4%
Taylor expanded in x around 0
Applied rewrites35.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* y (/ (- z t) t))))) (if (<= t -3.3e+139) t_1 (if (<= t 2.15e+83) (fma (/ z a) (- y x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(y * ((z - t) / t));
double tmp;
if (t <= -3.3e+139) {
tmp = t_1;
} else if (t <= 2.15e+83) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-Float64(y * Float64(Float64(z - t) / t))) tmp = 0.0 if (t <= -3.3e+139) tmp = t_1; elseif (t <= 2.15e+83) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(y * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t, -3.3e+139], t$95$1, If[LessEqual[t, 2.15e+83], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -y \cdot \frac{z - t}{t}\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.3000000000000002e139 or 2.15e83 < t Initial program 34.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6435.9
Applied rewrites35.9%
Taylor expanded in a around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6457.5
Applied rewrites57.5%
if -3.3000000000000002e139 < t < 2.15e83Initial program 83.5%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.6
Applied rewrites91.6%
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.6
Applied rewrites91.6%
Taylor expanded in t around 0
lower-/.f6464.7
Applied rewrites64.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.3e+139) y (if (<= t 2.15e+83) (fma (/ z a) (- y x) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.3e+139) {
tmp = y;
} else if (t <= 2.15e+83) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.3e+139) tmp = y; elseif (t <= 2.15e+83) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.3e+139], y, If[LessEqual[t, 2.15e+83], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{+139}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.3000000000000002e139 or 2.15e83 < t Initial program 34.0%
Taylor expanded in t around inf
Applied rewrites51.8%
if -3.3000000000000002e139 < t < 2.15e83Initial program 83.5%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.6
Applied rewrites91.6%
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.6
Applied rewrites91.6%
Taylor expanded in t around 0
lower-/.f6464.7
Applied rewrites64.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.3e+139) y (if (<= t 2.15e+83) (fma z (/ (- y x) a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.3e+139) {
tmp = y;
} else if (t <= 2.15e+83) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.3e+139) tmp = y; elseif (t <= 2.15e+83) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.3e+139], y, If[LessEqual[t, 2.15e+83], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{+139}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.3000000000000002e139 or 2.15e83 < t Initial program 34.0%
Taylor expanded in t around inf
Applied rewrites51.8%
if -3.3000000000000002e139 < t < 2.15e83Initial program 83.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.1
Applied rewrites63.1%
(FPCore (x y z t a) :precision binary64 (if (<= z 2.7e-53) (+ x (* y (/ (- z t) (- a t)))) (fma (/ z (- a t)) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 2.7e-53) {
tmp = x + (y * ((z - t) / (a - t)));
} else {
tmp = fma((z / (a - t)), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 2.7e-53) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))); else tmp = fma(Float64(z / Float64(a - t)), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 2.7e-53], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.7 \cdot 10^{-53}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - t}, y - x, x\right)\\
\end{array}
\end{array}
if z < 2.6999999999999999e-53Initial program 66.4%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.6
Applied rewrites81.6%
Taylor expanded in x around 0
Applied rewrites67.8%
if 2.6999999999999999e-53 < z Initial program 69.0%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6488.5
Applied rewrites88.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--.f6488.5
Applied rewrites88.5%
Taylor expanded in z around inf
Applied rewrites72.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.3e+139) y (if (<= t 7.2e+82) (fma z (/ y a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.3e+139) {
tmp = y;
} else if (t <= 7.2e+82) {
tmp = fma(z, (y / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.3e+139) tmp = y; elseif (t <= 7.2e+82) tmp = fma(z, Float64(y / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.3e+139], y, If[LessEqual[t, 7.2e+82], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{+139}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.3000000000000002e139 or 7.20000000000000028e82 < t Initial program 34.0%
Taylor expanded in t around inf
Applied rewrites51.8%
if -3.3000000000000002e139 < t < 7.20000000000000028e82Initial program 83.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6463.1
Applied rewrites63.1%
Taylor expanded in x around 0
Applied rewrites51.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.2e+44) y (if (<= t 6.8e-31) x (if (<= t 3.3e+155) (+ x y) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+44) {
tmp = y;
} else if (t <= 6.8e-31) {
tmp = x;
} else if (t <= 3.3e+155) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-3.2d+44)) then
tmp = y
else if (t <= 6.8d-31) then
tmp = x
else if (t <= 3.3d+155) then
tmp = x + y
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+44) {
tmp = y;
} else if (t <= 6.8e-31) {
tmp = x;
} else if (t <= 3.3e+155) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.2e+44: tmp = y elif t <= 6.8e-31: tmp = x elif t <= 3.3e+155: tmp = x + y else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.2e+44) tmp = y; elseif (t <= 6.8e-31) tmp = x; elseif (t <= 3.3e+155) tmp = Float64(x + y); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.2e+44) tmp = y; elseif (t <= 6.8e-31) tmp = x; elseif (t <= 3.3e+155) tmp = x + y; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.2e+44], y, If[LessEqual[t, 6.8e-31], x, If[LessEqual[t, 3.3e+155], N[(x + y), $MachinePrecision], y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+44}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-31}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+155}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.20000000000000004e44 or 3.2999999999999999e155 < t Initial program 36.9%
Taylor expanded in t around inf
Applied rewrites50.7%
if -3.20000000000000004e44 < t < 6.8000000000000002e-31Initial program 89.4%
Taylor expanded in a around inf
Applied rewrites34.5%
if 6.8000000000000002e-31 < t < 3.2999999999999999e155Initial program 63.5%
Taylor expanded in t around inf
lift--.f6421.4
Applied rewrites21.4%
Taylor expanded in x around 0
Applied rewrites35.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.2e+44) y (if (<= t 2.25e+82) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+44) {
tmp = y;
} else if (t <= 2.25e+82) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-3.2d+44)) then
tmp = y
else if (t <= 2.25d+82) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+44) {
tmp = y;
} else if (t <= 2.25e+82) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.2e+44: tmp = y elif t <= 2.25e+82: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.2e+44) tmp = y; elseif (t <= 2.25e+82) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.2e+44) tmp = y; elseif (t <= 2.25e+82) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.2e+44], y, If[LessEqual[t, 2.25e+82], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+44}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.20000000000000004e44 or 2.2499999999999998e82 < t Initial program 38.7%
Taylor expanded in t around inf
Applied rewrites48.4%
if -3.20000000000000004e44 < t < 2.2499999999999998e82Initial program 86.9%
Taylor expanded in a around inf
Applied rewrites32.9%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 67.2%
Taylor expanded in a around inf
Applied rewrites24.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - 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 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - 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 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025089
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))