
(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 16 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
(let* ((t_0 (- (- (+ 3.0 (/ 2.0 (* r r))) (* 0.25 (pow (* w r) 2.0))) 4.5)))
(if (<= v -1660000000.0)
t_0
(if (<= v 7.5e-9)
(-
(-
(+ 3.0 (/ (/ 2.0 r) r))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* r w) (* r w))) (- 1.0 v)))
4.5)
t_0))))
double code(double v, double w, double r) {
double t_0 = ((3.0 + (2.0 / (r * r))) - (0.25 * pow((w * r), 2.0))) - 4.5;
double tmp;
if (v <= -1660000000.0) {
tmp = t_0;
} else if (v <= 7.5e-9) {
tmp = ((3.0 + ((2.0 / r) / r)) - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
} else {
tmp = t_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.25d0 * ((w * r) ** 2.0d0))) - 4.5d0
if (v <= (-1660000000.0d0)) then
tmp = t_0
else if (v <= 7.5d-9) then
tmp = ((3.0d0 + ((2.0d0 / r) / r)) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * ((r * w) * (r * w))) / (1.0d0 - v))) - 4.5d0
else
tmp = t_0
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.25 * Math.pow((w * r), 2.0))) - 4.5;
double tmp;
if (v <= -1660000000.0) {
tmp = t_0;
} else if (v <= 7.5e-9) {
tmp = ((3.0 + ((2.0 / r) / r)) - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
} else {
tmp = t_0;
}
return tmp;
}
def code(v, w, r): t_0 = ((3.0 + (2.0 / (r * r))) - (0.25 * math.pow((w * r), 2.0))) - 4.5 tmp = 0 if v <= -1660000000.0: tmp = t_0 elif v <= 7.5e-9: tmp = ((3.0 + ((2.0 / r) / r)) - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5 else: tmp = t_0 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(0.25 * (Float64(w * r) ^ 2.0))) - 4.5) tmp = 0.0 if (v <= -1660000000.0) tmp = t_0; elseif (v <= 7.5e-9) tmp = Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(r * w) * Float64(r * w))) / Float64(1.0 - v))) - 4.5); else tmp = t_0; end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((3.0 + (2.0 / (r * r))) - (0.25 * ((w * r) ^ 2.0))) - 4.5; tmp = 0.0; if (v <= -1660000000.0) tmp = t_0; elseif (v <= 7.5e-9) tmp = ((3.0 + ((2.0 / r) / r)) - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5; else tmp = t_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[(0.25 * N[Power[N[(w * r), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -1660000000.0], t$95$0, If[LessEqual[v, 7.5e-9], N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(3 + \frac{2}{r \cdot r}\right) - 0.25 \cdot {\left(w \cdot r\right)}^{2}\right) - 4.5\\
\mathbf{if}\;v \leq -1660000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;v \leq 7.5 \cdot 10^{-9}:\\
\;\;\;\;\left(\left(3 + \frac{\frac{2}{r}}{r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if v < -1.66e9 or 7.49999999999999933e-9 < v Initial program 82.2%
Taylor expanded in v around inf
lower-*.f64N/A
*-commutativeN/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6499.3
Applied rewrites99.3%
if -1.66e9 < v < 7.49999999999999933e-9Initial program 88.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
(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))
(t_1 (/ (/ (fma (* r r) -1.5 2.0) r) r)))
(if (<= t_0 -1e+220) t_1 (if (<= t_0 -1.0) -1.5 t_1))))
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 t_1 = (fma((r * r), -1.5, 2.0) / r) / r;
double tmp;
if (t_0 <= -1e+220) {
tmp = t_1;
} else if (t_0 <= -1.0) {
tmp = -1.5;
} else {
tmp = t_1;
}
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) t_1 = Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r) tmp = 0.0 if (t_0 <= -1e+220) tmp = t_1; elseif (t_0 <= -1.0) tmp = -1.5; else tmp = t_1; end return 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]}, Block[{t$95$1 = N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+220], t$95$1, If[LessEqual[t$95$0, -1.0], -1.5, t$95$1]]]]
\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\\
t_1 := \frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+220}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -1:\\
\;\;\;\;-1.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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)) < -1e220 or -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 84.5%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6455.5
Applied rewrites55.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6476.7
Applied rewrites76.7%
if -1e220 < (-.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 87.7%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6445.5
Applied rewrites45.5%
Taylor expanded in r around inf
Applied rewrites59.4%
(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+186)
(/ (/ (* (* r r) -1.5) r) r)
(if (<= t_0 -1.0) -1.5 (/ (fma -1.5 (* r r) 2.0) (* r r))))))
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+186) {
tmp = (((r * r) * -1.5) / r) / r;
} else if (t_0 <= -1.0) {
tmp = -1.5;
} else {
tmp = fma(-1.5, (r * r), 2.0) / (r * r);
}
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+186) tmp = Float64(Float64(Float64(Float64(r * r) * -1.5) / r) / r); elseif (t_0 <= -1.0) tmp = -1.5; else tmp = Float64(fma(-1.5, Float64(r * r), 2.0) / Float64(r * r)); end return 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+186], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision], If[LessEqual[t$95$0, -1.0], -1.5, N[(N[(-1.5 * N[(r * r), $MachinePrecision] + 2.0), $MachinePrecision] / N[(r * r), $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^{+186}:\\
\;\;\;\;\frac{\frac{\left(r \cdot r\right) \cdot -1.5}{r}}{r}\\
\mathbf{elif}\;t\_0 \leq -1:\\
\;\;\;\;-1.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1.5, r \cdot r, 2\right)}{r \cdot r}\\
\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.9999999999999998e185Initial program 84.1%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f645.7
Applied rewrites5.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6449.6
Applied rewrites49.6%
Taylor expanded in r around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6445.6
Applied rewrites45.6%
if -9.9999999999999998e185 < (-.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 87.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6447.4
Applied rewrites47.4%
Taylor expanded in r around inf
Applied rewrites61.9%
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.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* 0.125 (- 3.0 (* 2.0 v)))))
(if (<=
(-
(- (+ 3.0 (/ 2.0 (* r r))) (/ (* t_0 (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-1.0)
(- (- 3.0 (/ (* t_0 (* (* r w) (* r w))) (- 1.0 v))) 4.5)
(/ (/ (fma (* r r) -1.5 2.0) r) r))))
double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 - (2.0 * v));
double tmp;
if ((((3.0 + (2.0 / (r * r))) - ((t_0 * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.0) {
tmp = (3.0 - ((t_0 * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
} else {
tmp = (fma((r * r), -1.5, 2.0) / r) / r;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) tmp = 0.0 if (Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(t_0 * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(t_0 * Float64(Float64(r * w) * Float64(r * w))) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.0], N[(N[(3.0 - N[(N[(t$95$0 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(3 - 2 \cdot v\right)\\
\mathbf{if}\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{t\_0 \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1:\\
\;\;\;\;\left(3 - \frac{t\_0 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\
\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)) < -1Initial program 85.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6492.7
Applied rewrites92.7%
Taylor expanded in r around inf
Applied rewrites90.0%
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.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* w w) r)))
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* t_0 r)) (- 1.0 v)))
4.5)
-1.0)
(- (- 3.0 (/ (* (* (* (fma -2.0 v 3.0) 0.125) t_0) r) (- 1.0 v))) 4.5)
(/ (/ (fma (* r r) -1.5 2.0) r) r))))
double code(double v, double w, double r) {
double t_0 = (w * w) * r;
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) - 4.5) <= -1.0) {
tmp = (3.0 - ((((fma(-2.0, v, 3.0) * 0.125) * t_0) * r) / (1.0 - v))) - 4.5;
} else {
tmp = (fma((r * r), -1.5, 2.0) / r) / r;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(Float64(w * 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(t_0 * r)) / Float64(1.0 - v))) - 4.5) <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(fma(-2.0, v, 3.0) * 0.125) * t_0) * r) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(w * w), $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] * N[(t$95$0 * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.0], N[(N[(3.0 - N[(N[(N[(N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * t$95$0), $MachinePrecision] * r), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(w \cdot w\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 \left(t\_0 \cdot r\right)}{1 - v}\right) - 4.5 \leq -1:\\
\;\;\;\;\left(3 - \frac{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot t\_0\right) \cdot r}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\
\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)) < -1Initial program 85.2%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f6485.0
Applied rewrites85.0%
Taylor expanded in r around inf
Applied rewrites84.5%
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.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
(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.0)
(- (- 3.0 (/ (* (fma -0.25 v 0.375) t_0) (- 1.0 v))) 4.5)
(/ (/ (fma (* r r) -1.5 2.0) r) r))))
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.0) {
tmp = (3.0 - ((fma(-0.25, v, 0.375) * t_0) / (1.0 - v))) - 4.5;
} else {
tmp = (fma((r * r), -1.5, 2.0) / r) / r;
}
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.0) tmp = Float64(Float64(3.0 - Float64(Float64(fma(-0.25, v, 0.375) * t_0) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r); end return 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.0], N[(N[(3.0 - N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $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:\\
\;\;\;\;\left(3 - \frac{\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot t\_0}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\
\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)) < -1Initial program 85.2%
Taylor expanded in v around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6485.2
Applied rewrites85.2%
Taylor expanded in r around inf
Applied rewrites84.7%
Taylor expanded in v around 0
+-commutativeN/A
lift-fma.f6484.7
Applied rewrites84.7%
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.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
(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.0)
(- (- 3.0 (/ (* 0.375 t_0) (- 1.0 v))) 4.5)
(/ (/ (fma (* r r) -1.5 2.0) r) r))))
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.0) {
tmp = (3.0 - ((0.375 * t_0) / (1.0 - v))) - 4.5;
} else {
tmp = (fma((r * r), -1.5, 2.0) / r) / r;
}
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.0) tmp = Float64(Float64(3.0 - Float64(Float64(0.375 * t_0) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r); end return 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.0], N[(N[(3.0 - N[(N[(0.375 * t$95$0), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $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:\\
\;\;\;\;\left(3 - \frac{0.375 \cdot t\_0}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\
\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)) < -1Initial program 85.2%
Taylor expanded in v around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6485.2
Applied rewrites85.2%
Taylor expanded in r around inf
Applied rewrites84.7%
Taylor expanded in v around 0
Applied rewrites67.4%
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.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (v w r)
:precision binary64
(if (<= (* w w) 1e+216)
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (fma -0.25 v 0.375) (* (* w (* w r)) r)) (- 1.0 v)))
4.5)
(-
(- (+ 3.0 (/ (/ 2.0 r) r)) (/ (* (* 0.125 3.0) (* (* r w) (* r w))) 1.0))
4.5)))
double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 1e+216) {
tmp = ((3.0 + (2.0 / (r * r))) - ((fma(-0.25, v, 0.375) * ((w * (w * r)) * r)) / (1.0 - v))) - 4.5;
} else {
tmp = ((3.0 + ((2.0 / r) / r)) - (((0.125 * 3.0) * ((r * w) * (r * w))) / 1.0)) - 4.5;
}
return tmp;
}
function code(v, w, r) tmp = 0.0 if (Float64(w * w) <= 1e+216) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(fma(-0.25, v, 0.375) * Float64(Float64(w * Float64(w * r)) * r)) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - Float64(Float64(Float64(0.125 * 3.0) * Float64(Float64(r * w) * Float64(r * w))) / 1.0)) - 4.5); end return tmp end
code[v_, w_, r_] := If[LessEqual[N[(w * w), $MachinePrecision], 1e+216], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] * N[(N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * 3.0), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \cdot w \leq 10^{+216}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + \frac{\frac{2}{r}}{r}\right) - \frac{\left(0.125 \cdot 3\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1}\right) - 4.5\\
\end{array}
\end{array}
if (*.f64 w w) < 1e216Initial program 92.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in v around 0
+-commutativeN/A
lower-fma.f6495.6
Applied rewrites95.6%
if 1e216 < (*.f64 w w) Initial program 70.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.2
Applied rewrites94.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6494.2
Applied rewrites94.2%
Taylor expanded in v around 0
Applied rewrites80.0%
Taylor expanded in v around 0
Applied rewrites96.7%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ (/ 2.0 r) r)) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* r w) (* r w))) (- 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))) * ((r * w) * (r * w))) / (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))) * ((r * w) * (r * w))) / (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))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + ((2.0 / r) / r)) - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(r * w) * Float64(r * w))) / 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))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{\frac{2}{r}}{r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - 4.5
\end{array}
Initial program 85.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6495.1
Applied rewrites95.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6495.1
Applied rewrites95.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<= (* w w) 1e+216)
(- (- t_0 (/ (* (fma -0.25 v 0.375) (* (* w (* w r)) r)) (- 1.0 v))) 4.5)
(- (- t_0 (/ (* 0.375 (* (* r w) (* r w))) 1.0)) 4.5))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if ((w * w) <= 1e+216) {
tmp = (t_0 - ((fma(-0.25, v, 0.375) * ((w * (w * r)) * r)) / (1.0 - v))) - 4.5;
} else {
tmp = (t_0 - ((0.375 * ((r * w) * (r * w))) / 1.0)) - 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(w * w) <= 1e+216) tmp = Float64(Float64(t_0 - Float64(Float64(fma(-0.25, v, 0.375) * Float64(Float64(w * Float64(w * r)) * r)) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))) / 1.0)) - 4.5); end return 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[(w * w), $MachinePrecision], 1e+216], N[(N[(t$95$0 - N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] * N[(N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 10^{+216}:\\
\;\;\;\;\left(t\_0 - \frac{\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \frac{0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1}\right) - 4.5\\
\end{array}
\end{array}
if (*.f64 w w) < 1e216Initial program 92.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in v around 0
+-commutativeN/A
lower-fma.f6495.6
Applied rewrites95.6%
if 1e216 < (*.f64 w w) Initial program 70.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.2
Applied rewrites94.2%
Taylor expanded in v around 0
Applied rewrites80.0%
Taylor expanded in v around 0
Applied rewrites96.7%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* r w) (* r w))) (- 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))) * ((r * w) * (r * w))) / (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))) * ((r * w) * (r * w))) / (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))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (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(r * w) * Float64(r * w))) / 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))) * ((r * w) * (r * w))) / (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[(r * w), $MachinePrecision] * N[(r * w), $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.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - 4.5
\end{array}
Initial program 85.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6495.1
Applied rewrites95.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))))
(if (<= r 0.0015)
(- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* 0.375 t_0) 1.0)) 4.5)
(- (- 3.0 (/ (* (* 0.125 (- 3.0 (* 2.0 v))) t_0) (- 1.0 v))) 4.5))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double tmp;
if (r <= 0.0015) {
tmp = ((3.0 + (2.0 / (r * r))) - ((0.375 * t_0) / 1.0)) - 4.5;
} else {
tmp = (3.0 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 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 = (r * w) * (r * w)
if (r <= 0.0015d0) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) - ((0.375d0 * t_0) / 1.0d0)) - 4.5d0
else
tmp = (3.0d0 - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * t_0) / (1.0d0 - v))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double tmp;
if (r <= 0.0015) {
tmp = ((3.0 + (2.0 / (r * r))) - ((0.375 * t_0) / 1.0)) - 4.5;
} else {
tmp = (3.0 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) tmp = 0 if r <= 0.0015: tmp = ((3.0 + (2.0 / (r * r))) - ((0.375 * t_0) / 1.0)) - 4.5 else: tmp = (3.0 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) tmp = 0.0 if (r <= 0.0015) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.375 * t_0) / 1.0)) - 4.5); else tmp = Float64(Float64(3.0 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * t_0) / Float64(1.0 - v))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); tmp = 0.0; if (r <= 0.0015) tmp = ((3.0 + (2.0 / (r * r))) - ((0.375 * t_0) / 1.0)) - 4.5; else tmp = (3.0 - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 0.0015], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.375 * t$95$0), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 - 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;r \leq 0.0015:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.375 \cdot t\_0}{1}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot t\_0}{1 - v}\right) - 4.5\\
\end{array}
\end{array}
if r < 0.0015Initial program 83.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in v around 0
Applied rewrites88.0%
Taylor expanded in v around 0
Applied rewrites94.4%
if 0.0015 < r Initial program 89.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.3
Applied rewrites94.3%
Taylor expanded in r around inf
Applied rewrites93.4%
(FPCore (v w r) :precision binary64 (if (<= r 0.0015) (/ (fma -1.5 (* r r) 2.0) (* r r)) -1.5))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.0015) {
tmp = fma(-1.5, (r * r), 2.0) / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
function code(v, w, r) tmp = 0.0 if (r <= 0.0015) tmp = Float64(fma(-1.5, Float64(r * r), 2.0) / Float64(r * r)); else tmp = -1.5; end return tmp end
code[v_, w_, r_] := If[LessEqual[r, 0.0015], N[(N[(-1.5 * N[(r * r), $MachinePrecision] + 2.0), $MachinePrecision] / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.0015:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1.5, r \cdot r, 2\right)}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 0.0015Initial program 83.6%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6464.4
Applied rewrites64.4%
if 0.0015 < r Initial program 89.8%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6420.7
Applied rewrites20.7%
Taylor expanded in r around inf
Applied rewrites26.9%
(FPCore (v w r) :precision binary64 (if (<= r 0.0015) (/ (/ 2.0 r) r) -1.5))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.0015) {
tmp = (2.0 / r) / r;
} else {
tmp = -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 (r <= 0.0015d0) then
tmp = (2.0d0 / r) / r
else
tmp = -1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 0.0015) {
tmp = (2.0 / r) / r;
} else {
tmp = -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 0.0015: tmp = (2.0 / r) / r else: tmp = -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 0.0015) tmp = Float64(Float64(2.0 / r) / r); else tmp = -1.5; end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 0.0015) tmp = (2.0 / r) / r; else tmp = -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 0.0015], N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision], -1.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.0015:\\
\;\;\;\;\frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 0.0015Initial program 83.6%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6464.4
Applied rewrites64.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6475.5
Applied rewrites75.5%
Taylor expanded in r around 0
Applied rewrites57.9%
if 0.0015 < r Initial program 89.8%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6420.7
Applied rewrites20.7%
Taylor expanded in r around inf
Applied rewrites26.9%
(FPCore (v w r) :precision binary64 (if (<= r 0.0015) (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.0015) {
tmp = 2.0 / (r * r);
} else {
tmp = -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 (r <= 0.0015d0) then
tmp = 2.0d0 / (r * r)
else
tmp = -1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 0.0015) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 0.0015: tmp = 2.0 / (r * r) else: tmp = -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 0.0015) tmp = Float64(2.0 / Float64(r * r)); else tmp = -1.5; end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 0.0015) tmp = 2.0 / (r * r); else tmp = -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 0.0015], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.0015:\\
\;\;\;\;\frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 0.0015Initial program 83.6%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6464.4
Applied rewrites64.4%
Taylor expanded in r around 0
Applied rewrites57.9%
if 0.0015 < r Initial program 89.8%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6420.7
Applied rewrites20.7%
Taylor expanded in r around inf
Applied rewrites26.9%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.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 = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 85.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6453.3
Applied rewrites53.3%
Taylor expanded in r around inf
Applied rewrites14.4%
herbie shell --seed 2025095
(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))