
(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]
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
Herbie found 7 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]
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
(FPCore (u v t1) :precision binary64 (* (/ v (- (- t1) u)) (/ t1 (+ u t1))))
double code(double u, double v, double t1) {
return (v / (-t1 - u)) * (t1 / (u + t1));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (v / (-t1 - u)) * (t1 / (u + t1))
end function
public static double code(double u, double v, double t1) {
return (v / (-t1 - u)) * (t1 / (u + t1));
}
def code(u, v, t1): return (v / (-t1 - u)) * (t1 / (u + t1))
function code(u, v, t1) return Float64(Float64(v / Float64(Float64(-t1) - u)) * Float64(t1 / Float64(u + t1))) end
function tmp = code(u, v, t1) tmp = (v / (-t1 - u)) * (t1 / (u + t1)); end
code[u_, v_, t1_] := N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u + t1}
Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- t1) (* (+ u t1) (+ u t1))) v)))
(if (<= t1 -4.1e+117)
(/ (- v) t1)
(if (<= t1 -5.8e-192)
t_1
(if (<= t1 1.4e-175)
(* (/ v (- (- t1) u)) (/ t1 u))
(if (<= t1 1.15e+165)
t_1
(/ (* (/ (- u t1) t1) v) (+ u t1))))))))double code(double u, double v, double t1) {
double t_1 = (-t1 / ((u + t1) * (u + t1))) * v;
double tmp;
if (t1 <= -4.1e+117) {
tmp = -v / t1;
} else if (t1 <= -5.8e-192) {
tmp = t_1;
} else if (t1 <= 1.4e-175) {
tmp = (v / (-t1 - u)) * (t1 / u);
} else if (t1 <= 1.15e+165) {
tmp = t_1;
} else {
tmp = (((u - t1) / t1) * v) / (u + t1);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = (-t1 / ((u + t1) * (u + t1))) * v
if (t1 <= (-4.1d+117)) then
tmp = -v / t1
else if (t1 <= (-5.8d-192)) then
tmp = t_1
else if (t1 <= 1.4d-175) then
tmp = (v / (-t1 - u)) * (t1 / u)
else if (t1 <= 1.15d+165) then
tmp = t_1
else
tmp = (((u - t1) / t1) * v) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 / ((u + t1) * (u + t1))) * v;
double tmp;
if (t1 <= -4.1e+117) {
tmp = -v / t1;
} else if (t1 <= -5.8e-192) {
tmp = t_1;
} else if (t1 <= 1.4e-175) {
tmp = (v / (-t1 - u)) * (t1 / u);
} else if (t1 <= 1.15e+165) {
tmp = t_1;
} else {
tmp = (((u - t1) / t1) * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / ((u + t1) * (u + t1))) * v tmp = 0 if t1 <= -4.1e+117: tmp = -v / t1 elif t1 <= -5.8e-192: tmp = t_1 elif t1 <= 1.4e-175: tmp = (v / (-t1 - u)) * (t1 / u) elif t1 <= 1.15e+165: tmp = t_1 else: tmp = (((u - t1) / t1) * v) / (u + t1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / Float64(Float64(u + t1) * Float64(u + t1))) * v) tmp = 0.0 if (t1 <= -4.1e+117) tmp = Float64(Float64(-v) / t1); elseif (t1 <= -5.8e-192) tmp = t_1; elseif (t1 <= 1.4e-175) tmp = Float64(Float64(v / Float64(Float64(-t1) - u)) * Float64(t1 / u)); elseif (t1 <= 1.15e+165) tmp = t_1; else tmp = Float64(Float64(Float64(Float64(u - t1) / t1) * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / ((u + t1) * (u + t1))) * v; tmp = 0.0; if (t1 <= -4.1e+117) tmp = -v / t1; elseif (t1 <= -5.8e-192) tmp = t_1; elseif (t1 <= 1.4e-175) tmp = (v / (-t1 - u)) * (t1 / u); elseif (t1 <= 1.15e+165) tmp = t_1; else tmp = (((u - t1) / t1) * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision]}, If[LessEqual[t1, -4.1e+117], N[((-v) / t1), $MachinePrecision], If[LessEqual[t1, -5.8e-192], t$95$1, If[LessEqual[t1, 1.4e-175], N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.15e+165], t$95$1, N[(N[(N[(N[(u - t1), $MachinePrecision] / t1), $MachinePrecision] * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \frac{-t1}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot v\\
\mathbf{if}\;t1 \leq -4.1 \cdot 10^{+117}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;t1 \leq -5.8 \cdot 10^{-192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.4 \cdot 10^{-175}:\\
\;\;\;\;\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u}\\
\mathbf{elif}\;t1 \leq 1.15 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{u - t1}{t1} \cdot v}{u + t1}\\
\end{array}
if t1 < -4.0999999999999999e117Initial program 72.9%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.3%
Applied rewrites54.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6454.3%
Applied rewrites54.3%
if -4.0999999999999999e117 < t1 < -5.8000000000000003e-192 or 1.4e-175 < t1 < 1.1500000000000001e165Initial program 72.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6475.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.9%
Applied rewrites75.9%
if -5.8000000000000003e-192 < t1 < 1.4e-175Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around inf
lower-/.f6454.9%
Applied rewrites54.9%
if 1.1500000000000001e165 < t1 Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lift-neg.f64N/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6498.3%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.3%
Applied rewrites98.3%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
lift--.f64N/A
sub-negate-revN/A
lift-/.f64N/A
sub-to-fractionN/A
distribute-neg-fracN/A
*-lft-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
inv-powN/A
associate-*l*N/A
mult-flipN/A
lift-/.f64N/A
sub-negate-revN/A
lower-/.f64N/A
Applied rewrites52.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))))
(if (<= t1 -28500000000000.0)
t_1
(if (<= t1 4.2e-28) (* (/ v (- (- t1) u)) (/ t1 u)) t_1))))double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -28500000000000.0) {
tmp = t_1;
} else if (t1 <= 4.2e-28) {
tmp = (v / (-t1 - u)) * (t1 / 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 <= (-28500000000000.0d0)) then
tmp = t_1
else if (t1 <= 4.2d-28) then
tmp = (v / (-t1 - u)) * (t1 / 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 <= -28500000000000.0) {
tmp = t_1;
} else if (t1 <= 4.2e-28) {
tmp = (v / (-t1 - u)) * (t1 / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -28500000000000.0: tmp = t_1 elif t1 <= 4.2e-28: tmp = (v / (-t1 - u)) * (t1 / 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 <= -28500000000000.0) tmp = t_1; elseif (t1 <= 4.2e-28) tmp = Float64(Float64(v / Float64(Float64(-t1) - u)) * Float64(t1 / 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 <= -28500000000000.0) tmp = t_1; elseif (t1 <= 4.2e-28) tmp = (v / (-t1 - u)) * (t1 / 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, -28500000000000.0], t$95$1, If[LessEqual[t1, 4.2e-28], N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -28500000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t1 < -2.85e13 or 4.2000000000000001e-28 < t1 Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
sqr-neg-revN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around 0
Applied rewrites61.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
remove-double-negN/A
distribute-rgt-neg-outN/A
lower-neg.f64N/A
metadata-evalN/A
*-rgt-identity61.9%
Applied rewrites61.9%
if -2.85e13 < t1 < 4.2000000000000001e-28Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around inf
lower-/.f6454.9%
Applied rewrites54.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))))
(if (<= t1 -23000000000000.0)
t_1
(if (<= t1 4.2e-28) (* (/ -1.0 u) (/ (* t1 v) u)) t_1))))double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -23000000000000.0) {
tmp = t_1;
} else if (t1 <= 4.2e-28) {
tmp = (-1.0 / u) * ((t1 * v) / 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 <= (-23000000000000.0d0)) then
tmp = t_1
else if (t1 <= 4.2d-28) then
tmp = ((-1.0d0) / u) * ((t1 * v) / 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 <= -23000000000000.0) {
tmp = t_1;
} else if (t1 <= 4.2e-28) {
tmp = (-1.0 / u) * ((t1 * v) / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -23000000000000.0: tmp = t_1 elif t1 <= 4.2e-28: tmp = (-1.0 / u) * ((t1 * v) / 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 <= -23000000000000.0) tmp = t_1; elseif (t1 <= 4.2e-28) tmp = Float64(Float64(-1.0 / u) * Float64(Float64(t1 * v) / 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 <= -23000000000000.0) tmp = t_1; elseif (t1 <= 4.2e-28) tmp = (-1.0 / u) * ((t1 * v) / 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, -23000000000000.0], t$95$1, If[LessEqual[t1, 4.2e-28], N[(N[(-1.0 / u), $MachinePrecision] * N[(N[(t1 * v), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -23000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1}{u} \cdot \frac{t1 \cdot v}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t1 < -2.3e13 or 4.2000000000000001e-28 < t1 Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
sqr-neg-revN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around 0
Applied rewrites61.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
remove-double-negN/A
distribute-rgt-neg-outN/A
lower-neg.f64N/A
metadata-evalN/A
*-rgt-identity61.9%
Applied rewrites61.9%
if -2.3e13 < t1 < 4.2000000000000001e-28Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
sqr-neg-revN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around 0
Applied rewrites61.7%
Taylor expanded in u around inf
lower-/.f6416.9%
Applied rewrites16.9%
Taylor expanded in u around inf
lower-/.f64N/A
lower-*.f6449.6%
Applied rewrites49.6%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ u t1)))
double code(double u, double v, double t1) {
return -v / (u + t1);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / (u + t1)
end function
public static double code(double u, double v, double t1) {
return -v / (u + t1);
}
def code(u, v, t1): return -v / (u + t1)
function code(u, v, t1) return Float64(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]
\frac{-v}{u + t1}
Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
sqr-neg-revN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around 0
Applied rewrites61.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
remove-double-negN/A
distribute-rgt-neg-outN/A
lower-neg.f64N/A
metadata-evalN/A
*-rgt-identity61.9%
Applied rewrites61.9%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* (/ -1.0 u) v))) (if (<= u -3.6e+145) t_1 (if (<= u 1.6e+116) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (-1.0 / u) * v;
double tmp;
if (u <= -3.6e+145) {
tmp = t_1;
} else if (u <= 1.6e+116) {
tmp = -v / t1;
} 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 = ((-1.0d0) / u) * v
if (u <= (-3.6d+145)) then
tmp = t_1
else if (u <= 1.6d+116) then
tmp = -v / t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-1.0 / u) * v;
double tmp;
if (u <= -3.6e+145) {
tmp = t_1;
} else if (u <= 1.6e+116) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-1.0 / u) * v tmp = 0 if u <= -3.6e+145: tmp = t_1 elif u <= 1.6e+116: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-1.0 / u) * v) tmp = 0.0 if (u <= -3.6e+145) tmp = t_1; elseif (u <= 1.6e+116) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-1.0 / u) * v; tmp = 0.0; if (u <= -3.6e+145) tmp = t_1; elseif (u <= 1.6e+116) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(-1.0 / u), $MachinePrecision] * v), $MachinePrecision]}, If[LessEqual[u, -3.6e+145], t$95$1, If[LessEqual[u, 1.6e+116], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{-1}{u} \cdot v\\
\mathbf{if}\;u \leq -3.6 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 1.6 \cdot 10^{+116}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if u < -3.5999999999999997e145 or 1.6e116 < u Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
sqr-neg-revN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6498.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.1%
Applied rewrites98.1%
Taylor expanded in u around 0
Applied rewrites61.7%
Taylor expanded in u around inf
lower-/.f6416.9%
Applied rewrites16.9%
if -3.5999999999999997e145 < u < 1.6e116Initial program 72.9%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.3%
Applied rewrites54.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6454.3%
Applied rewrites54.3%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / t1;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(Float64(-v) / t1) end
function tmp = code(u, v, t1) tmp = -v / t1; end
code[u_, v_, t1_] := N[((-v) / t1), $MachinePrecision]
\frac{-v}{t1}
Initial program 72.9%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.3%
Applied rewrites54.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6454.3%
Applied rewrites54.3%
herbie shell --seed 2025212
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))