
(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}
Herbie found 13 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(Float64(-t1) * Float64(v / Float64(u + t1))) / 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{\left(-t1\right) \cdot \frac{v}{u + t1}}{u + t1}
\end{array}
Initial program 72.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.1
Applied rewrites98.1%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f6498.0
Applied rewrites98.0%
(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)) * Float64(v / Float64(u + t1))) end
function tmp = code(u, v, t1) tmp = (-t1 / (u + t1)) * (v / (u + t1)); end
code[u_, v_, t1_] := N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-t1}{u + t1} \cdot \frac{v}{u + t1}
\end{array}
Initial program 72.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.1
Applied rewrites98.1%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -9e+95)
(/ (fma (* u (/ v t1)) 2.0 (- v)) t1)
(if (<= t1 1.25e+123)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(* (/ (- t1) (+ u t1)) (/ v t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -9e+95) {
tmp = fma((u * (v / t1)), 2.0, -v) / t1;
} else if (t1 <= 1.25e+123) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = (-t1 / (u + t1)) * (v / t1);
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -9e+95) tmp = Float64(fma(Float64(u * Float64(v / t1)), 2.0, Float64(-v)) / t1); elseif (t1 <= 1.25e+123) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v / t1)); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -9e+95], N[(N[(N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, 1.25e+123], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9 \cdot 10^{+95}:\\
\;\;\;\;\frac{\mathsf{fma}\left(u \cdot \frac{v}{t1}, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq 1.25 \cdot 10^{+123}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u + t1} \cdot \frac{v}{t1}\\
\end{array}
\end{array}
if t1 < -9.00000000000000033e95Initial program 49.7%
Taylor expanded in t1 around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
if -9.00000000000000033e95 < t1 < 1.24999999999999994e123Initial program 84.7%
if 1.24999999999999994e123 < t1 Initial program 46.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
lift-/.f6491.4
Applied rewrites91.4%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -4.7e+95)
(/ (fma (* u (/ v t1)) 2.0 (- v)) t1)
(if (<= t1 1.45e+115)
(* (- t1) (/ v (* (+ u t1) (+ u t1))))
(* (- (/ u t1) 1.0) (/ v (+ u t1))))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -4.7e+95) {
tmp = fma((u * (v / t1)), 2.0, -v) / t1;
} else if (t1 <= 1.45e+115) {
tmp = -t1 * (v / ((u + t1) * (u + t1)));
} else {
tmp = ((u / t1) - 1.0) * (v / (u + t1));
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -4.7e+95) tmp = Float64(fma(Float64(u * Float64(v / t1)), 2.0, Float64(-v)) / t1); elseif (t1 <= 1.45e+115) tmp = Float64(Float64(-t1) * Float64(v / Float64(Float64(u + t1) * Float64(u + t1)))); else tmp = Float64(Float64(Float64(u / t1) - 1.0) * Float64(v / Float64(u + t1))); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -4.7e+95], N[(N[(N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, 1.45e+115], N[((-t1) * N[(v / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.7 \cdot 10^{+95}:\\
\;\;\;\;\frac{\mathsf{fma}\left(u \cdot \frac{v}{t1}, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq 1.45 \cdot 10^{+115}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{\left(u + t1\right) \cdot \left(u + t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{u}{t1} - 1\right) \cdot \frac{v}{u + t1}\\
\end{array}
\end{array}
if t1 < -4.69999999999999972e95Initial program 49.7%
Taylor expanded in t1 around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
if -4.69999999999999972e95 < t1 < 1.45000000000000002e115Initial program 84.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6484.7
Applied rewrites84.7%
if 1.45000000000000002e115 < t1 Initial program 47.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -2.55e-48)
(* (- (/ u t1) 1.0) (/ v (+ u t1)))
(if (<= t1 8.5e-66)
(/ (/ (* v (- t1)) u) u)
(* (/ (- t1) (+ u t1)) (/ v t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.55e-48) {
tmp = ((u / t1) - 1.0) * (v / (u + t1));
} else if (t1 <= 8.5e-66) {
tmp = ((v * -t1) / u) / u;
} else {
tmp = (-t1 / (u + t1)) * (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 (t1 <= (-2.55d-48)) then
tmp = ((u / t1) - 1.0d0) * (v / (u + t1))
else if (t1 <= 8.5d-66) then
tmp = ((v * -t1) / u) / u
else
tmp = (-t1 / (u + t1)) * (v / t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.55e-48) {
tmp = ((u / t1) - 1.0) * (v / (u + t1));
} else if (t1 <= 8.5e-66) {
tmp = ((v * -t1) / u) / u;
} else {
tmp = (-t1 / (u + t1)) * (v / t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -2.55e-48: tmp = ((u / t1) - 1.0) * (v / (u + t1)) elif t1 <= 8.5e-66: tmp = ((v * -t1) / u) / u else: tmp = (-t1 / (u + t1)) * (v / t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -2.55e-48) tmp = Float64(Float64(Float64(u / t1) - 1.0) * Float64(v / Float64(u + t1))); elseif (t1 <= 8.5e-66) tmp = Float64(Float64(Float64(v * Float64(-t1)) / u) / u); else tmp = Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v / t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -2.55e-48) tmp = ((u / t1) - 1.0) * (v / (u + t1)); elseif (t1 <= 8.5e-66) tmp = ((v * -t1) / u) / u; else tmp = (-t1 / (u + t1)) * (v / t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -2.55e-48], N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 8.5e-66], N[(N[(N[(v * (-t1)), $MachinePrecision] / u), $MachinePrecision] / u), $MachinePrecision], N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;\left(\frac{u}{t1} - 1\right) \cdot \frac{v}{u + t1}\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\frac{v \cdot \left(-t1\right)}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u + t1} \cdot \frac{v}{t1}\\
\end{array}
\end{array}
if t1 < -2.55000000000000006e-48Initial program 64.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
if -2.55000000000000006e-48 < t1 < 8.49999999999999966e-66Initial program 82.6%
Taylor expanded in u around inf
Applied rewrites71.8%
Taylor expanded in u around inf
Applied rewrites74.4%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f6477.6
+-commutative77.6
+-commutativeN/A
Applied rewrites77.6%
if 8.49999999999999966e-66 < t1 Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in u around 0
lift-/.f6479.7
Applied rewrites79.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- t1) (+ u t1)) (/ v t1))))
(if (<= t1 -2.5e-84)
t_1
(if (<= t1 8.5e-66) (/ (/ (* v (- t1)) u) u) t_1))))
double code(double u, double v, double t1) {
double t_1 = (-t1 / (u + t1)) * (v / t1);
double tmp;
if (t1 <= -2.5e-84) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = ((v * -t1) / u) / u;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 = (-t1 / (u + t1)) * (v / t1)
if (t1 <= (-2.5d-84)) then
tmp = t_1
else if (t1 <= 8.5d-66) then
tmp = ((v * -t1) / u) / u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 / (u + t1)) * (v / t1);
double tmp;
if (t1 <= -2.5e-84) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = ((v * -t1) / u) / u;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / (u + t1)) * (v / t1) tmp = 0 if t1 <= -2.5e-84: tmp = t_1 elif t1 <= 8.5e-66: tmp = ((v * -t1) / u) / u else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v / t1)) tmp = 0.0 if (t1 <= -2.5e-84) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = Float64(Float64(Float64(v * Float64(-t1)) / u) / u); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / (u + t1)) * (v / t1); tmp = 0.0; if (t1 <= -2.5e-84) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = ((v * -t1) / u) / u; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.5e-84], t$95$1, If[LessEqual[t1, 8.5e-66], N[(N[(N[(v * (-t1)), $MachinePrecision] / u), $MachinePrecision] / u), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t1}{u + t1} \cdot \frac{v}{t1}\\
\mathbf{if}\;t1 \leq -2.5 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\frac{v \cdot \left(-t1\right)}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.5000000000000001e-84 or 8.49999999999999966e-66 < t1 Initial program 67.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in u around 0
lift-/.f6479.0
Applied rewrites79.0%
if -2.5000000000000001e-84 < t1 < 8.49999999999999966e-66Initial program 81.8%
Taylor expanded in u around inf
Applied rewrites72.6%
Taylor expanded in u around inf
Applied rewrites75.2%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f6478.4
+-commutative78.4
+-commutativeN/A
Applied rewrites78.4%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))))
(if (<= t1 -2.55e-48)
t_1
(if (<= t1 8.5e-66) (/ (/ (* v (- t1)) u) u) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2.55e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = ((v * -t1) / u) / u;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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)
if (t1 <= (-2.55d-48)) then
tmp = t_1
else if (t1 <= 8.5d-66) then
tmp = ((v * -t1) / u) / u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2.55e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = ((v * -t1) / u) / u;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -2.55e-48: tmp = t_1 elif t1 <= 8.5e-66: tmp = ((v * -t1) / u) / u else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -2.55e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = Float64(Float64(Float64(v * Float64(-t1)) / u) / u); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -2.55e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = ((v * -t1) / u) / u; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.55e-48], t$95$1, If[LessEqual[t1, 8.5e-66], N[(N[(N[(v * (-t1)), $MachinePrecision] / u), $MachinePrecision] / u), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\frac{v \cdot \left(-t1\right)}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.55000000000000006e-48 or 8.49999999999999966e-66 < t1 Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.5
Applied rewrites78.5%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6480.2
Applied rewrites80.2%
if -2.55000000000000006e-48 < t1 < 8.49999999999999966e-66Initial program 82.6%
Taylor expanded in u around inf
Applied rewrites71.8%
Taylor expanded in u around inf
Applied rewrites74.4%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f6477.6
+-commutative77.6
+-commutativeN/A
Applied rewrites77.6%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ u t1)))) (if (<= t1 -2e-48) t_1 (if (<= t1 8.5e-66) (/ (* (- t1) (/ v u)) u) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = (-t1 * (v / u)) / u;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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)
if (t1 <= (-2d-48)) then
tmp = t_1
else if (t1 <= 8.5d-66) then
tmp = (-t1 * (v / u)) / u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = (-t1 * (v / u)) / u;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -2e-48: tmp = t_1 elif t1 <= 8.5e-66: tmp = (-t1 * (v / u)) / u else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -2e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = Float64(Float64(Float64(-t1) * Float64(v / u)) / u); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -2e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = (-t1 * (v / u)) / u; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2e-48], t$95$1, If[LessEqual[t1, 8.5e-66], N[(N[((-t1) * N[(v / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -2 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot \frac{v}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.9999999999999999e-48 or 8.49999999999999966e-66 < t1 Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.5
Applied rewrites78.5%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6480.2
Applied rewrites80.2%
if -1.9999999999999999e-48 < t1 < 8.49999999999999966e-66Initial program 82.6%
Taylor expanded in u around inf
Applied rewrites71.8%
Taylor expanded in u around inf
Applied rewrites74.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6479.8
Applied rewrites79.8%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ u t1)))) (if (<= t1 -2e-48) t_1 (if (<= t1 8.5e-66) (/ (* (- t1) v) (* u u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = (-t1 * v) / (u * u);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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)
if (t1 <= (-2d-48)) then
tmp = t_1
else if (t1 <= 8.5d-66) then
tmp = (-t1 * v) / (u * u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = (-t1 * v) / (u * u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -2e-48: tmp = t_1 elif t1 <= 8.5e-66: tmp = (-t1 * v) / (u * u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -2e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -2e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = (-t1 * v) / (u * u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2e-48], t$95$1, If[LessEqual[t1, 8.5e-66], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -2 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.9999999999999999e-48 or 8.49999999999999966e-66 < t1 Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.5
Applied rewrites78.5%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6480.2
Applied rewrites80.2%
if -1.9999999999999999e-48 < t1 < 8.49999999999999966e-66Initial program 82.6%
Taylor expanded in u around inf
Applied rewrites71.8%
Taylor expanded in u around inf
Applied rewrites74.4%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ u t1)))) (if (<= t1 -2e-48) t_1 (if (<= t1 8.5e-66) (* (- t1) (/ v (* u u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = -t1 * (v / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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)
if (t1 <= (-2d-48)) then
tmp = t_1
else if (t1 <= 8.5d-66) then
tmp = -t1 * (v / (u * u))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -2e-48) {
tmp = t_1;
} else if (t1 <= 8.5e-66) {
tmp = -t1 * (v / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -2e-48: tmp = t_1 elif t1 <= 8.5e-66: tmp = -t1 * (v / (u * u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -2e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = Float64(Float64(-t1) * Float64(v / Float64(u * u))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -2e-48) tmp = t_1; elseif (t1 <= 8.5e-66) tmp = -t1 * (v / (u * u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2e-48], t$95$1, If[LessEqual[t1, 8.5e-66], N[((-t1) * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -2 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.9999999999999999e-48 or 8.49999999999999966e-66 < t1 Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.5
Applied rewrites78.5%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6480.2
Applied rewrites80.2%
if -1.9999999999999999e-48 < t1 < 8.49999999999999966e-66Initial program 82.6%
Taylor expanded in u around inf
Applied rewrites71.8%
Taylor expanded in u around inf
Applied rewrites74.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.2
+-commutative74.2
+-commutativeN/A
Applied rewrites74.2%
(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(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 72.6%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6482.5
Applied rewrites82.5%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6462.6
Applied rewrites62.6%
(FPCore (u v t1) :precision binary64 (if (<= v 4.7e-273) (/ (- v) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (v <= 4.7e-273) {
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 (v <= 4.7d-273) 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 (v <= 4.7e-273) {
tmp = -v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if v <= 4.7e-273: tmp = -v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (v <= 4.7e-273) tmp = Float64(Float64(-v) / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (v <= 4.7e-273) tmp = -v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[v, 4.7e-273], N[((-v) / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 4.7 \cdot 10^{-273}:\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if v < 4.69999999999999962e-273Initial program 72.7%
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6481.9
Applied rewrites81.9%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6464.8
Applied rewrites64.8%
Taylor expanded in u around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6456.7
Applied rewrites56.7%
Taylor expanded in u around inf
Applied rewrites19.3%
if 4.69999999999999962e-273 < v Initial program 72.4%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.8
Applied rewrites53.8%
(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.6%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
herbie shell --seed 2025120
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))