
(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 (- u t1)) v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return ((t1 / (u - t1)) * 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 = ((t1 / (u - t1)) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (u - t1)) * v) / (-u + t1);
}
def code(u, v, t1): return ((t1 / (u - t1)) * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(u - t1)) * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (u - t1)) * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{u - t1} \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 72.7%
Applied rewrites96.9%
Final simplification96.9%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -1.25e+154)
(/ (fma (* (/ v t1) u) 2.0 (- v)) t1)
(if (<= t1 2e+151)
(* v (/ (- t1) (fma (fma t1 2.0 u) u (* t1 t1))))
(/ (* -1.0 v) (+ (- u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.25e+154) {
tmp = fma(((v / t1) * u), 2.0, -v) / t1;
} else if (t1 <= 2e+151) {
tmp = v * (-t1 / fma(fma(t1, 2.0, u), u, (t1 * t1)));
} else {
tmp = (-1.0 * v) / (-u + t1);
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.25e+154) tmp = Float64(fma(Float64(Float64(v / t1) * u), 2.0, Float64(-v)) / t1); elseif (t1 <= 2e+151) tmp = Float64(v * Float64(Float64(-t1) / fma(fma(t1, 2.0, u), u, Float64(t1 * t1)))); else tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -1.25e+154], N[(N[(N[(N[(v / t1), $MachinePrecision] * u), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, 2e+151], N[(v * N[((-t1) / N[(N[(t1 * 2.0 + u), $MachinePrecision] * u + N[(t1 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.25 \cdot 10^{+154}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1} \cdot u, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq 2 \cdot 10^{+151}:\\
\;\;\;\;v \cdot \frac{-t1}{\mathsf{fma}\left(\mathsf{fma}\left(t1, 2, u\right), u, t1 \cdot t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\end{array}
\end{array}
if t1 < -1.25000000000000001e154Initial program 28.4%
Taylor expanded in u around 0
associate-*r/N/A
unpow2N/A
associate-/r*N/A
associate-/l*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
if -1.25000000000000001e154 < t1 < 2.00000000000000003e151Initial program 86.8%
Taylor expanded in u around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.9
Applied rewrites91.9%
if 2.00000000000000003e151 < t1 Initial program 36.6%
Applied rewrites98.7%
Taylor expanded in u around 0
Applied rewrites92.6%
Final simplification93.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7e+82) (not (<= t1 7e+132))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7e+82) || !(t1 <= 7e+132)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (t1 + 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 <= (-7d+82)) .or. (.not. (t1 <= 7d+132))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7e+82) || !(t1 <= 7e+132)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -7e+82) or not (t1 <= 7e+132): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7e+82) || !(t1 <= 7e+132)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -7e+82) || ~((t1 <= 7e+132))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7e+82], N[Not[LessEqual[t1, 7e+132]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7 \cdot 10^{+82} \lor \neg \left(t1 \leq 7 \cdot 10^{+132}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\end{array}
\end{array}
if t1 < -7.0000000000000001e82 or 7.00000000000000041e132 < t1 Initial program 39.9%
Applied rewrites96.9%
Taylor expanded in u around 0
Applied rewrites94.1%
if -7.0000000000000001e82 < t1 < 7.00000000000000041e132Initial program 90.2%
Final simplification91.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.3e-118) (not (<= t1 1.8e-56))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (/ (- t1) u) v) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((-t1 / u) * v) / 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 <= (-1.3d-118)) .or. (.not. (t1 <= 1.8d-56))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = ((-t1 / u) * v) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((-t1 / u) * v) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.3e-118) or not (t1 <= 1.8e-56): tmp = (-1.0 * v) / (-u + t1) else: tmp = ((-t1 / u) * v) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(Float64(-t1) / u) * v) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.3e-118) || ~((t1 <= 1.8e-56))) tmp = (-1.0 * v) / (-u + t1); else tmp = ((-t1 / u) * v) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.3e-118], N[Not[LessEqual[t1, 1.8e-56]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-t1) / u), $MachinePrecision] * v), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{-118} \lor \neg \left(t1 \leq 1.8 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-t1}{u} \cdot v}{u}\\
\end{array}
\end{array}
if t1 < -1.3e-118 or 1.79999999999999989e-56 < t1 Initial program 66.5%
Applied rewrites96.5%
Taylor expanded in u around 0
Applied rewrites82.1%
if -1.3e-118 < t1 < 1.79999999999999989e-56Initial program 86.2%
Taylor expanded in u around inf
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6478.4
Applied rewrites78.4%
Applied rewrites83.7%
Final simplification82.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.2e-108) (not (<= t1 1.8e-56))) (/ (* -1.0 v) (+ (- u) t1)) (* (- t1) (/ (/ v u) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.2e-108) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -t1 * ((v / 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 <= (-1.2d-108)) .or. (.not. (t1 <= 1.8d-56))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = -t1 * ((v / u) / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.2e-108) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -t1 * ((v / u) / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.2e-108) or not (t1 <= 1.8e-56): tmp = (-1.0 * v) / (-u + t1) else: tmp = -t1 * ((v / u) / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.2e-108) || !(t1 <= 1.8e-56)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(-t1) * Float64(Float64(v / u) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.2e-108) || ~((t1 <= 1.8e-56))) tmp = (-1.0 * v) / (-u + t1); else tmp = -t1 * ((v / u) / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.2e-108], N[Not[LessEqual[t1, 1.8e-56]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[((-t1) * N[(N[(v / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.2 \cdot 10^{-108} \lor \neg \left(t1 \leq 1.8 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{\frac{v}{u}}{u}\\
\end{array}
\end{array}
if t1 < -1.20000000000000009e-108 or 1.79999999999999989e-56 < t1 Initial program 65.9%
Applied rewrites96.5%
Taylor expanded in u around 0
Applied rewrites82.4%
if -1.20000000000000009e-108 < t1 < 1.79999999999999989e-56Initial program 86.7%
Taylor expanded in u around inf
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6478.0
Applied rewrites78.0%
Applied rewrites78.9%
Final simplification81.2%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -7e+82)
(/ (fma (* (/ v t1) u) 2.0 (- v)) t1)
(if (<= t1 7e+132)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(/ (* -1.0 v) (+ (- u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -7e+82) {
tmp = fma(((v / t1) * u), 2.0, -v) / t1;
} else if (t1 <= 7e+132) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = (-1.0 * v) / (-u + t1);
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -7e+82) tmp = Float64(fma(Float64(Float64(v / t1) * u), 2.0, Float64(-v)) / t1); elseif (t1 <= 7e+132) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -7e+82], N[(N[(N[(N[(v / t1), $MachinePrecision] * u), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, 7e+132], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7 \cdot 10^{+82}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1} \cdot u, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq 7 \cdot 10^{+132}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\end{array}
\end{array}
if t1 < -7.0000000000000001e82Initial program 42.5%
Taylor expanded in u around 0
associate-*r/N/A
unpow2N/A
associate-/r*N/A
associate-/l*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6496.2
Applied rewrites96.2%
if -7.0000000000000001e82 < t1 < 7.00000000000000041e132Initial program 90.2%
if 7.00000000000000041e132 < t1 Initial program 35.6%
Applied rewrites98.1%
Taylor expanded in u around 0
Applied rewrites90.7%
Final simplification91.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.3e-118) (not (<= t1 1.8e-56))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (- t1) v) (* u u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / (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 <= (-1.3d-118)) .or. (.not. (t1 <= 1.8d-56))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (-t1 * v) / (u * u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / (u * u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.3e-118) or not (t1 <= 1.8e-56): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-t1 * v) / (u * u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.3e-118) || ~((t1 <= 1.8e-56))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-t1 * v) / (u * u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.3e-118], N[Not[LessEqual[t1, 1.8e-56]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{-118} \lor \neg \left(t1 \leq 1.8 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -1.3e-118 or 1.79999999999999989e-56 < t1 Initial program 66.5%
Applied rewrites96.5%
Taylor expanded in u around 0
Applied rewrites82.1%
if -1.3e-118 < t1 < 1.79999999999999989e-56Initial program 86.2%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6477.0
Applied rewrites77.0%
Final simplification80.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.3e-118) (not (<= t1 1.8e-56))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ (- v) (* u u)) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * 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 <= (-1.3d-118)) .or. (.not. (t1 <= 1.8d-56))) then
tmp = ((-1.0d0) * 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 <= -1.3e-118) || !(t1 <= 1.8e-56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-v / (u * u)) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.3e-118) or not (t1 <= 1.8e-56): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-v / (u * u)) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.3e-118) || !(t1 <= 1.8e-56)) tmp = Float64(Float64(-1.0 * v) / Float64(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 <= -1.3e-118) || ~((t1 <= 1.8e-56))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-v / (u * u)) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.3e-118], N[Not[LessEqual[t1, 1.8e-56]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / 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 -1.3 \cdot 10^{-118} \lor \neg \left(t1 \leq 1.8 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\end{array}
\end{array}
if t1 < -1.3e-118 or 1.79999999999999989e-56 < t1 Initial program 66.5%
Applied rewrites96.5%
Taylor expanded in u around 0
Applied rewrites82.1%
if -1.3e-118 < t1 < 1.79999999999999989e-56Initial program 86.2%
Taylor expanded in t1 around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r/N/A
cube-multN/A
unpow2N/A
associate-/r*N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in u around inf
Applied rewrites76.8%
Final simplification80.5%
(FPCore (u v t1) :precision binary64 (* (- v) (/ (/ t1 (- u t1)) (- u t1))))
double code(double u, double v, double t1) {
return -v * ((t1 / (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 = -v * ((t1 / (u - t1)) / (u - t1))
end function
public static double code(double u, double v, double t1) {
return -v * ((t1 / (u - t1)) / (u - t1));
}
def code(u, v, t1): return -v * ((t1 / (u - t1)) / (u - t1))
function code(u, v, t1) return Float64(Float64(-v) * Float64(Float64(t1 / Float64(u - t1)) / Float64(u - t1))) end
function tmp = code(u, v, t1) tmp = -v * ((t1 / (u - t1)) / (u - t1)); end
code[u_, v_, t1_] := N[((-v) * N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-v\right) \cdot \frac{\frac{t1}{u - t1}}{u - t1}
\end{array}
Initial program 72.7%
Applied rewrites96.9%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
(FPCore (u v t1) :precision binary64 (/ (* -1.0 v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return (-1.0 * 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 = ((-1.0d0) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return (-1.0 * v) / (-u + t1);
}
def code(u, v, t1): return (-1.0 * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = (-1.0 * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 72.7%
Applied rewrites96.9%
Taylor expanded in u around 0
Applied rewrites65.5%
Final simplification65.5%
(FPCore (u v t1) :precision binary64 (* (- v) (/ -1.0 (- u t1))))
double code(double u, double v, double t1) {
return -v * (-1.0 / (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 * ((-1.0d0) / (u - t1))
end function
public static double code(double u, double v, double t1) {
return -v * (-1.0 / (u - t1));
}
def code(u, v, t1): return -v * (-1.0 / (u - t1))
function code(u, v, t1) return Float64(Float64(-v) * Float64(-1.0 / Float64(u - t1))) end
function tmp = code(u, v, t1) tmp = -v * (-1.0 / (u - t1)); end
code[u_, v_, t1_] := N[((-v) * N[(-1.0 / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-v\right) \cdot \frac{-1}{u - t1}
\end{array}
Initial program 72.7%
Applied rewrites96.9%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in u around 0
Applied rewrites65.3%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / 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 / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(Float64(-v) / t1) end
function tmp = code(u, v, t1) tmp = -v / t1; end
code[u_, v_, t1_] := N[((-v) / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1}
\end{array}
Initial program 72.7%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6458.6
Applied rewrites58.6%
herbie shell --seed 2025007
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))