
(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 9 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(Float64(v / Float64(Float64(-t1) - u)) * t1) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = ((v / (-t1 - u)) * t1) / (u + t1); end
code[u_, v_, t1_] := N[(N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\frac{\frac{v}{\left(-t1\right) - u} \cdot t1}{u + t1}
Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/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 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ t1 (* (- (- t1) u) (+ u t1))) v)))
(if (<= t1 -8.8e+119)
(* (/ (- (* 2.0 (/ u t1)) 1.0) t1) v)
(if (<= t1 -3.4e-209)
t_1
(if (<= t1 6.3e-195)
(/ (* (/ v (- u)) t1) (+ u t1))
(if (<= t1 1.3e+154) t_1 (/ (* -1.0 v) (+ u t1))))))))double code(double u, double v, double t1) {
double t_1 = (t1 / ((-t1 - u) * (u + t1))) * v;
double tmp;
if (t1 <= -8.8e+119) {
tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v;
} else if (t1 <= -3.4e-209) {
tmp = t_1;
} else if (t1 <= 6.3e-195) {
tmp = ((v / -u) * t1) / (u + t1);
} else if (t1 <= 1.3e+154) {
tmp = t_1;
} else {
tmp = (-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) :: t_1
real(8) :: tmp
t_1 = (t1 / ((-t1 - u) * (u + t1))) * v
if (t1 <= (-8.8d+119)) then
tmp = (((2.0d0 * (u / t1)) - 1.0d0) / t1) * v
else if (t1 <= (-3.4d-209)) then
tmp = t_1
else if (t1 <= 6.3d-195) then
tmp = ((v / -u) * t1) / (u + t1)
else if (t1 <= 1.3d+154) then
tmp = t_1
else
tmp = ((-1.0d0) * v) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (t1 / ((-t1 - u) * (u + t1))) * v;
double tmp;
if (t1 <= -8.8e+119) {
tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v;
} else if (t1 <= -3.4e-209) {
tmp = t_1;
} else if (t1 <= 6.3e-195) {
tmp = ((v / -u) * t1) / (u + t1);
} else if (t1 <= 1.3e+154) {
tmp = t_1;
} else {
tmp = (-1.0 * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): t_1 = (t1 / ((-t1 - u) * (u + t1))) * v tmp = 0 if t1 <= -8.8e+119: tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v elif t1 <= -3.4e-209: tmp = t_1 elif t1 <= 6.3e-195: tmp = ((v / -u) * t1) / (u + t1) elif t1 <= 1.3e+154: tmp = t_1 else: tmp = (-1.0 * v) / (u + t1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(t1 / Float64(Float64(Float64(-t1) - u) * Float64(u + t1))) * v) tmp = 0.0 if (t1 <= -8.8e+119) tmp = Float64(Float64(Float64(Float64(2.0 * Float64(u / t1)) - 1.0) / t1) * v); elseif (t1 <= -3.4e-209) tmp = t_1; elseif (t1 <= 6.3e-195) tmp = Float64(Float64(Float64(v / Float64(-u)) * t1) / Float64(u + t1)); elseif (t1 <= 1.3e+154) tmp = t_1; else tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (t1 / ((-t1 - u) * (u + t1))) * v; tmp = 0.0; if (t1 <= -8.8e+119) tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v; elseif (t1 <= -3.4e-209) tmp = t_1; elseif (t1 <= 6.3e-195) tmp = ((v / -u) * t1) / (u + t1); elseif (t1 <= 1.3e+154) tmp = t_1; else tmp = (-1.0 * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(t1 / N[(N[((-t1) - u), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision]}, If[LessEqual[t1, -8.8e+119], N[(N[(N[(N[(2.0 * N[(u / t1), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / t1), $MachinePrecision] * v), $MachinePrecision], If[LessEqual[t1, -3.4e-209], t$95$1, If[LessEqual[t1, 6.3e-195], N[(N[(N[(v / (-u)), $MachinePrecision] * t1), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.3e+154], t$95$1, N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \frac{t1}{\left(\left(-t1\right) - u\right) \cdot \left(u + t1\right)} \cdot v\\
\mathbf{if}\;t1 \leq -8.8 \cdot 10^{+119}:\\
\;\;\;\;\frac{2 \cdot \frac{u}{t1} - 1}{t1} \cdot v\\
\mathbf{elif}\;t1 \leq -3.4 \cdot 10^{-209}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 6.3 \cdot 10^{-195}:\\
\;\;\;\;\frac{\frac{v}{-u} \cdot t1}{u + t1}\\
\mathbf{elif}\;t1 \leq 1.3 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\end{array}
if t1 < -8.8000000000000005e119Initial program 71.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.8%
Taylor expanded in t1 around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if -8.8000000000000005e119 < t1 < -3.39999999999999988e-209 or 6.3e-195 < t1 < 1.29999999999999994e154Initial program 71.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.8%
if -3.39999999999999988e-209 < t1 < 6.3e-195Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Taylor expanded in u around inf
lower-*.f6451.8
Applied rewrites51.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-+.f64N/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites48.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.7
Applied rewrites51.7%
if 1.29999999999999994e154 < t1 Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
Taylor expanded in u around 0
lower-*.f6461.2
Applied rewrites61.2%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -2.9e+117)
(* (/ (- (* 2.0 (/ u t1)) 1.0) t1) v)
(if (<= t1 8e+149)
(* (/ v (* (- (- t1) u) (+ u t1))) t1)
(/ (* -1.0 v) (+ u t1)))))double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.9e+117) {
tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v;
} else if (t1 <= 8e+149) {
tmp = (v / ((-t1 - u) * (u + t1))) * t1;
} else {
tmp = (-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 <= (-2.9d+117)) then
tmp = (((2.0d0 * (u / t1)) - 1.0d0) / t1) * v
else if (t1 <= 8d+149) then
tmp = (v / ((-t1 - u) * (u + t1))) * t1
else
tmp = ((-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 <= -2.9e+117) {
tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v;
} else if (t1 <= 8e+149) {
tmp = (v / ((-t1 - u) * (u + t1))) * t1;
} else {
tmp = (-1.0 * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -2.9e+117: tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v elif t1 <= 8e+149: tmp = (v / ((-t1 - u) * (u + t1))) * t1 else: tmp = (-1.0 * v) / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -2.9e+117) tmp = Float64(Float64(Float64(Float64(2.0 * Float64(u / t1)) - 1.0) / t1) * v); elseif (t1 <= 8e+149) tmp = Float64(Float64(v / Float64(Float64(Float64(-t1) - u) * Float64(u + t1))) * t1); else tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -2.9e+117) tmp = (((2.0 * (u / t1)) - 1.0) / t1) * v; elseif (t1 <= 8e+149) tmp = (v / ((-t1 - u) * (u + t1))) * t1; else tmp = (-1.0 * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -2.9e+117], N[(N[(N[(N[(2.0 * N[(u / t1), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / t1), $MachinePrecision] * v), $MachinePrecision], If[LessEqual[t1, 8e+149], N[(N[(v / N[(N[((-t1) - u), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.9 \cdot 10^{+117}:\\
\;\;\;\;\frac{2 \cdot \frac{u}{t1} - 1}{t1} \cdot v\\
\mathbf{elif}\;t1 \leq 8 \cdot 10^{+149}:\\
\;\;\;\;\frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(u + t1\right)} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\end{array}
if t1 < -2.90000000000000027e117Initial program 71.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.8%
Taylor expanded in t1 around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if -2.90000000000000027e117 < t1 < 8.00000000000000039e149Initial program 71.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
Applied rewrites72.1%
if 8.00000000000000039e149 < t1 Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
Taylor expanded in u around 0
lower-*.f6461.2
Applied rewrites61.2%
(FPCore (u v t1) :precision binary64 (if (<= u -6.3e-21) (/ (* (/ v (- u)) t1) (+ u t1)) (if (<= u 4.4e-15) (/ (- v) t1) (* (/ v (- (- t1) u)) (/ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -6.3e-21) {
tmp = ((v / -u) * t1) / (u + t1);
} else if (u <= 4.4e-15) {
tmp = -v / t1;
} else {
tmp = (v / (-t1 - u)) * (t1 / u);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= (-6.3d-21)) then
tmp = ((v / -u) * t1) / (u + t1)
else if (u <= 4.4d-15) then
tmp = -v / t1
else
tmp = (v / (-t1 - u)) * (t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -6.3e-21) {
tmp = ((v / -u) * t1) / (u + t1);
} else if (u <= 4.4e-15) {
tmp = -v / t1;
} else {
tmp = (v / (-t1 - u)) * (t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -6.3e-21: tmp = ((v / -u) * t1) / (u + t1) elif u <= 4.4e-15: tmp = -v / t1 else: tmp = (v / (-t1 - u)) * (t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -6.3e-21) tmp = Float64(Float64(Float64(v / Float64(-u)) * t1) / Float64(u + t1)); elseif (u <= 4.4e-15) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(v / Float64(Float64(-t1) - u)) * Float64(t1 / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -6.3e-21) tmp = ((v / -u) * t1) / (u + t1); elseif (u <= 4.4e-15) tmp = -v / t1; else tmp = (v / (-t1 - u)) * (t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -6.3e-21], N[(N[(N[(v / (-u)), $MachinePrecision] * t1), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 4.4e-15], N[((-v) / t1), $MachinePrecision], N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;u \leq -6.3 \cdot 10^{-21}:\\
\;\;\;\;\frac{\frac{v}{-u} \cdot t1}{u + t1}\\
\mathbf{elif}\;u \leq 4.4 \cdot 10^{-15}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u}\\
\end{array}
if u < -6.3e-21Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Taylor expanded in u around inf
lower-*.f6451.8
Applied rewrites51.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-+.f64N/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites48.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.7
Applied rewrites51.7%
if -6.3e-21 < u < 4.39999999999999971e-15Initial program 71.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.1
Applied rewrites54.1%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6454.1
Applied rewrites54.1%
if 4.39999999999999971e-15 < u Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Taylor expanded in u around inf
lower-/.f6455.1
Applied rewrites55.1%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* (/ v (- (- t1) u)) (/ t1 u)))) (if (<= u -3.4e-22) t_1 (if (<= u 4.4e-15) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (v / (-t1 - u)) * (t1 / u);
double tmp;
if (u <= -3.4e-22) {
tmp = t_1;
} else if (u <= 4.4e-15) {
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 <= (-3.4d-22)) then
tmp = t_1
else if (u <= 4.4d-15) 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 <= -3.4e-22) {
tmp = t_1;
} else if (u <= 4.4e-15) {
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 <= -3.4e-22: tmp = t_1 elif u <= 4.4e-15: 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 <= -3.4e-22) tmp = t_1; elseif (u <= 4.4e-15) 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 <= -3.4e-22) tmp = t_1; elseif (u <= 4.4e-15) 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, -3.4e-22], t$95$1, If[LessEqual[u, 4.4e-15], 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 -3.4 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 4.4 \cdot 10^{-15}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if u < -3.3999999999999998e-22 or 4.39999999999999971e-15 < u Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Taylor expanded in u around inf
lower-/.f6455.1
Applied rewrites55.1%
if -3.3999999999999998e-22 < u < 4.39999999999999971e-15Initial program 71.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.1
Applied rewrites54.1%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6454.1
Applied rewrites54.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* -1.0 v) (+ u t1))))
(if (<= t1 -9e-29)
t_1
(if (<= t1 4.1e-88) (* (* -1.0 (/ v u)) (/ t1 u)) t_1))))double code(double u, double v, double t1) {
double t_1 = (-1.0 * v) / (u + t1);
double tmp;
if (t1 <= -9e-29) {
tmp = t_1;
} else if (t1 <= 4.1e-88) {
tmp = (-1.0 * (v / 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 = ((-1.0d0) * v) / (u + t1)
if (t1 <= (-9d-29)) then
tmp = t_1
else if (t1 <= 4.1d-88) then
tmp = ((-1.0d0) * (v / 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 = (-1.0 * v) / (u + t1);
double tmp;
if (t1 <= -9e-29) {
tmp = t_1;
} else if (t1 <= 4.1e-88) {
tmp = (-1.0 * (v / u)) * (t1 / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-1.0 * v) / (u + t1) tmp = 0 if t1 <= -9e-29: tmp = t_1 elif t1 <= 4.1e-88: tmp = (-1.0 * (v / u)) * (t1 / u) 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 <= -9e-29) tmp = t_1; elseif (t1 <= 4.1e-88) tmp = Float64(Float64(-1.0 * Float64(v / u)) * Float64(t1 / u)); 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 <= -9e-29) tmp = t_1; elseif (t1 <= 4.1e-88) tmp = (-1.0 * (v / u)) * (t1 / u); 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, -9e-29], t$95$1, If[LessEqual[t1, 4.1e-88], N[(N[(-1.0 * N[(v / u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{-1 \cdot v}{u + t1}\\
\mathbf{if}\;t1 \leq -9 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.1 \cdot 10^{-88}:\\
\;\;\;\;\left(-1 \cdot \frac{v}{u}\right) \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t1 < -8.9999999999999996e-29 or 4.1000000000000001e-88 < t1 Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
Taylor expanded in u around 0
lower-*.f6461.2
Applied rewrites61.2%
if -8.9999999999999996e-29 < t1 < 4.1000000000000001e-88Initial program 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Taylor expanded in u around inf
lower-/.f6455.1
Applied rewrites55.1%
Taylor expanded in u around inf
lower-*.f64N/A
lower-/.f6452.7
Applied rewrites52.7%
(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 71.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-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
Taylor expanded in u around 0
lower-*.f6461.2
Applied rewrites61.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]
\frac{-v}{t1}
Initial program 71.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6454.1
Applied rewrites54.1%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6454.1
Applied rewrites54.1%
herbie shell --seed 2025167
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))