
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (+ 0.375 (* -0.25 v)) (* (* w r) (* w r))) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.375d0 + ((-0.25d0) * v)) * ((w * r) * (w * r))) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.375 + Float64(-0.25 * v)) * Float64(Float64(w * r) * Float64(w * r))) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.375 + N[(-0.25 * v), $MachinePrecision]), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.375 + -0.25 \cdot v\right) \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)}{1 - v}\right) - 4.5
\end{array}
Initial program 85.5%
Applied rewrites95.0%
Taylor expanded in v around 0
Applied rewrites95.0%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* (* 0.125 w) r) (* (* w r) 3.0))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * ((w * r) * 3.0))) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * w) * r) * ((w * r) * 3.0d0))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * ((w * r) * 3.0))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * ((w * r) * 3.0))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * w) * r) * Float64(Float64(w * r) * 3.0))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * ((w * r) * 3.0))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * w), $MachinePrecision] * r), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot w\right) \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot 3\right)\right) - 4.5
\end{array}
Initial program 85.5%
Applied rewrites87.5%
Applied rewrites93.5%
(FPCore (v w r)
:precision binary64
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-1.5)
(- (- 3.0 (/ (* (+ 0.375 (* -0.25 v)) (* (* w r) (* w r))) (- 1.0 v))) 4.5)
(- (* 2.0 (/ 1.0 (pow r 2.0))) 1.5)))
double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (3.0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
} else {
tmp = (2.0 * (1.0 / pow(r, 2.0))) - 1.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if ((((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-1.5d0)) then
tmp = (3.0d0 - (((0.375d0 + ((-0.25d0) * v)) * ((w * r) * (w * r))) / (1.0d0 - v))) - 4.5d0
else
tmp = (2.0d0 * (1.0d0 / (r ** 2.0d0))) - 1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (3.0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
} else {
tmp = (2.0 * (1.0 / Math.pow(r, 2.0))) - 1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.5: tmp = (3.0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5 else: tmp = (2.0 * (1.0 / math.pow(r, 2.0))) - 1.5 return tmp
function code(v, w, r) tmp = 0.0 if (Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -1.5) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(0.375 + Float64(-0.25 * v)) * Float64(Float64(w * r) * Float64(w * r))) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(2.0 * Float64(1.0 / (r ^ 2.0))) - 1.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.5) tmp = (3.0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5; else tmp = (2.0 * (1.0 / (r ^ 2.0))) - 1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.5], N[(N[(3.0 - N[(N[(N[(0.375 + N[(-0.25 * v), $MachinePrecision]), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 * N[(1.0 / N[Power[r, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1.5:\\
\;\;\;\;\left(3 - \frac{\left(0.375 + -0.25 \cdot v\right) \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{1}{{r}^{2}} - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -1.5Initial program 85.5%
Applied rewrites95.0%
Taylor expanded in v around 0
Applied rewrites95.0%
Taylor expanded in r around inf
Applied rewrites51.1%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Taylor expanded in w around 0
Applied rewrites58.4%
(FPCore (v w r) :precision binary64 (if (<= r 1.42e-18) (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* (* 0.125 w) r) (* w r))) 4.5) (- (- 3.0 (/ (* 0.375 (* (* (* w w) r) r)) 1.0)) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.42e-18) {
tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * (w * r))) - 4.5;
} else {
tmp = (3.0 - ((0.375 * (((w * w) * r) * r)) / 1.0)) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.42d-18) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * w) * r) * (w * r))) - 4.5d0
else
tmp = (3.0d0 - ((0.375d0 * (((w * w) * r) * r)) / 1.0d0)) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.42e-18) {
tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * (w * r))) - 4.5;
} else {
tmp = (3.0 - ((0.375 * (((w * w) * r) * r)) / 1.0)) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.42e-18: tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * (w * r))) - 4.5 else: tmp = (3.0 - ((0.375 * (((w * w) * r) * r)) / 1.0)) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.42e-18) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * w) * r) * Float64(w * r))) - 4.5); else tmp = Float64(Float64(3.0 - Float64(Float64(0.375 * Float64(Float64(Float64(w * w) * r) * r)) / 1.0)) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.42e-18) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * w) * r) * (w * r))) - 4.5; else tmp = (3.0 - ((0.375 * (((w * w) * r) * r)) / 1.0)) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.42e-18], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * w), $MachinePrecision] * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 - N[(N[(0.375 * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.42 \cdot 10^{-18}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot w\right) \cdot r\right) \cdot \left(w \cdot r\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \frac{0.375 \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1}\right) - 4.5\\
\end{array}
\end{array}
if r < 1.41999999999999996e-18Initial program 85.5%
Applied rewrites87.5%
Applied rewrites87.5%
if 1.41999999999999996e-18 < r Initial program 85.5%
Taylor expanded in v around 0
Applied rewrites78.5%
Taylor expanded in v around 0
Applied rewrites84.0%
Taylor expanded in r around inf
Applied rewrites46.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* w w) r) r)))
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) t_0) (- 1.0 v)))
4.5)
-1.5)
(- (- 3.0 (/ (* 0.375 t_0) 1.0)) 4.5)
(- (* 2.0 (/ 1.0 (pow r 2.0))) 1.5))))
double code(double v, double w, double r) {
double t_0 = ((w * w) * r) * r;
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5;
} else {
tmp = (2.0 * (1.0 / pow(r, 2.0))) - 1.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = ((w * w) * r) * r
if ((((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * t_0) / (1.0d0 - v))) - 4.5d0) <= (-1.5d0)) then
tmp = (3.0d0 - ((0.375d0 * t_0) / 1.0d0)) - 4.5d0
else
tmp = (2.0d0 * (1.0d0 / (r ** 2.0d0))) - 1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = ((w * w) * r) * r;
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5;
} else {
tmp = (2.0 * (1.0 / Math.pow(r, 2.0))) - 1.5;
}
return tmp;
}
def code(v, w, r): t_0 = ((w * w) * r) * r tmp = 0 if (((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5: tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5 else: tmp = (2.0 * (1.0 / math.pow(r, 2.0))) - 1.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(w * w) * r) * r) tmp = 0.0 if (Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * t_0) / Float64(1.0 - v))) - 4.5) <= -1.5) tmp = Float64(Float64(3.0 - Float64(Float64(0.375 * t_0) / 1.0)) - 4.5); else tmp = Float64(Float64(2.0 * Float64(1.0 / (r ^ 2.0))) - 1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((w * w) * r) * r; tmp = 0.0; if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5) tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5; else tmp = (2.0 * (1.0 / (r ^ 2.0))) - 1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.5], N[(N[(3.0 - N[(N[(0.375 * t$95$0), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 * N[(1.0 / N[Power[r, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(w \cdot w\right) \cdot r\right) \cdot r\\
\mathbf{if}\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot t\_0}{1 - v}\right) - 4.5 \leq -1.5:\\
\;\;\;\;\left(3 - \frac{0.375 \cdot t\_0}{1}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{1}{{r}^{2}} - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -1.5Initial program 85.5%
Taylor expanded in v around 0
Applied rewrites78.5%
Taylor expanded in v around 0
Applied rewrites84.0%
Taylor expanded in r around inf
Applied rewrites46.6%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Taylor expanded in w around 0
Applied rewrites58.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* w w) r) r)) (t_1 (+ 3.0 (/ 2.0 (* r r)))))
(if (<=
(- (- t_1 (/ (* (* 0.125 (- 3.0 (* 2.0 v))) t_0) (- 1.0 v))) 4.5)
-1.5)
(- (- 3.0 (/ (* 0.375 t_0) 1.0)) 4.5)
(- (- t_1 (* (* w 0.125) r)) 4.5))))
double code(double v, double w, double r) {
double t_0 = ((w * w) * r) * r;
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_1 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5;
} else {
tmp = (t_1 - ((w * 0.125) * r)) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((w * w) * r) * r
t_1 = 3.0d0 + (2.0d0 / (r * r))
if (((t_1 - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * t_0) / (1.0d0 - v))) - 4.5d0) <= (-1.5d0)) then
tmp = (3.0d0 - ((0.375d0 * t_0) / 1.0d0)) - 4.5d0
else
tmp = (t_1 - ((w * 0.125d0) * r)) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = ((w * w) * r) * r;
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_1 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5;
} else {
tmp = (t_1 - ((w * 0.125) * r)) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = ((w * w) * r) * r t_1 = 3.0 + (2.0 / (r * r)) tmp = 0 if ((t_1 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5: tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5 else: tmp = (t_1 - ((w * 0.125) * r)) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(w * w) * r) * r) t_1 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (Float64(Float64(t_1 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * t_0) / Float64(1.0 - v))) - 4.5) <= -1.5) tmp = Float64(Float64(3.0 - Float64(Float64(0.375 * t_0) / 1.0)) - 4.5); else tmp = Float64(Float64(t_1 - Float64(Float64(w * 0.125) * r)) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((w * w) * r) * r; t_1 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (((t_1 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5) tmp = (3.0 - ((0.375 * t_0) / 1.0)) - 4.5; else tmp = (t_1 - ((w * 0.125) * r)) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.5], N[(N[(3.0 - N[(N[(0.375 * t$95$0), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(w \cdot w\right) \cdot r\right) \cdot r\\
t_1 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(t\_1 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot t\_0}{1 - v}\right) - 4.5 \leq -1.5:\\
\;\;\;\;\left(3 - \frac{0.375 \cdot t\_0}{1}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \left(w \cdot 0.125\right) \cdot r\right) - 4.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -1.5Initial program 85.5%
Taylor expanded in v around 0
Applied rewrites78.5%
Taylor expanded in v around 0
Applied rewrites84.0%
Taylor expanded in r around inf
Applied rewrites46.6%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<=
(-
(-
t_0
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-1e+55)
(* (* r -0.125) (* w r))
(- (- t_0 (* (* w 0.125) r)) 4.5))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+55) {
tmp = (r * -0.125) * (w * r);
} else {
tmp = (t_0 - ((w * 0.125) * r)) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 3.0d0 + (2.0d0 / (r * r))
if (((t_0 - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-1d+55)) then
tmp = (r * (-0.125d0)) * (w * r)
else
tmp = (t_0 - ((w * 0.125d0) * r)) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+55) {
tmp = (r * -0.125) * (w * r);
} else {
tmp = (t_0 - ((w * 0.125) * r)) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if ((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+55: tmp = (r * -0.125) * (w * r) else: tmp = (t_0 - ((w * 0.125) * r)) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (Float64(Float64(t_0 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -1e+55) tmp = Float64(Float64(r * -0.125) * Float64(w * r)); else tmp = Float64(Float64(t_0 - Float64(Float64(w * 0.125) * r)) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+55) tmp = (r * -0.125) * (w * r); else tmp = (t_0 - ((w * 0.125) * r)) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1e+55], N[(N[(r * -0.125), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(t\_0 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1 \cdot 10^{+55}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot r\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(w \cdot 0.125\right) \cdot r\right) - 4.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -1.00000000000000001e55Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites13.3%
if -1.00000000000000001e55 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)))
(if (<= t_0 -1e+165)
(* (* r -0.125) (* w r))
(if (<= t_0 -1.0)
(- (- 3.0 (* (* w 0.125) r)) 4.5)
(/ 2.0 (pow r 2.0))))))
double code(double v, double w, double r) {
double t_0 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_0 <= -1e+165) {
tmp = (r * -0.125) * (w * r);
} else if (t_0 <= -1.0) {
tmp = (3.0 - ((w * 0.125) * r)) - 4.5;
} else {
tmp = 2.0 / pow(r, 2.0);
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
if (t_0 <= (-1d+165)) then
tmp = (r * (-0.125d0)) * (w * r)
else if (t_0 <= (-1.0d0)) then
tmp = (3.0d0 - ((w * 0.125d0) * r)) - 4.5d0
else
tmp = 2.0d0 / (r ** 2.0d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_0 <= -1e+165) {
tmp = (r * -0.125) * (w * r);
} else if (t_0 <= -1.0) {
tmp = (3.0 - ((w * 0.125) * r)) - 4.5;
} else {
tmp = 2.0 / Math.pow(r, 2.0);
}
return tmp;
}
def code(v, w, r): t_0 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5 tmp = 0 if t_0 <= -1e+165: tmp = (r * -0.125) * (w * r) elif t_0 <= -1.0: tmp = (3.0 - ((w * 0.125) * r)) - 4.5 else: tmp = 2.0 / math.pow(r, 2.0) return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) tmp = 0.0 if (t_0 <= -1e+165) tmp = Float64(Float64(r * -0.125) * Float64(w * r)); elseif (t_0 <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(w * 0.125) * r)) - 4.5); else tmp = Float64(2.0 / (r ^ 2.0)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_0 <= -1e+165) tmp = (r * -0.125) * (w * r); elseif (t_0 <= -1.0) tmp = (3.0 - ((w * 0.125) * r)) - 4.5; else tmp = 2.0 / (r ^ 2.0); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+165], N[(N[(r * -0.125), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1.0], N[(N[(3.0 - N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(2.0 / N[Power[r, 2.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+165}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot r\right)\\
\mathbf{elif}\;t\_0 \leq -1:\\
\;\;\;\;\left(3 - \left(w \cdot 0.125\right) \cdot r\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{{r}^{2}}\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -9.99999999999999899e164Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites13.3%
if -9.99999999999999899e164 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -1Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Taylor expanded in r around inf
Applied rewrites19.6%
if -1 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Taylor expanded in r around 0
Applied rewrites45.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* w w) r))
(t_1
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* t_0 r)) (- 1.0 v)))
4.5)))
(if (<= t_1 -1e+165)
(* (* r -0.125) (* w r))
(if (<= t_1 5e+94)
(- (- 3.0 (* (* w 0.125) r)) 4.5)
(- (* (* r 0.125) t_0) 4.5)))))
double code(double v, double w, double r) {
double t_0 = (w * w) * r;
double t_1 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -1e+165) {
tmp = (r * -0.125) * (w * r);
} else if (t_1 <= 5e+94) {
tmp = (3.0 - ((w * 0.125) * r)) - 4.5;
} else {
tmp = ((r * 0.125) * t_0) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (w * w) * r
t_1 = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (t_0 * r)) / (1.0d0 - v))) - 4.5d0
if (t_1 <= (-1d+165)) then
tmp = (r * (-0.125d0)) * (w * r)
else if (t_1 <= 5d+94) then
tmp = (3.0d0 - ((w * 0.125d0) * r)) - 4.5d0
else
tmp = ((r * 0.125d0) * t_0) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (w * w) * r;
double t_1 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -1e+165) {
tmp = (r * -0.125) * (w * r);
} else if (t_1 <= 5e+94) {
tmp = (3.0 - ((w * 0.125) * r)) - 4.5;
} else {
tmp = ((r * 0.125) * t_0) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (w * w) * r t_1 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) - 4.5 tmp = 0 if t_1 <= -1e+165: tmp = (r * -0.125) * (w * r) elif t_1 <= 5e+94: tmp = (3.0 - ((w * 0.125) * r)) - 4.5 else: tmp = ((r * 0.125) * t_0) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(w * w) * r) t_1 = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(t_0 * r)) / Float64(1.0 - v))) - 4.5) tmp = 0.0 if (t_1 <= -1e+165) tmp = Float64(Float64(r * -0.125) * Float64(w * r)); elseif (t_1 <= 5e+94) tmp = Float64(Float64(3.0 - Float64(Float64(w * 0.125) * r)) - 4.5); else tmp = Float64(Float64(Float64(r * 0.125) * t_0) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (w * w) * r; t_1 = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_1 <= -1e+165) tmp = (r * -0.125) * (w * r); elseif (t_1 <= 5e+94) tmp = (3.0 - ((w * 0.125) * r)) - 4.5; else tmp = ((r * 0.125) * t_0) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+165], N[(N[(r * -0.125), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+94], N[(N[(3.0 - N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(r * 0.125), $MachinePrecision] * t$95$0), $MachinePrecision] - 4.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(w \cdot w\right) \cdot r\\
t_1 := \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+165}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot r\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;\left(3 - \left(w \cdot 0.125\right) \cdot r\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(r \cdot 0.125\right) \cdot t\_0 - 4.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -9.99999999999999899e164Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites13.3%
if -9.99999999999999899e164 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < 5.0000000000000001e94Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Taylor expanded in r around inf
Applied rewrites19.6%
if 5.0000000000000001e94 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Applied rewrites13.3%
Applied rewrites8.9%
(FPCore (v w r) :precision binary64 (if (<= w 2.15e-60) (- (- 3.0 (* (* w 0.125) r)) 4.5) (if (<= w 2.6e+123) (* (* r -0.125) (* w r)) (* (* r -0.125) (* w w)))))
double code(double v, double w, double r) {
double tmp;
if (w <= 2.15e-60) {
tmp = (3.0 - ((w * 0.125) * r)) - 4.5;
} else if (w <= 2.6e+123) {
tmp = (r * -0.125) * (w * r);
} else {
tmp = (r * -0.125) * (w * w);
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (w <= 2.15d-60) then
tmp = (3.0d0 - ((w * 0.125d0) * r)) - 4.5d0
else if (w <= 2.6d+123) then
tmp = (r * (-0.125d0)) * (w * r)
else
tmp = (r * (-0.125d0)) * (w * w)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (w <= 2.15e-60) {
tmp = (3.0 - ((w * 0.125) * r)) - 4.5;
} else if (w <= 2.6e+123) {
tmp = (r * -0.125) * (w * r);
} else {
tmp = (r * -0.125) * (w * w);
}
return tmp;
}
def code(v, w, r): tmp = 0 if w <= 2.15e-60: tmp = (3.0 - ((w * 0.125) * r)) - 4.5 elif w <= 2.6e+123: tmp = (r * -0.125) * (w * r) else: tmp = (r * -0.125) * (w * w) return tmp
function code(v, w, r) tmp = 0.0 if (w <= 2.15e-60) tmp = Float64(Float64(3.0 - Float64(Float64(w * 0.125) * r)) - 4.5); elseif (w <= 2.6e+123) tmp = Float64(Float64(r * -0.125) * Float64(w * r)); else tmp = Float64(Float64(r * -0.125) * Float64(w * w)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (w <= 2.15e-60) tmp = (3.0 - ((w * 0.125) * r)) - 4.5; elseif (w <= 2.6e+123) tmp = (r * -0.125) * (w * r); else tmp = (r * -0.125) * (w * w); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[w, 2.15e-60], N[(N[(3.0 - N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[w, 2.6e+123], N[(N[(r * -0.125), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], N[(N[(r * -0.125), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 2.15 \cdot 10^{-60}:\\
\;\;\;\;\left(3 - \left(w \cdot 0.125\right) \cdot r\right) - 4.5\\
\mathbf{elif}\;w \leq 2.6 \cdot 10^{+123}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot r\right)\\
\mathbf{else}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot w\right)\\
\end{array}
\end{array}
if w < 2.15e-60Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Taylor expanded in r around inf
Applied rewrites19.6%
if 2.15e-60 < w < 2.59999999999999985e123Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites13.3%
if 2.59999999999999985e123 < w Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites8.7%
Applied rewrites15.3%
(FPCore (v w r) :precision binary64 (if (<= w 2.6e+123) (* (* r -0.125) (* w r)) (* (* r -0.125) (* w w))))
double code(double v, double w, double r) {
double tmp;
if (w <= 2.6e+123) {
tmp = (r * -0.125) * (w * r);
} else {
tmp = (r * -0.125) * (w * w);
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (w <= 2.6d+123) then
tmp = (r * (-0.125d0)) * (w * r)
else
tmp = (r * (-0.125d0)) * (w * w)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (w <= 2.6e+123) {
tmp = (r * -0.125) * (w * r);
} else {
tmp = (r * -0.125) * (w * w);
}
return tmp;
}
def code(v, w, r): tmp = 0 if w <= 2.6e+123: tmp = (r * -0.125) * (w * r) else: tmp = (r * -0.125) * (w * w) return tmp
function code(v, w, r) tmp = 0.0 if (w <= 2.6e+123) tmp = Float64(Float64(r * -0.125) * Float64(w * r)); else tmp = Float64(Float64(r * -0.125) * Float64(w * w)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (w <= 2.6e+123) tmp = (r * -0.125) * (w * r); else tmp = (r * -0.125) * (w * w); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[w, 2.6e+123], N[(N[(r * -0.125), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], N[(N[(r * -0.125), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 2.6 \cdot 10^{+123}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot r\right)\\
\mathbf{else}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot \left(w \cdot w\right)\\
\end{array}
\end{array}
if w < 2.59999999999999985e123Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites13.3%
if 2.59999999999999985e123 < w Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites8.7%
Applied rewrites15.3%
(FPCore (v w r) :precision binary64 (* (* r -0.125) (* w r)))
double code(double v, double w, double r) {
return (r * -0.125) * (w * r);
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (r * (-0.125d0)) * (w * r)
end function
public static double code(double v, double w, double r) {
return (r * -0.125) * (w * r);
}
def code(v, w, r): return (r * -0.125) * (w * r)
function code(v, w, r) return Float64(Float64(r * -0.125) * Float64(w * r)) end
function tmp = code(v, w, r) tmp = (r * -0.125) * (w * r); end
code[v_, w_, r_] := N[(N[(r * -0.125), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(r \cdot -0.125\right) \cdot \left(w \cdot r\right)
\end{array}
Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites13.3%
(FPCore (v w r)
:precision binary64
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-2e+24)
(* (* -0.125 3.0) (* w r))
(- (* (* w 0.125) r) 4.5)))
double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24) {
tmp = (-0.125 * 3.0) * (w * r);
} else {
tmp = ((w * 0.125) * r) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if ((((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-2d+24)) then
tmp = ((-0.125d0) * 3.0d0) * (w * r)
else
tmp = ((w * 0.125d0) * r) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24) {
tmp = (-0.125 * 3.0) * (w * r);
} else {
tmp = ((w * 0.125) * r) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24: tmp = (-0.125 * 3.0) * (w * r) else: tmp = ((w * 0.125) * r) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -2e+24) tmp = Float64(Float64(-0.125 * 3.0) * Float64(w * r)); else tmp = Float64(Float64(Float64(w * 0.125) * r) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24) tmp = (-0.125 * 3.0) * (w * r); else tmp = ((w * 0.125) * r) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -2e+24], N[(N[(-0.125 * 3.0), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], N[(N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -2 \cdot 10^{+24}:\\
\;\;\;\;\left(-0.125 \cdot 3\right) \cdot \left(w \cdot r\right)\\
\mathbf{else}:\\
\;\;\;\;\left(w \cdot 0.125\right) \cdot r - 4.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -2e24Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites8.7%
if -2e24 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Applied rewrites10.0%
(FPCore (v w r)
:precision binary64
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-2e+24)
(* (* r -0.125) w)
(- (* (* w 0.125) r) 4.5)))
double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24) {
tmp = (r * -0.125) * w;
} else {
tmp = ((w * 0.125) * r) - 4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if ((((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-2d+24)) then
tmp = (r * (-0.125d0)) * w
else
tmp = ((w * 0.125d0) * r) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24) {
tmp = (r * -0.125) * w;
} else {
tmp = ((w * 0.125) * r) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24: tmp = (r * -0.125) * w else: tmp = ((w * 0.125) * r) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -2e+24) tmp = Float64(Float64(r * -0.125) * w); else tmp = Float64(Float64(Float64(w * 0.125) * r) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+24) tmp = (r * -0.125) * w; else tmp = ((w * 0.125) * r) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -2e+24], N[(N[(r * -0.125), $MachinePrecision] * w), $MachinePrecision], N[(N[(N[(w * 0.125), $MachinePrecision] * r), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -2 \cdot 10^{+24}:\\
\;\;\;\;\left(r \cdot -0.125\right) \cdot w\\
\mathbf{else}:\\
\;\;\;\;\left(w \cdot 0.125\right) \cdot r - 4.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -2e24Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites8.7%
if -2e24 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Applied rewrites10.0%
(FPCore (v w r) :precision binary64 (* (* r -0.125) w))
double code(double v, double w, double r) {
return (r * -0.125) * w;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (r * (-0.125d0)) * w
end function
public static double code(double v, double w, double r) {
return (r * -0.125) * w;
}
def code(v, w, r): return (r * -0.125) * w
function code(v, w, r) return Float64(Float64(r * -0.125) * w) end
function tmp = code(v, w, r) tmp = (r * -0.125) * w; end
code[v_, w_, r_] := N[(N[(r * -0.125), $MachinePrecision] * w), $MachinePrecision]
\begin{array}{l}
\\
\left(r \cdot -0.125\right) \cdot w
\end{array}
Initial program 85.5%
Taylor expanded in w around inf
Applied rewrites34.5%
Applied rewrites8.7%
(FPCore (v w r) :precision binary64 -4.5)
double code(double v, double w, double r) {
return -4.5;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -4.5d0
end function
public static double code(double v, double w, double r) {
return -4.5;
}
def code(v, w, r): return -4.5
function code(v, w, r) return -4.5 end
function tmp = code(v, w, r) tmp = -4.5; end
code[v_, w_, r_] := -4.5
\begin{array}{l}
\\
-4.5
\end{array}
Initial program 85.5%
Applied rewrites95.0%
Applied rewrites64.0%
Applied rewrites13.3%
Taylor expanded in w around 0
Applied rewrites4.2%
(FPCore (v w r) :precision binary64 r)
double code(double v, double w, double r) {
return r;
}
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(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = r
end function
public static double code(double v, double w, double r) {
return r;
}
def code(v, w, r): return r
function code(v, w, r) return r end
function tmp = code(v, w, r) tmp = r; end
code[v_, w_, r_] := r
\begin{array}{l}
\\
r
\end{array}
Initial program 85.5%
Taylor expanded in r around 0
Applied rewrites45.4%
Applied rewrites2.8%
herbie shell --seed 2025159
(FPCore (v w r)
:name "Rosa's TurbineBenchmark"
:precision binary64
(- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))