
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* t1 (/ v (+ u t1))) (- (- u) t1)))
double code(double u, double v, double t1) {
return (t1 * (v / (u + t1))) / (-u - t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (t1 * (v / (u + t1))) / (-u - t1)
end function
public static double code(double u, double v, double t1) {
return (t1 * (v / (u + t1))) / (-u - t1);
}
def code(u, v, t1): return (t1 * (v / (u + t1))) / (-u - t1)
function code(u, v, t1) return Float64(Float64(t1 * Float64(v / Float64(u + t1))) / Float64(Float64(-u) - t1)) end
function tmp = code(u, v, t1) tmp = (t1 * (v / (u + t1))) / (-u - t1); end
code[u_, v_, t1_] := N[(N[(t1 * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t1 \cdot \frac{v}{u + t1}}{\left(-u\right) - t1}
\end{array}
Initial program 70.5%
Taylor expanded in v around 0
Applied rewrites70.8%
Applied rewrites98.8%
Final simplification98.8%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -1.45e+30)
(/ v (- u t1))
(if (<= t1 -3.4e-162)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(if (<= t1 6.7e-164)
(/ (* t1 (/ (- v) u)) u)
(if (<= t1 2.05e+108)
(* (/ (- v) (* (+ u t1) (+ u t1))) t1)
(/ (- v) (+ u t1)))))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.45e+30) {
tmp = v / (u - t1);
} else if (t1 <= -3.4e-162) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else if (t1 <= 6.7e-164) {
tmp = (t1 * (-v / u)) / u;
} else if (t1 <= 2.05e+108) {
tmp = (-v / ((u + t1) * (u + t1))) * t1;
} else {
tmp = -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-1.45d+30)) then
tmp = v / (u - t1)
else if (t1 <= (-3.4d-162)) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
else if (t1 <= 6.7d-164) then
tmp = (t1 * (-v / u)) / u
else if (t1 <= 2.05d+108) then
tmp = (-v / ((u + t1) * (u + t1))) * t1
else
tmp = -v / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.45e+30) {
tmp = v / (u - t1);
} else if (t1 <= -3.4e-162) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else if (t1 <= 6.7e-164) {
tmp = (t1 * (-v / u)) / u;
} else if (t1 <= 2.05e+108) {
tmp = (-v / ((u + t1) * (u + t1))) * t1;
} else {
tmp = -v / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.45e+30: tmp = v / (u - t1) elif t1 <= -3.4e-162: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) elif t1 <= 6.7e-164: tmp = (t1 * (-v / u)) / u elif t1 <= 2.05e+108: tmp = (-v / ((u + t1) * (u + t1))) * t1 else: tmp = -v / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.45e+30) tmp = Float64(v / Float64(u - t1)); elseif (t1 <= -3.4e-162) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); elseif (t1 <= 6.7e-164) tmp = Float64(Float64(t1 * Float64(Float64(-v) / u)) / u); elseif (t1 <= 2.05e+108) tmp = Float64(Float64(Float64(-v) / Float64(Float64(u + t1) * Float64(u + t1))) * t1); else tmp = Float64(Float64(-v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.45e+30) tmp = v / (u - t1); elseif (t1 <= -3.4e-162) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); elseif (t1 <= 6.7e-164) tmp = (t1 * (-v / u)) / u; elseif (t1 <= 2.05e+108) tmp = (-v / ((u + t1) * (u + t1))) * t1; else tmp = -v / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.45e+30], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -3.4e-162], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6.7e-164], N[(N[(t1 * N[((-v) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[t1, 2.05e+108], N[(N[((-v) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.45 \cdot 10^{+30}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{elif}\;t1 \leq -3.4 \cdot 10^{-162}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{elif}\;t1 \leq 6.7 \cdot 10^{-164}:\\
\;\;\;\;\frac{t1 \cdot \frac{-v}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.05 \cdot 10^{+108}:\\
\;\;\;\;\frac{-v}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.4499999999999999e30Initial program 52.4%
Applied rewrites99.3%
Taylor expanded in u around 0
Applied rewrites93.2%
if -1.4499999999999999e30 < t1 < -3.4e-162Initial program 94.3%
if -3.4e-162 < t1 < 6.69999999999999999e-164Initial program 72.0%
Taylor expanded in u around inf
Applied rewrites83.8%
Taylor expanded in u around inf
Applied rewrites88.6%
if 6.69999999999999999e-164 < t1 < 2.05e108Initial program 84.0%
Taylor expanded in v around 0
Applied rewrites84.9%
Applied rewrites84.9%
if 2.05e108 < t1 Initial program 55.0%
Taylor expanded in v around 0
Applied rewrites54.5%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites91.8%
Final simplification90.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- v) (* (+ u t1) (+ u t1))) t1)))
(if (<= t1 -1.3e+121)
(/ v (- u t1))
(if (<= t1 -1.8e-140)
t_1
(if (<= t1 6.7e-164)
(/ (* t1 (/ (- v) u)) u)
(if (<= t1 2.05e+108) t_1 (/ (- v) (+ u t1))))))))
double code(double u, double v, double t1) {
double t_1 = (-v / ((u + t1) * (u + t1))) * t1;
double tmp;
if (t1 <= -1.3e+121) {
tmp = v / (u - t1);
} else if (t1 <= -1.8e-140) {
tmp = t_1;
} else if (t1 <= 6.7e-164) {
tmp = (t1 * (-v / u)) / u;
} else if (t1 <= 2.05e+108) {
tmp = t_1;
} else {
tmp = -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = (-v / ((u + t1) * (u + t1))) * t1
if (t1 <= (-1.3d+121)) then
tmp = v / (u - t1)
else if (t1 <= (-1.8d-140)) then
tmp = t_1
else if (t1 <= 6.7d-164) then
tmp = (t1 * (-v / u)) / u
else if (t1 <= 2.05d+108) then
tmp = t_1
else
tmp = -v / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-v / ((u + t1) * (u + t1))) * t1;
double tmp;
if (t1 <= -1.3e+121) {
tmp = v / (u - t1);
} else if (t1 <= -1.8e-140) {
tmp = t_1;
} else if (t1 <= 6.7e-164) {
tmp = (t1 * (-v / u)) / u;
} else if (t1 <= 2.05e+108) {
tmp = t_1;
} else {
tmp = -v / (u + t1);
}
return tmp;
}
def code(u, v, t1): t_1 = (-v / ((u + t1) * (u + t1))) * t1 tmp = 0 if t1 <= -1.3e+121: tmp = v / (u - t1) elif t1 <= -1.8e-140: tmp = t_1 elif t1 <= 6.7e-164: tmp = (t1 * (-v / u)) / u elif t1 <= 2.05e+108: tmp = t_1 else: tmp = -v / (u + t1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-v) / Float64(Float64(u + t1) * Float64(u + t1))) * t1) tmp = 0.0 if (t1 <= -1.3e+121) tmp = Float64(v / Float64(u - t1)); elseif (t1 <= -1.8e-140) tmp = t_1; elseif (t1 <= 6.7e-164) tmp = Float64(Float64(t1 * Float64(Float64(-v) / u)) / u); elseif (t1 <= 2.05e+108) tmp = t_1; else tmp = Float64(Float64(-v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-v / ((u + t1) * (u + t1))) * t1; tmp = 0.0; if (t1 <= -1.3e+121) tmp = v / (u - t1); elseif (t1 <= -1.8e-140) tmp = t_1; elseif (t1 <= 6.7e-164) tmp = (t1 * (-v / u)) / u; elseif (t1 <= 2.05e+108) tmp = t_1; else tmp = -v / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-v) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision]}, If[LessEqual[t1, -1.3e+121], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -1.8e-140], t$95$1, If[LessEqual[t1, 6.7e-164], N[(N[(t1 * N[((-v) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[t1, 2.05e+108], t$95$1, N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot t1\\
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{+121}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{elif}\;t1 \leq -1.8 \cdot 10^{-140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 6.7 \cdot 10^{-164}:\\
\;\;\;\;\frac{t1 \cdot \frac{-v}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.05 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.2999999999999999e121Initial program 46.4%
Applied rewrites100.0%
Taylor expanded in u around 0
Applied rewrites100.0%
if -1.2999999999999999e121 < t1 < -1.8e-140 or 6.69999999999999999e-164 < t1 < 2.05e108Initial program 85.0%
Taylor expanded in v around 0
Applied rewrites86.3%
Applied rewrites86.3%
if -1.8e-140 < t1 < 6.69999999999999999e-164Initial program 72.5%
Taylor expanded in u around inf
Applied rewrites83.3%
Taylor expanded in u around inf
Applied rewrites87.9%
if 2.05e108 < t1 Initial program 55.0%
Taylor expanded in v around 0
Applied rewrites54.5%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites91.8%
Final simplification89.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- v) (* (+ u t1) (+ u t1))) t1)))
(if (<= t1 -1.3e+121)
(/ v (- u t1))
(if (<= t1 -4.5e-142)
t_1
(if (<= t1 6.7e-164)
(* (/ t1 u) (/ (- v) u))
(if (<= t1 2.05e+108) t_1 (/ (- v) (+ u t1))))))))
double code(double u, double v, double t1) {
double t_1 = (-v / ((u + t1) * (u + t1))) * t1;
double tmp;
if (t1 <= -1.3e+121) {
tmp = v / (u - t1);
} else if (t1 <= -4.5e-142) {
tmp = t_1;
} else if (t1 <= 6.7e-164) {
tmp = (t1 / u) * (-v / u);
} else if (t1 <= 2.05e+108) {
tmp = t_1;
} else {
tmp = -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = (-v / ((u + t1) * (u + t1))) * t1
if (t1 <= (-1.3d+121)) then
tmp = v / (u - t1)
else if (t1 <= (-4.5d-142)) then
tmp = t_1
else if (t1 <= 6.7d-164) then
tmp = (t1 / u) * (-v / u)
else if (t1 <= 2.05d+108) then
tmp = t_1
else
tmp = -v / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-v / ((u + t1) * (u + t1))) * t1;
double tmp;
if (t1 <= -1.3e+121) {
tmp = v / (u - t1);
} else if (t1 <= -4.5e-142) {
tmp = t_1;
} else if (t1 <= 6.7e-164) {
tmp = (t1 / u) * (-v / u);
} else if (t1 <= 2.05e+108) {
tmp = t_1;
} else {
tmp = -v / (u + t1);
}
return tmp;
}
def code(u, v, t1): t_1 = (-v / ((u + t1) * (u + t1))) * t1 tmp = 0 if t1 <= -1.3e+121: tmp = v / (u - t1) elif t1 <= -4.5e-142: tmp = t_1 elif t1 <= 6.7e-164: tmp = (t1 / u) * (-v / u) elif t1 <= 2.05e+108: tmp = t_1 else: tmp = -v / (u + t1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-v) / Float64(Float64(u + t1) * Float64(u + t1))) * t1) tmp = 0.0 if (t1 <= -1.3e+121) tmp = Float64(v / Float64(u - t1)); elseif (t1 <= -4.5e-142) tmp = t_1; elseif (t1 <= 6.7e-164) tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); elseif (t1 <= 2.05e+108) tmp = t_1; else tmp = Float64(Float64(-v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-v / ((u + t1) * (u + t1))) * t1; tmp = 0.0; if (t1 <= -1.3e+121) tmp = v / (u - t1); elseif (t1 <= -4.5e-142) tmp = t_1; elseif (t1 <= 6.7e-164) tmp = (t1 / u) * (-v / u); elseif (t1 <= 2.05e+108) tmp = t_1; else tmp = -v / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-v) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision]}, If[LessEqual[t1, -1.3e+121], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -4.5e-142], t$95$1, If[LessEqual[t1, 6.7e-164], N[(N[(t1 / u), $MachinePrecision] * N[((-v) / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.05e+108], t$95$1, N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot t1\\
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{+121}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{elif}\;t1 \leq -4.5 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 6.7 \cdot 10^{-164}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\mathbf{elif}\;t1 \leq 2.05 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.2999999999999999e121Initial program 46.4%
Applied rewrites100.0%
Taylor expanded in u around 0
Applied rewrites100.0%
if -1.2999999999999999e121 < t1 < -4.50000000000000019e-142 or 6.69999999999999999e-164 < t1 < 2.05e108Initial program 85.0%
Taylor expanded in v around 0
Applied rewrites86.3%
Applied rewrites86.3%
if -4.50000000000000019e-142 < t1 < 6.69999999999999999e-164Initial program 72.5%
Taylor expanded in u around inf
Applied rewrites87.8%
if 2.05e108 < t1 Initial program 55.0%
Taylor expanded in v around 0
Applied rewrites54.5%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites91.8%
Final simplification89.7%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -1.45e+142)
(/ v (- t1))
(if (<= t1 4.6e+138)
(* (/ (/ v (+ u t1)) (+ u t1)) (- t1))
(/ (- v) (+ u t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.45e+142) {
tmp = v / -t1;
} else if (t1 <= 4.6e+138) {
tmp = ((v / (u + t1)) / (u + t1)) * -t1;
} else {
tmp = -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-1.45d+142)) then
tmp = v / -t1
else if (t1 <= 4.6d+138) then
tmp = ((v / (u + t1)) / (u + t1)) * -t1
else
tmp = -v / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.45e+142) {
tmp = v / -t1;
} else if (t1 <= 4.6e+138) {
tmp = ((v / (u + t1)) / (u + t1)) * -t1;
} else {
tmp = -v / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.45e+142: tmp = v / -t1 elif t1 <= 4.6e+138: tmp = ((v / (u + t1)) / (u + t1)) * -t1 else: tmp = -v / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.45e+142) tmp = Float64(v / Float64(-t1)); elseif (t1 <= 4.6e+138) tmp = Float64(Float64(Float64(v / Float64(u + t1)) / Float64(u + t1)) * Float64(-t1)); else tmp = Float64(Float64(-v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.45e+142) tmp = v / -t1; elseif (t1 <= 4.6e+138) tmp = ((v / (u + t1)) / (u + t1)) * -t1; else tmp = -v / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.45e+142], N[(v / (-t1)), $MachinePrecision], If[LessEqual[t1, 4.6e+138], N[(N[(N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision] * (-t1)), $MachinePrecision], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.45 \cdot 10^{+142}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{elif}\;t1 \leq 4.6 \cdot 10^{+138}:\\
\;\;\;\;\frac{\frac{v}{u + t1}}{u + t1} \cdot \left(-t1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.45000000000000007e142Initial program 41.9%
Taylor expanded in u around 0
Applied rewrites100.0%
if -1.45000000000000007e142 < t1 < 4.60000000000000015e138Initial program 80.0%
Taylor expanded in v around 0
Applied rewrites80.9%
Applied rewrites87.2%
if 4.60000000000000015e138 < t1 Initial program 53.1%
Taylor expanded in v around 0
Applied rewrites54.7%
Applied rewrites100.0%
Taylor expanded in u around 0
Applied rewrites95.4%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -1.3e+121)
(/ v (- u t1))
(if (<= t1 2.05e+108)
(* (/ (- v) (* (+ u t1) (+ u t1))) t1)
(/ (- v) (+ u t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e+121) {
tmp = v / (u - t1);
} else if (t1 <= 2.05e+108) {
tmp = (-v / ((u + t1) * (u + t1))) * t1;
} else {
tmp = -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-1.3d+121)) then
tmp = v / (u - t1)
else if (t1 <= 2.05d+108) then
tmp = (-v / ((u + t1) * (u + t1))) * t1
else
tmp = -v / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e+121) {
tmp = v / (u - t1);
} else if (t1 <= 2.05e+108) {
tmp = (-v / ((u + t1) * (u + t1))) * t1;
} else {
tmp = -v / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.3e+121: tmp = v / (u - t1) elif t1 <= 2.05e+108: tmp = (-v / ((u + t1) * (u + t1))) * t1 else: tmp = -v / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.3e+121) tmp = Float64(v / Float64(u - t1)); elseif (t1 <= 2.05e+108) tmp = Float64(Float64(Float64(-v) / Float64(Float64(u + t1) * Float64(u + t1))) * t1); else tmp = Float64(Float64(-v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.3e+121) tmp = v / (u - t1); elseif (t1 <= 2.05e+108) tmp = (-v / ((u + t1) * (u + t1))) * t1; else tmp = -v / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.3e+121], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.05e+108], N[(N[((-v) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{+121}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{elif}\;t1 \leq 2.05 \cdot 10^{+108}:\\
\;\;\;\;\frac{-v}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.2999999999999999e121Initial program 46.4%
Applied rewrites100.0%
Taylor expanded in u around 0
Applied rewrites100.0%
if -1.2999999999999999e121 < t1 < 2.05e108Initial program 80.1%
Taylor expanded in v around 0
Applied rewrites81.6%
Applied rewrites81.6%
if 2.05e108 < t1 Initial program 55.0%
Taylor expanded in v around 0
Applied rewrites54.5%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites91.8%
Final simplification86.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.1e-108) (not (<= t1 4.5e-19))) (/ v (- u t1)) (* (/ (- v) (* u u)) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.1e-108) || !(t1 <= 4.5e-19)) {
tmp = v / (u - t1);
} else {
tmp = (-v / (u * u)) * t1;
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-5.1d-108)) .or. (.not. (t1 <= 4.5d-19))) then
tmp = v / (u - t1)
else
tmp = (-v / (u * u)) * t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.1e-108) || !(t1 <= 4.5e-19)) {
tmp = v / (u - t1);
} else {
tmp = (-v / (u * u)) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5.1e-108) or not (t1 <= 4.5e-19): tmp = v / (u - t1) else: tmp = (-v / (u * u)) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5.1e-108) || !(t1 <= 4.5e-19)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(Float64(Float64(-v) / Float64(u * u)) * t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5.1e-108) || ~((t1 <= 4.5e-19))) tmp = v / (u - t1); else tmp = (-v / (u * u)) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5.1e-108], N[Not[LessEqual[t1, 4.5e-19]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.1 \cdot 10^{-108} \lor \neg \left(t1 \leq 4.5 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\end{array}
\end{array}
if t1 < -5.1000000000000002e-108 or 4.50000000000000013e-19 < t1 Initial program 66.3%
Applied rewrites98.5%
Taylor expanded in u around 0
Applied rewrites83.1%
if -5.1000000000000002e-108 < t1 < 4.50000000000000013e-19Initial program 77.2%
Taylor expanded in u around inf
Applied rewrites70.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
Final simplification78.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.1e-108) (not (<= t1 4.5e-19))) (/ v (- u t1)) (* v (/ (- t1) (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.1e-108) || !(t1 <= 4.5e-19)) {
tmp = v / (u - t1);
} else {
tmp = v * (-t1 / (u * u));
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-5.1d-108)) .or. (.not. (t1 <= 4.5d-19))) then
tmp = v / (u - t1)
else
tmp = v * (-t1 / (u * u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.1e-108) || !(t1 <= 4.5e-19)) {
tmp = v / (u - t1);
} else {
tmp = v * (-t1 / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5.1e-108) or not (t1 <= 4.5e-19): tmp = v / (u - t1) else: tmp = v * (-t1 / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5.1e-108) || !(t1 <= 4.5e-19)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5.1e-108) || ~((t1 <= 4.5e-19))) tmp = v / (u - t1); else tmp = v * (-t1 / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5.1e-108], N[Not[LessEqual[t1, 4.5e-19]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.1 \cdot 10^{-108} \lor \neg \left(t1 \leq 4.5 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -5.1000000000000002e-108 or 4.50000000000000013e-19 < t1 Initial program 66.3%
Applied rewrites98.5%
Taylor expanded in u around 0
Applied rewrites83.1%
if -5.1000000000000002e-108 < t1 < 4.50000000000000013e-19Initial program 77.2%
Taylor expanded in u around inf
Applied rewrites70.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6471.7
Applied rewrites71.7%
Final simplification78.7%
(FPCore (u v t1) :precision binary64 (if (or (<= u -7.4e+130) (not (<= u 3.5e+121))) (* v (/ t1 (* u u))) (/ v (- u t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -7.4e+130) || !(u <= 3.5e+121)) {
tmp = v * (t1 / (u * u));
} else {
tmp = v / (u - t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-7.4d+130)) .or. (.not. (u <= 3.5d+121))) then
tmp = v * (t1 / (u * u))
else
tmp = v / (u - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -7.4e+130) || !(u <= 3.5e+121)) {
tmp = v * (t1 / (u * u));
} else {
tmp = v / (u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -7.4e+130) or not (u <= 3.5e+121): tmp = v * (t1 / (u * u)) else: tmp = v / (u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -7.4e+130) || !(u <= 3.5e+121)) tmp = Float64(v * Float64(t1 / Float64(u * u))); else tmp = Float64(v / Float64(u - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -7.4e+130) || ~((u <= 3.5e+121))) tmp = v * (t1 / (u * u)); else tmp = v / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -7.4e+130], N[Not[LessEqual[u, 3.5e+121]], $MachinePrecision]], N[(v * N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -7.4 \cdot 10^{+130} \lor \neg \left(u \leq 3.5 \cdot 10^{+121}\right):\\
\;\;\;\;v \cdot \frac{t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u - t1}\\
\end{array}
\end{array}
if u < -7.4000000000000003e130 or 3.5e121 < u Initial program 77.0%
Applied rewrites98.3%
Taylor expanded in u around inf
Applied rewrites92.4%
Applied rewrites74.4%
if -7.4000000000000003e130 < u < 3.5e121Initial program 68.3%
Applied rewrites95.8%
Taylor expanded in u around 0
Applied rewrites68.9%
Final simplification70.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.4e+132) (not (<= u 1.36e+221))) (/ v u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.4e+132) || !(u <= 1.36e+221)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-2.4d+132)) .or. (.not. (u <= 1.36d+221))) then
tmp = v / u
else
tmp = v / -t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.4e+132) || !(u <= 1.36e+221)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.4e+132) or not (u <= 1.36e+221): tmp = v / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.4e+132) || !(u <= 1.36e+221)) tmp = Float64(v / u); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -2.4e+132) || ~((u <= 1.36e+221))) tmp = v / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.4e+132], N[Not[LessEqual[u, 1.36e+221]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.4 \cdot 10^{+132} \lor \neg \left(u \leq 1.36 \cdot 10^{+221}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -2.4000000000000001e132 or 1.36e221 < u Initial program 89.0%
Applied rewrites99.8%
Taylor expanded in u around 0
Applied rewrites46.0%
Taylor expanded in u around inf
Applied rewrites46.0%
if -2.4000000000000001e132 < u < 1.36e221Initial program 66.6%
Taylor expanded in u around 0
Applied rewrites63.6%
Final simplification60.6%
(FPCore (u v t1) :precision binary64 (/ v (- u t1)))
double code(double u, double v, double t1) {
return v / (u - t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / (u - t1)
end function
public static double code(double u, double v, double t1) {
return v / (u - t1);
}
def code(u, v, t1): return v / (u - t1)
function code(u, v, t1) return Float64(v / Float64(u - t1)) end
function tmp = code(u, v, t1) tmp = v / (u - t1); end
code[u_, v_, t1_] := N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u - t1}
\end{array}
Initial program 70.5%
Applied rewrites96.4%
Taylor expanded in u around 0
Applied rewrites61.8%
(FPCore (u v t1) :precision binary64 (/ v u))
double code(double u, double v, double t1) {
return v / u;
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / u
end function
public static double code(double u, double v, double t1) {
return v / u;
}
def code(u, v, t1): return v / u
function code(u, v, t1) return Float64(v / u) end
function tmp = code(u, v, t1) tmp = v / u; end
code[u_, v_, t1_] := N[(v / u), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u}
\end{array}
Initial program 70.5%
Applied rewrites96.4%
Taylor expanded in u around 0
Applied rewrites61.8%
Taylor expanded in u around inf
Applied rewrites13.4%
herbie shell --seed 2025019
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))