
(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 11 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 (/ (* (/ t1 (- (- t1) u)) v) (+ u t1)))
double code(double u, double v, double t1) {
return ((t1 / (-t1 - u)) * 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 / (-t1 - u)) * v) / (u + t1)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (-t1 - u)) * v) / (u + t1);
}
def code(u, v, t1): return ((t1 / (-t1 - u)) * v) / (u + t1)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(Float64(-t1) - u)) * v) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (-t1 - u)) * v) / (u + t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{u + t1}
Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
(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 73.0%
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.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.0%
Applied rewrites98.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (- (- t1) u))))
(if (<= u -9.2e+73)
(* t_1 (/ t1 u))
(if (<= u -2.26e-119)
(* (/ (- t1) (* (+ u t1) (+ u t1))) v)
(if (<= u 1.55e-139) (/ (- v) t1) (* t1 (/ t_1 (+ u t1))))))))double code(double u, double v, double t1) {
double t_1 = v / (-t1 - u);
double tmp;
if (u <= -9.2e+73) {
tmp = t_1 * (t1 / u);
} else if (u <= -2.26e-119) {
tmp = (-t1 / ((u + t1) * (u + t1))) * v;
} else if (u <= 1.55e-139) {
tmp = -v / t1;
} else {
tmp = t1 * (t_1 / (u + t1));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = v / (-t1 - u)
if (u <= (-9.2d+73)) then
tmp = t_1 * (t1 / u)
else if (u <= (-2.26d-119)) then
tmp = (-t1 / ((u + t1) * (u + t1))) * v
else if (u <= 1.55d-139) then
tmp = -v / t1
else
tmp = t1 * (t_1 / (u + t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v / (-t1 - u);
double tmp;
if (u <= -9.2e+73) {
tmp = t_1 * (t1 / u);
} else if (u <= -2.26e-119) {
tmp = (-t1 / ((u + t1) * (u + t1))) * v;
} else if (u <= 1.55e-139) {
tmp = -v / t1;
} else {
tmp = t1 * (t_1 / (u + t1));
}
return tmp;
}
def code(u, v, t1): t_1 = v / (-t1 - u) tmp = 0 if u <= -9.2e+73: tmp = t_1 * (t1 / u) elif u <= -2.26e-119: tmp = (-t1 / ((u + t1) * (u + t1))) * v elif u <= 1.55e-139: tmp = -v / t1 else: tmp = t1 * (t_1 / (u + t1)) return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(Float64(-t1) - u)) tmp = 0.0 if (u <= -9.2e+73) tmp = Float64(t_1 * Float64(t1 / u)); elseif (u <= -2.26e-119) tmp = Float64(Float64(Float64(-t1) / Float64(Float64(u + t1) * Float64(u + t1))) * v); elseif (u <= 1.55e-139) tmp = Float64(Float64(-v) / t1); else tmp = Float64(t1 * Float64(t_1 / Float64(u + t1))); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / (-t1 - u); tmp = 0.0; if (u <= -9.2e+73) tmp = t_1 * (t1 / u); elseif (u <= -2.26e-119) tmp = (-t1 / ((u + t1) * (u + t1))) * v; elseif (u <= 1.55e-139) tmp = -v / t1; else tmp = t1 * (t_1 / (u + t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -9.2e+73], N[(t$95$1 * N[(t1 / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, -2.26e-119], N[(N[((-t1) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision], If[LessEqual[u, 1.55e-139], N[((-v) / t1), $MachinePrecision], N[(t1 * N[(t$95$1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{v}{\left(-t1\right) - u}\\
\mathbf{if}\;u \leq -9.2 \cdot 10^{+73}:\\
\;\;\;\;t\_1 \cdot \frac{t1}{u}\\
\mathbf{elif}\;u \leq -2.26 \cdot 10^{-119}:\\
\;\;\;\;\frac{-t1}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot v\\
\mathbf{elif}\;u \leq 1.55 \cdot 10^{-139}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{t\_1}{u + t1}\\
\end{array}
if u < -9.1999999999999994e73Initial program 73.0%
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.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.0%
Applied rewrites98.0%
Taylor expanded in u around inf
lower-/.f6454.5%
Applied rewrites54.5%
if -9.1999999999999994e73 < u < -2.26e-119Initial program 73.0%
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-/.f6476.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5%
Applied rewrites76.5%
if -2.26e-119 < u < 1.55e-139Initial program 73.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.8%
Applied rewrites54.8%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity54.8%
Applied rewrites54.8%
if 1.55e-139 < u Initial program 73.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
frac-2negN/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6483.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6483.5%
Applied rewrites83.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mul-1-negN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lift-+.f64N/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift-/.f64N/A
lower-/.f6483.6%
Applied rewrites83.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (+ u t1) (+ u t1))))
(if (<= u -9.2e+73)
(* (/ v (- (- t1) u)) (/ t1 u))
(if (<= u -2.26e-119)
(* (/ (- t1) t_1) v)
(if (<= u 9.6e-89)
(/ (- v) t1)
(if (<= u 4.4e+153)
(* (/ (- v) t_1) t1)
(/ (* (/ v (- u)) t1) (+ u t1))))))))double code(double u, double v, double t1) {
double t_1 = (u + t1) * (u + t1);
double tmp;
if (u <= -9.2e+73) {
tmp = (v / (-t1 - u)) * (t1 / u);
} else if (u <= -2.26e-119) {
tmp = (-t1 / t_1) * v;
} else if (u <= 9.6e-89) {
tmp = -v / t1;
} else if (u <= 4.4e+153) {
tmp = (-v / t_1) * t1;
} else {
tmp = ((v / -u) * t1) / (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 = (u + t1) * (u + t1)
if (u <= (-9.2d+73)) then
tmp = (v / (-t1 - u)) * (t1 / u)
else if (u <= (-2.26d-119)) then
tmp = (-t1 / t_1) * v
else if (u <= 9.6d-89) then
tmp = -v / t1
else if (u <= 4.4d+153) then
tmp = (-v / t_1) * t1
else
tmp = ((v / -u) * t1) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (u + t1) * (u + t1);
double tmp;
if (u <= -9.2e+73) {
tmp = (v / (-t1 - u)) * (t1 / u);
} else if (u <= -2.26e-119) {
tmp = (-t1 / t_1) * v;
} else if (u <= 9.6e-89) {
tmp = -v / t1;
} else if (u <= 4.4e+153) {
tmp = (-v / t_1) * t1;
} else {
tmp = ((v / -u) * t1) / (u + t1);
}
return tmp;
}
def code(u, v, t1): t_1 = (u + t1) * (u + t1) tmp = 0 if u <= -9.2e+73: tmp = (v / (-t1 - u)) * (t1 / u) elif u <= -2.26e-119: tmp = (-t1 / t_1) * v elif u <= 9.6e-89: tmp = -v / t1 elif u <= 4.4e+153: tmp = (-v / t_1) * t1 else: tmp = ((v / -u) * t1) / (u + t1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(u + t1) * Float64(u + t1)) tmp = 0.0 if (u <= -9.2e+73) tmp = Float64(Float64(v / Float64(Float64(-t1) - u)) * Float64(t1 / u)); elseif (u <= -2.26e-119) tmp = Float64(Float64(Float64(-t1) / t_1) * v); elseif (u <= 9.6e-89) tmp = Float64(Float64(-v) / t1); elseif (u <= 4.4e+153) tmp = Float64(Float64(Float64(-v) / t_1) * t1); else tmp = Float64(Float64(Float64(v / Float64(-u)) * t1) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (u + t1) * (u + t1); tmp = 0.0; if (u <= -9.2e+73) tmp = (v / (-t1 - u)) * (t1 / u); elseif (u <= -2.26e-119) tmp = (-t1 / t_1) * v; elseif (u <= 9.6e-89) tmp = -v / t1; elseif (u <= 4.4e+153) tmp = (-v / t_1) * t1; else tmp = ((v / -u) * t1) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -9.2e+73], N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, -2.26e-119], N[(N[((-t1) / t$95$1), $MachinePrecision] * v), $MachinePrecision], If[LessEqual[u, 9.6e-89], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 4.4e+153], N[(N[((-v) / t$95$1), $MachinePrecision] * t1), $MachinePrecision], N[(N[(N[(v / (-u)), $MachinePrecision] * t1), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \left(u + t1\right) \cdot \left(u + t1\right)\\
\mathbf{if}\;u \leq -9.2 \cdot 10^{+73}:\\
\;\;\;\;\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u}\\
\mathbf{elif}\;u \leq -2.26 \cdot 10^{-119}:\\
\;\;\;\;\frac{-t1}{t\_1} \cdot v\\
\mathbf{elif}\;u \leq 9.6 \cdot 10^{-89}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 4.4 \cdot 10^{+153}:\\
\;\;\;\;\frac{-v}{t\_1} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{v}{-u} \cdot t1}{u + t1}\\
\end{array}
if u < -9.1999999999999994e73Initial program 73.0%
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.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.0%
Applied rewrites98.0%
Taylor expanded in u around inf
lower-/.f6454.5%
Applied rewrites54.5%
if -9.1999999999999994e73 < u < -2.26e-119Initial program 73.0%
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-/.f6476.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5%
Applied rewrites76.5%
if -2.26e-119 < u < 9.6000000000000006e-89Initial program 73.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.8%
Applied rewrites54.8%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity54.8%
Applied rewrites54.8%
if 9.6000000000000006e-89 < u < 4.3999999999999999e153Initial program 73.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-neg-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f6473.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.2%
Applied rewrites73.2%
if 4.3999999999999999e153 < u Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around inf
lower-*.f6451.2%
Applied rewrites51.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.2%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -8.5e+132)
(/ (* -1.0 v) (+ u t1))
(if (<= t1 4.4e+155)
(* (/ (- t1) (* (+ u t1) (+ u t1))) v)
(/ (* (- (/ u t1) 1.0) v) (+ u t1)))))double code(double u, double v, double t1) {
double tmp;
if (t1 <= -8.5e+132) {
tmp = (-1.0 * v) / (u + t1);
} else if (t1 <= 4.4e+155) {
tmp = (-t1 / ((u + t1) * (u + t1))) * v;
} else {
tmp = (((u / t1) - 1.0) * v) / (u + t1);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-8.5d+132)) then
tmp = ((-1.0d0) * v) / (u + t1)
else if (t1 <= 4.4d+155) then
tmp = (-t1 / ((u + t1) * (u + t1))) * v
else
tmp = (((u / t1) - 1.0d0) * v) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -8.5e+132) {
tmp = (-1.0 * v) / (u + t1);
} else if (t1 <= 4.4e+155) {
tmp = (-t1 / ((u + t1) * (u + t1))) * v;
} else {
tmp = (((u / t1) - 1.0) * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -8.5e+132: tmp = (-1.0 * v) / (u + t1) elif t1 <= 4.4e+155: tmp = (-t1 / ((u + t1) * (u + t1))) * v else: tmp = (((u / t1) - 1.0) * v) / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -8.5e+132) tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); elseif (t1 <= 4.4e+155) tmp = Float64(Float64(Float64(-t1) / Float64(Float64(u + t1) * Float64(u + t1))) * v); else tmp = Float64(Float64(Float64(Float64(u / t1) - 1.0) * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -8.5e+132) tmp = (-1.0 * v) / (u + t1); elseif (t1 <= 4.4e+155) tmp = (-t1 / ((u + t1) * (u + t1))) * v; else tmp = (((u / t1) - 1.0) * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -8.5e+132], N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 4.4e+155], N[(N[((-t1) / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision], N[(N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t1 \leq -8.5 \cdot 10^{+132}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\mathbf{elif}\;t1 \leq 4.4 \cdot 10^{+155}:\\
\;\;\;\;\frac{-t1}{\left(u + t1\right) \cdot \left(u + t1\right)} \cdot v\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{u}{t1} - 1\right) \cdot v}{u + t1}\\
\end{array}
if t1 < -8.4999999999999997e132Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around 0
Applied rewrites61.9%
if -8.4999999999999997e132 < t1 < 4.4000000000000005e155Initial program 73.0%
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-/.f6476.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5%
Applied rewrites76.5%
if 4.4000000000000005e155 < t1 Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6453.2%
Applied rewrites53.2%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (- t1) u)) (t_2 (* (/ v t_1) (/ t1 u))))
(if (<= u -9.2e+73)
t_2
(if (<= u 3.65) (/ (* (/ t1 t_1) v) t1) t_2))))double code(double u, double v, double t1) {
double t_1 = -t1 - u;
double t_2 = (v / t_1) * (t1 / u);
double tmp;
if (u <= -9.2e+73) {
tmp = t_2;
} else if (u <= 3.65) {
tmp = ((t1 / t_1) * v) / t1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = -t1 - u
t_2 = (v / t_1) * (t1 / u)
if (u <= (-9.2d+73)) then
tmp = t_2
else if (u <= 3.65d0) then
tmp = ((t1 / t_1) * v) / t1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -t1 - u;
double t_2 = (v / t_1) * (t1 / u);
double tmp;
if (u <= -9.2e+73) {
tmp = t_2;
} else if (u <= 3.65) {
tmp = ((t1 / t_1) * v) / t1;
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = -t1 - u t_2 = (v / t_1) * (t1 / u) tmp = 0 if u <= -9.2e+73: tmp = t_2 elif u <= 3.65: tmp = ((t1 / t_1) * v) / t1 else: tmp = t_2 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-t1) - u) t_2 = Float64(Float64(v / t_1) * Float64(t1 / u)) tmp = 0.0 if (u <= -9.2e+73) tmp = t_2; elseif (u <= 3.65) tmp = Float64(Float64(Float64(t1 / t_1) * v) / t1); else tmp = t_2; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -t1 - u; t_2 = (v / t_1) * (t1 / u); tmp = 0.0; if (u <= -9.2e+73) tmp = t_2; elseif (u <= 3.65) tmp = ((t1 / t_1) * v) / t1; else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-t1) - u), $MachinePrecision]}, Block[{t$95$2 = N[(N[(v / t$95$1), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -9.2e+73], t$95$2, If[LessEqual[u, 3.65], N[(N[(N[(t1 / t$95$1), $MachinePrecision] * v), $MachinePrecision] / t1), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(-t1\right) - u\\
t_2 := \frac{v}{t\_1} \cdot \frac{t1}{u}\\
\mathbf{if}\;u \leq -9.2 \cdot 10^{+73}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;u \leq 3.65:\\
\;\;\;\;\frac{\frac{t1}{t\_1} \cdot v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if u < -9.1999999999999994e73 or 3.6499999999999999 < u Initial program 73.0%
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.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.0%
Applied rewrites98.0%
Taylor expanded in u around inf
lower-/.f6454.5%
Applied rewrites54.5%
if -9.1999999999999994e73 < u < 3.6499999999999999Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around 0
Applied rewrites71.3%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* (/ v (- (- t1) u)) (/ t1 u)))) (if (<= u -8.5e+71) t_1 (if (<= u 3.65) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (v / (-t1 - u)) * (t1 / u);
double tmp;
if (u <= -8.5e+71) {
tmp = t_1;
} else if (u <= 3.65) {
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 = (v / (-t1 - u)) * (t1 / u)
if (u <= (-8.5d+71)) then
tmp = t_1
else if (u <= 3.65d0) 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 = (v / (-t1 - u)) * (t1 / u);
double tmp;
if (u <= -8.5e+71) {
tmp = t_1;
} else if (u <= 3.65) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (v / (-t1 - u)) * (t1 / u) tmp = 0 if u <= -8.5e+71: tmp = t_1 elif u <= 3.65: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(v / Float64(Float64(-t1) - u)) * Float64(t1 / u)) tmp = 0.0 if (u <= -8.5e+71) tmp = t_1; elseif (u <= 3.65) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (v / (-t1 - u)) * (t1 / u); tmp = 0.0; if (u <= -8.5e+71) tmp = t_1; elseif (u <= 3.65) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -8.5e+71], t$95$1, If[LessEqual[u, 3.65], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u}\\
\mathbf{if}\;u \leq -8.5 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 3.65:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if u < -8.4999999999999996e71 or 3.6499999999999999 < u Initial program 73.0%
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.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.0%
Applied rewrites98.0%
Taylor expanded in u around inf
lower-/.f6454.5%
Applied rewrites54.5%
if -8.4999999999999996e71 < u < 3.6499999999999999Initial program 73.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.8%
Applied rewrites54.8%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity54.8%
Applied rewrites54.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* -1.0 v) (+ u t1))))
(if (<= t1 -1.05e-6)
t_1
(if (<= t1 5.9e-71) (* (/ t1 (* (- u) (+ u t1))) v) t_1))))double code(double u, double v, double t1) {
double t_1 = (-1.0 * v) / (u + t1);
double tmp;
if (t1 <= -1.05e-6) {
tmp = t_1;
} else if (t1 <= 5.9e-71) {
tmp = (t1 / (-u * (u + t1))) * v;
} 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) * v) / (u + t1)
if (t1 <= (-1.05d-6)) then
tmp = t_1
else if (t1 <= 5.9d-71) then
tmp = (t1 / (-u * (u + t1))) * v
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 * v) / (u + t1);
double tmp;
if (t1 <= -1.05e-6) {
tmp = t_1;
} else if (t1 <= 5.9e-71) {
tmp = (t1 / (-u * (u + t1))) * v;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-1.0 * v) / (u + t1) tmp = 0 if t1 <= -1.05e-6: tmp = t_1 elif t1 <= 5.9e-71: tmp = (t1 / (-u * (u + t1))) * v else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-1.0 * v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -1.05e-6) tmp = t_1; elseif (t1 <= 5.9e-71) tmp = Float64(Float64(t1 / Float64(Float64(-u) * Float64(u + t1))) * v); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-1.0 * v) / (u + t1); tmp = 0.0; if (t1 <= -1.05e-6) tmp = t_1; elseif (t1 <= 5.9e-71) tmp = (t1 / (-u * (u + t1))) * v; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.05e-6], t$95$1, If[LessEqual[t1, 5.9e-71], N[(N[(t1 / N[((-u) * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{-1 \cdot v}{u + t1}\\
\mathbf{if}\;t1 \leq -1.05 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.9 \cdot 10^{-71}:\\
\;\;\;\;\frac{t1}{\left(-u\right) \cdot \left(u + t1\right)} \cdot v\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t1 < -1.0499999999999999e-6 or 5.9e-71 < t1 Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around 0
Applied rewrites61.9%
if -1.0499999999999999e-6 < t1 < 5.9e-71Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around inf
lower-*.f6451.2%
Applied rewrites51.2%
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-lft-neg-inN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.0%
(FPCore (u v t1) :precision binary64 (/ (* -1.0 v) (+ u t1)))
double code(double u, double v, double t1) {
return (-1.0 * v) / (u + t1);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = ((-1.0d0) * v) / (u + t1)
end function
public static double code(double u, double v, double t1) {
return (-1.0 * v) / (u + t1);
}
def code(u, v, t1): return (-1.0 * v) / (u + t1)
function code(u, v, t1) return Float64(Float64(-1.0 * v) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = (-1.0 * v) / (u + t1); end
code[u_, v_, t1_] := N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\frac{-1 \cdot v}{u + t1}
Initial program 73.0%
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--.f6497.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9%
Applied rewrites97.9%
Taylor expanded in u around 0
Applied rewrites61.9%
(FPCore (u v t1) :precision binary64 (* (/ -1.0 (+ u t1)) v))
double code(double u, double v, double t1) {
return (-1.0 / (u + t1)) * v;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = ((-1.0d0) / (u + t1)) * v
end function
public static double code(double u, double v, double t1) {
return (-1.0 / (u + t1)) * v;
}
def code(u, v, t1): return (-1.0 / (u + t1)) * v
function code(u, v, t1) return Float64(Float64(-1.0 / Float64(u + t1)) * v) end
function tmp = code(u, v, t1) tmp = (-1.0 / (u + t1)) * v; end
code[u_, v_, t1_] := N[(N[(-1.0 / N[(u + t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision]
\frac{-1}{u + t1} \cdot v
Initial program 73.0%
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-/.f6497.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8%
Applied rewrites97.8%
Taylor expanded in u around 0
Applied rewrites61.7%
(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 73.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.8%
Applied rewrites54.8%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity54.8%
Applied rewrites54.8%
herbie shell --seed 2025206
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))