
(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 73.9%
Applied rewrites97.3%
Final simplification97.3%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (- t1) v)))
(if (<= t1 -9.2e+151)
(/ (fma (* (/ v t1) u) 2.0 (- v)) t1)
(if (<= t1 -8.4e-168)
(/ t_1 (* (+ t1 u) (+ t1 u)))
(if (<= t1 6.2e-217)
(* (- v) (/ (/ t1 u) u))
(if (<= t1 6e+158)
(/ t_1 (fma (fma 2.0 t1 u) u (* t1 t1)))
(/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = -t1 * v;
double tmp;
if (t1 <= -9.2e+151) {
tmp = fma(((v / t1) * u), 2.0, -v) / t1;
} else if (t1 <= -8.4e-168) {
tmp = t_1 / ((t1 + u) * (t1 + u));
} else if (t1 <= 6.2e-217) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 6e+158) {
tmp = t_1 / fma(fma(2.0, t1, u), u, (t1 * t1));
} else {
tmp = -v / t1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(-t1) * v) tmp = 0.0 if (t1 <= -9.2e+151) tmp = Float64(fma(Float64(Float64(v / t1) * u), 2.0, Float64(-v)) / t1); elseif (t1 <= -8.4e-168) tmp = Float64(t_1 / Float64(Float64(t1 + u) * Float64(t1 + u))); elseif (t1 <= 6.2e-217) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); elseif (t1 <= 6e+158) tmp = Float64(t_1 / fma(fma(2.0, t1, u), u, Float64(t1 * t1))); else tmp = Float64(Float64(-v) / t1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-t1) * v), $MachinePrecision]}, If[LessEqual[t1, -9.2e+151], N[(N[(N[(N[(v / t1), $MachinePrecision] * u), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, -8.4e-168], N[(t$95$1 / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6.2e-217], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6e+158], N[(t$95$1 / N[(N[(2.0 * t1 + u), $MachinePrecision] * u + N[(t1 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t1\right) \cdot v\\
\mathbf{if}\;t1 \leq -9.2 \cdot 10^{+151}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1} \cdot u, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq -8.4 \cdot 10^{-168}:\\
\;\;\;\;\frac{t\_1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{elif}\;t1 \leq 6.2 \cdot 10^{-217}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 6 \cdot 10^{+158}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(\mathsf{fma}\left(2, t1, u\right), u, t1 \cdot t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -9.2000000000000003e151Initial program 39.7%
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.f6492.0
Applied rewrites92.0%
if -9.2000000000000003e151 < t1 < -8.39999999999999976e-168Initial program 91.1%
if -8.39999999999999976e-168 < t1 < 6.1999999999999997e-217Initial program 69.2%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.4
Applied rewrites81.4%
Applied rewrites90.6%
if 6.1999999999999997e-217 < t1 < 6e158Initial program 89.3%
Taylor expanded in u around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6489.3
Applied rewrites89.3%
if 6e158 < t1 Initial program 37.1%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -9.2e+151)
(/ (fma (* (/ v t1) u) 2.0 (- v)) t1)
(if (<= t1 -8.4e-168)
t_1
(if (<= t1 5.8e-226)
(* (- v) (/ (/ t1 u) u))
(if (<= t1 6e+158) t_1 (/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -9.2e+151) {
tmp = fma(((v / t1) * u), 2.0, -v) / t1;
} else if (t1 <= -8.4e-168) {
tmp = t_1;
} else if (t1 <= 5.8e-226) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 6e+158) {
tmp = t_1;
} else {
tmp = -v / t1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -9.2e+151) tmp = Float64(fma(Float64(Float64(v / t1) * u), 2.0, Float64(-v)) / t1); elseif (t1 <= -8.4e-168) tmp = t_1; elseif (t1 <= 5.8e-226) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); elseif (t1 <= 6e+158) tmp = t_1; else tmp = Float64(Float64(-v) / t1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -9.2e+151], N[(N[(N[(N[(v / t1), $MachinePrecision] * u), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, -8.4e-168], t$95$1, If[LessEqual[t1, 5.8e-226], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6e+158], t$95$1, N[((-v) / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -9.2 \cdot 10^{+151}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1} \cdot u, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq -8.4 \cdot 10^{-168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.8 \cdot 10^{-226}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 6 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -9.2000000000000003e151Initial program 39.7%
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.f6492.0
Applied rewrites92.0%
if -9.2000000000000003e151 < t1 < -8.39999999999999976e-168 or 5.80000000000000003e-226 < t1 < 6e158Initial program 89.8%
if -8.39999999999999976e-168 < t1 < 5.80000000000000003e-226Initial program 69.1%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Applied rewrites91.8%
if 6e158 < t1 Initial program 37.1%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -1.3e+154)
(* (- v) (/ (fma (/ u t1) -2.0 1.0) t1))
(if (<= t1 -8.4e-168)
t_1
(if (<= t1 5.8e-226)
(* (- v) (/ (/ t1 u) u))
(if (<= t1 6e+158) t_1 (/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -1.3e+154) {
tmp = -v * (fma((u / t1), -2.0, 1.0) / t1);
} else if (t1 <= -8.4e-168) {
tmp = t_1;
} else if (t1 <= 5.8e-226) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 6e+158) {
tmp = t_1;
} else {
tmp = -v / t1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -1.3e+154) tmp = Float64(Float64(-v) * Float64(fma(Float64(u / t1), -2.0, 1.0) / t1)); elseif (t1 <= -8.4e-168) tmp = t_1; elseif (t1 <= 5.8e-226) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); elseif (t1 <= 6e+158) tmp = t_1; else tmp = Float64(Float64(-v) / t1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.3e+154], N[((-v) * N[(N[(N[(u / t1), $MachinePrecision] * -2.0 + 1.0), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -8.4e-168], t$95$1, If[LessEqual[t1, 5.8e-226], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6e+158], t$95$1, N[((-v) / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{+154}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\mathsf{fma}\left(\frac{u}{t1}, -2, 1\right)}{t1}\\
\mathbf{elif}\;t1 \leq -8.4 \cdot 10^{-168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.8 \cdot 10^{-226}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 6 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -1.29999999999999994e154Initial program 39.7%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6491.3
Applied rewrites91.3%
Taylor expanded in t1 around -inf
*-lft-identityN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
distribute-rgt-inN/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
if -1.29999999999999994e154 < t1 < -8.39999999999999976e-168 or 5.80000000000000003e-226 < t1 < 6e158Initial program 89.8%
if -8.39999999999999976e-168 < t1 < 5.80000000000000003e-226Initial program 69.1%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Applied rewrites91.8%
if 6e158 < t1 Initial program 37.1%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -9.2e+151)
(/ (* -1.0 v) (+ (- u) t1))
(if (<= t1 -8.4e-168)
t_1
(if (<= t1 5.8e-226)
(* (- v) (/ (/ t1 u) u))
(if (<= t1 6e+158) t_1 (/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -9.2e+151) {
tmp = (-1.0 * v) / (-u + t1);
} else if (t1 <= -8.4e-168) {
tmp = t_1;
} else if (t1 <= 5.8e-226) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 6e+158) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (-t1 * v) / ((t1 + u) * (t1 + u))
if (t1 <= (-9.2d+151)) then
tmp = ((-1.0d0) * v) / (-u + t1)
else if (t1 <= (-8.4d-168)) then
tmp = t_1
else if (t1 <= 5.8d-226) then
tmp = -v * ((t1 / u) / u)
else if (t1 <= 6d+158) then
tmp = t_1
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -9.2e+151) {
tmp = (-1.0 * v) / (-u + t1);
} else if (t1 <= -8.4e-168) {
tmp = t_1;
} else if (t1 <= 5.8e-226) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 6e+158) {
tmp = t_1;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)) tmp = 0 if t1 <= -9.2e+151: tmp = (-1.0 * v) / (-u + t1) elif t1 <= -8.4e-168: tmp = t_1 elif t1 <= 5.8e-226: tmp = -v * ((t1 / u) / u) elif t1 <= 6e+158: tmp = t_1 else: tmp = -v / t1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -9.2e+151) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); elseif (t1 <= -8.4e-168) tmp = t_1; elseif (t1 <= 5.8e-226) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); elseif (t1 <= 6e+158) tmp = t_1; else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)); tmp = 0.0; if (t1 <= -9.2e+151) tmp = (-1.0 * v) / (-u + t1); elseif (t1 <= -8.4e-168) tmp = t_1; elseif (t1 <= 5.8e-226) tmp = -v * ((t1 / u) / u); elseif (t1 <= 6e+158) tmp = t_1; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -9.2e+151], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -8.4e-168], t$95$1, If[LessEqual[t1, 5.8e-226], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6e+158], t$95$1, N[((-v) / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -9.2 \cdot 10^{+151}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{elif}\;t1 \leq -8.4 \cdot 10^{-168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.8 \cdot 10^{-226}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 6 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -9.2000000000000003e151Initial program 39.7%
Applied rewrites97.8%
Taylor expanded in u around 0
Applied rewrites91.4%
if -9.2000000000000003e151 < t1 < -8.39999999999999976e-168 or 5.80000000000000003e-226 < t1 < 6e158Initial program 89.8%
if -8.39999999999999976e-168 < t1 < 5.80000000000000003e-226Initial program 69.1%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Applied rewrites91.8%
if 6e158 < t1 Initial program 37.1%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Final simplification91.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.1e-82) (not (<= t1 1.4e+20))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (/ t1 u) v) (- u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-82) || !(t1 <= 1.4e+20)) {
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 <= (-3.1d-82)) .or. (.not. (t1 <= 1.4d+20))) 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 <= -3.1e-82) || !(t1 <= 1.4e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((t1 / u) * v) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.1e-82) or not (t1 <= 1.4e+20): tmp = (-1.0 * v) / (-u + t1) else: tmp = ((t1 / u) * v) / -u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.1e-82) || !(t1 <= 1.4e+20)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(t1 / u) * v) / Float64(-u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3.1e-82) || ~((t1 <= 1.4e+20))) 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, -3.1e-82], N[Not[LessEqual[t1, 1.4e+20]], $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 -3.1 \cdot 10^{-82} \lor \neg \left(t1 \leq 1.4 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot v}{-u}\\
\end{array}
\end{array}
if t1 < -3.1e-82 or 1.4e20 < t1 Initial program 66.3%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites85.8%
if -3.1e-82 < t1 < 1.4e20Initial program 82.8%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6476.7
Applied rewrites76.7%
Applied rewrites79.9%
Final simplification83.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.8e-82) (not (<= t1 1.4e+20))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ v u) (/ (- t1) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.8e-82) || !(t1 <= 1.4e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (v / 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 <= (-2.8d-82)) .or. (.not. (t1 <= 1.4d+20))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.8e-82) || !(t1 <= 1.4e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.8e-82) or not (t1 <= 1.4e+20): tmp = (-1.0 * v) / (-u + t1) else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.8e-82) || !(t1 <= 1.4e+20)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.8e-82) || ~((t1 <= 1.4e+20))) tmp = (-1.0 * v) / (-u + t1); else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.8e-82], N[Not[LessEqual[t1, 1.4e+20]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.8 \cdot 10^{-82} \lor \neg \left(t1 \leq 1.4 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if t1 < -2.80000000000000024e-82 or 1.4e20 < t1 Initial program 66.3%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites85.8%
if -2.80000000000000024e-82 < t1 < 1.4e20Initial program 82.8%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6476.7
Applied rewrites76.7%
Final simplification81.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.75e-114) (not (<= t1 1.15e+20))) (/ (* -1.0 v) (+ (- u) t1)) (* (- v) (/ (/ t1 u) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.75e-114) || !(t1 <= 1.15e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -v * ((t1 / u) / u);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-2.75d-114)) .or. (.not. (t1 <= 1.15d+20))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = -v * ((t1 / u) / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.75e-114) || !(t1 <= 1.15e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -v * ((t1 / u) / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.75e-114) or not (t1 <= 1.15e+20): tmp = (-1.0 * v) / (-u + t1) else: tmp = -v * ((t1 / u) / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.75e-114) || !(t1 <= 1.15e+20)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.75e-114) || ~((t1 <= 1.15e+20))) tmp = (-1.0 * v) / (-u + t1); else tmp = -v * ((t1 / u) / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.75e-114], N[Not[LessEqual[t1, 1.15e+20]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.75 \cdot 10^{-114} \lor \neg \left(t1 \leq 1.15 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\end{array}
\end{array}
if t1 < -2.75000000000000005e-114 or 1.15e20 < t1 Initial program 68.6%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites83.6%
if -2.75000000000000005e-114 < t1 < 1.15e20Initial program 81.2%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
Applied rewrites78.7%
Final simplification81.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.75e-114) (not (<= t1 1.15e+20))) (/ (* -1.0 v) (+ (- u) t1)) (* (- v) (/ t1 (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.75e-114) || !(t1 <= 1.15e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -v * (t1 / (u * u));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-2.75d-114)) .or. (.not. (t1 <= 1.15d+20))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = -v * (t1 / (u * u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.75e-114) || !(t1 <= 1.15e+20)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -v * (t1 / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.75e-114) or not (t1 <= 1.15e+20): tmp = (-1.0 * v) / (-u + t1) else: tmp = -v * (t1 / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.75e-114) || !(t1 <= 1.15e+20)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(-v) * Float64(t1 / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.75e-114) || ~((t1 <= 1.15e+20))) tmp = (-1.0 * v) / (-u + t1); else tmp = -v * (t1 / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.75e-114], N[Not[LessEqual[t1, 1.15e+20]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[((-v) * N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.75 \cdot 10^{-114} \lor \neg \left(t1 \leq 1.15 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-v\right) \cdot \frac{t1}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -2.75000000000000005e-114 or 1.15e20 < t1 Initial program 68.6%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites83.6%
if -2.75000000000000005e-114 < t1 < 1.15e20Initial program 81.2%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
Applied rewrites74.3%
Final simplification79.7%
(FPCore (u v t1) :precision binary64 (if (<= v 28000000.0) (/ (* -1.0 v) (+ (- u) t1)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (v <= 28000000.0) {
tmp = (-1.0 * v) / (-u + t1);
} 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 <= 28000000.0d0) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (v <= 28000000.0) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if v <= 28000000.0: tmp = (-1.0 * v) / (-u + t1) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (v <= 28000000.0) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (v <= 28000000.0) tmp = (-1.0 * v) / (-u + t1); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[v, 28000000.0], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 28000000:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if v < 2.8e7Initial program 78.8%
Applied rewrites97.1%
Taylor expanded in u around 0
Applied rewrites66.0%
if 2.8e7 < v Initial program 58.6%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.2
Applied rewrites53.2%
Final simplification62.9%
(FPCore (u v t1) :precision binary64 (if (<= v 26500000.0) (* (- v) (/ -1.0 (- u t1))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (v <= 26500000.0) {
tmp = -v * (-1.0 / (u - t1));
} 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 <= 26500000.0d0) then
tmp = -v * ((-1.0d0) / (u - t1))
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (v <= 26500000.0) {
tmp = -v * (-1.0 / (u - t1));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if v <= 26500000.0: tmp = -v * (-1.0 / (u - t1)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (v <= 26500000.0) tmp = Float64(Float64(-v) * Float64(-1.0 / Float64(u - t1))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (v <= 26500000.0) tmp = -v * (-1.0 / (u - t1)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[v, 26500000.0], N[((-v) * N[(-1.0 / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 26500000:\\
\;\;\;\;\left(-v\right) \cdot \frac{-1}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if v < 2.65e7Initial program 78.8%
Applied rewrites97.1%
Taylor expanded in u around 0
Applied rewrites66.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.8
Applied rewrites65.8%
if 2.65e7 < v Initial program 58.6%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.2
Applied rewrites53.2%
(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 73.9%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6455.9
Applied rewrites55.9%
herbie shell --seed 2025006
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))