
(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]
\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
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]
\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
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (fabs w) r)) (t_1 (/ 2.0 (* r r))))
(if (<= (fabs w) 1e-21)
(-
(-
1.5
(-
t_1
(* (* (* (* (fabs w) (fma -2.0 v 3.0)) 0.125) t_0) (/ r (- 1.0 v))))))
(-
(-
(+ 3.0 t_1)
(* (* (fabs w) (* t_0 r)) (/ (fma -0.25 v 0.375) (- 1.0 v))))
4.5))))double code(double v, double w, double r) {
double t_0 = fabs(w) * r;
double t_1 = 2.0 / (r * r);
double tmp;
if (fabs(w) <= 1e-21) {
tmp = -(1.5 - (t_1 - ((((fabs(w) * fma(-2.0, v, 3.0)) * 0.125) * t_0) * (r / (1.0 - v)))));
} else {
tmp = ((3.0 + t_1) - ((fabs(w) * (t_0 * r)) * (fma(-0.25, v, 0.375) / (1.0 - v)))) - 4.5;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(abs(w) * r) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (abs(w) <= 1e-21) tmp = Float64(-Float64(1.5 - Float64(t_1 - Float64(Float64(Float64(Float64(abs(w) * fma(-2.0, v, 3.0)) * 0.125) * t_0) * Float64(r / Float64(1.0 - v)))))); else tmp = Float64(Float64(Float64(3.0 + t_1) - Float64(Float64(abs(w) * Float64(t_0 * r)) * Float64(fma(-0.25, v, 0.375) / Float64(1.0 - v)))) - 4.5); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[Abs[w], $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[w], $MachinePrecision], 1e-21], (-N[(1.5 - N[(t$95$1 - N[(N[(N[(N[(N[Abs[w], $MachinePrecision] * N[(-2.0 * v + 3.0), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[(3.0 + t$95$1), $MachinePrecision] - N[(N[(N[Abs[w], $MachinePrecision] * N[(t$95$0 * r), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.25 * v + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|w\right| \cdot r\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left|w\right| \leq 10^{-21}:\\
\;\;\;\;-\left(1.5 - \left(t\_1 - \left(\left(\left(\left|w\right| \cdot \mathsf{fma}\left(-2, v, 3\right)\right) \cdot 0.125\right) \cdot t\_0\right) \cdot \frac{r}{1 - v}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_1\right) - \left(\left|w\right| \cdot \left(t\_0 \cdot r\right)\right) \cdot \frac{\mathsf{fma}\left(-0.25, v, 0.375\right)}{1 - v}\right) - 4.5\\
\end{array}
if w < 9.99999999999999908e-22Initial program 84.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.8%
Applied rewrites94.8%
Applied rewrites91.4%
if 9.99999999999999908e-22 < w Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (fabs r))) (t_1 (+ 3.0 (/ 2.0 (* (fabs r) (fabs r))))))
(if (<= (fabs r) 1e+170)
(-
(- t_1 (* (* w (* t_0 (fabs r))) (/ (fma -0.25 v 0.375) (- 1.0 v))))
4.5)
(- (- t_1 (/ (* (* (fma -0.25 v 0.375) t_0) t_0) (- 1.0 v))) 4.5))))double code(double v, double w, double r) {
double t_0 = w * fabs(r);
double t_1 = 3.0 + (2.0 / (fabs(r) * fabs(r)));
double tmp;
if (fabs(r) <= 1e+170) {
tmp = (t_1 - ((w * (t_0 * fabs(r))) * (fma(-0.25, v, 0.375) / (1.0 - v)))) - 4.5;
} else {
tmp = (t_1 - (((fma(-0.25, v, 0.375) * t_0) * t_0) / (1.0 - v))) - 4.5;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(w * abs(r)) t_1 = Float64(3.0 + Float64(2.0 / Float64(abs(r) * abs(r)))) tmp = 0.0 if (abs(r) <= 1e+170) tmp = Float64(Float64(t_1 - Float64(Float64(w * Float64(t_0 * abs(r))) * Float64(fma(-0.25, v, 0.375) / Float64(1.0 - v)))) - 4.5); else tmp = Float64(Float64(t_1 - Float64(Float64(Float64(fma(-0.25, v, 0.375) * t_0) * t_0) / Float64(1.0 - v))) - 4.5); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[Abs[r], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 1e+170], N[(N[(t$95$1 - N[(N[(w * N[(t$95$0 * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.25 * v + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
t_0 := w \cdot \left|r\right|\\
t_1 := 3 + \frac{2}{\left|r\right| \cdot \left|r\right|}\\
\mathbf{if}\;\left|r\right| \leq 10^{+170}:\\
\;\;\;\;\left(t\_1 - \left(w \cdot \left(t\_0 \cdot \left|r\right|\right)\right) \cdot \frac{\mathsf{fma}\left(-0.25, v, 0.375\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \frac{\left(\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot t\_0\right) \cdot t\_0}{1 - v}\right) - 4.5\\
\end{array}
if r < 1.00000000000000003e170Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
if 1.00000000000000003e170 < r Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6494.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6494.8%
Applied rewrites94.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (fabs w) 2.2e+138)
(-
(-
1.5
(-
t_0
(*
(/ (fma -0.25 v 0.375) (- 1.0 v))
(* (* (* (fabs w) (fabs w)) r) r)))))
(- (- (+ 3.0 t_0) (* (* (fabs w) (* (* (fabs w) r) r)) 0.375)) 4.5))))double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (fabs(w) <= 2.2e+138) {
tmp = -(1.5 - (t_0 - ((fma(-0.25, v, 0.375) / (1.0 - v)) * (((fabs(w) * fabs(w)) * r) * r))));
} else {
tmp = ((3.0 + t_0) - ((fabs(w) * ((fabs(w) * r) * r)) * 0.375)) - 4.5;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (abs(w) <= 2.2e+138) tmp = Float64(-Float64(1.5 - Float64(t_0 - Float64(Float64(fma(-0.25, v, 0.375) / Float64(1.0 - v)) * Float64(Float64(Float64(abs(w) * abs(w)) * r) * r))))); else tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(abs(w) * Float64(Float64(abs(w) * r) * r)) * 0.375)) - 4.5); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[w], $MachinePrecision], 2.2e+138], (-N[(1.5 - N[(t$95$0 - N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Abs[w], $MachinePrecision] * N[Abs[w], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[Abs[w], $MachinePrecision] * N[(N[(N[Abs[w], $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left|w\right| \leq 2.2 \cdot 10^{+138}:\\
\;\;\;\;-\left(1.5 - \left(t\_0 - \frac{\mathsf{fma}\left(-0.25, v, 0.375\right)}{1 - v} \cdot \left(\left(\left(\left|w\right| \cdot \left|w\right|\right) \cdot r\right) \cdot r\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \left(\left|w\right| \cdot \left(\left(\left|w\right| \cdot r\right) \cdot r\right)\right) \cdot 0.375\right) - 4.5\\
\end{array}
if w < 2.2000000000000001e138Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
Applied rewrites87.2%
if 2.2000000000000001e138 < w Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around 0
Applied rewrites91.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (fabs w) 2.2e+138)
(-
t_0
(fma
(* (* (/ (fma -0.25 v 0.375) (- 1.0 v)) (* (fabs w) (fabs w))) r)
r
1.5))
(- (- (+ 3.0 t_0) (* (* (fabs w) (* (* (fabs w) r) r)) 0.375)) 4.5))))double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (fabs(w) <= 2.2e+138) {
tmp = t_0 - fma((((fma(-0.25, v, 0.375) / (1.0 - v)) * (fabs(w) * fabs(w))) * r), r, 1.5);
} else {
tmp = ((3.0 + t_0) - ((fabs(w) * ((fabs(w) * r) * r)) * 0.375)) - 4.5;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (abs(w) <= 2.2e+138) tmp = Float64(t_0 - fma(Float64(Float64(Float64(fma(-0.25, v, 0.375) / Float64(1.0 - v)) * Float64(abs(w) * abs(w))) * r), r, 1.5)); else tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(abs(w) * Float64(Float64(abs(w) * r) * r)) * 0.375)) - 4.5); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[w], $MachinePrecision], 2.2e+138], N[(t$95$0 - N[(N[(N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(N[Abs[w], $MachinePrecision] * N[Abs[w], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision] * r + 1.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[Abs[w], $MachinePrecision] * N[(N[(N[Abs[w], $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left|w\right| \leq 2.2 \cdot 10^{+138}:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(-0.25, v, 0.375\right)}{1 - v} \cdot \left(\left|w\right| \cdot \left|w\right|\right)\right) \cdot r, r, 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \left(\left|w\right| \cdot \left(\left(\left|w\right| \cdot r\right) \cdot r\right)\right) \cdot 0.375\right) - 4.5\\
\end{array}
if w < 2.2000000000000001e138Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Applied rewrites87.2%
if 2.2000000000000001e138 < w Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around 0
Applied rewrites91.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1 (- (- (+ 3.0 t_0) (* (* w (* (* w r) r)) 0.25)) 4.5)))
(if (<= v -8.6e+103)
t_1
(if (<= v 8e-7)
(- (- t_0 -3.0) (fma (* (/ r (- 1.0 v)) (* 0.375 w)) (* w r) 4.5))
t_1))))double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - ((w * ((w * r) * r)) * 0.25)) - 4.5;
double tmp;
if (v <= -8.6e+103) {
tmp = t_1;
} else if (v <= 8e-7) {
tmp = (t_0 - -3.0) - fma(((r / (1.0 - v)) * (0.375 * w)), (w * r), 4.5);
} else {
tmp = t_1;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(w * Float64(Float64(w * r) * r)) * 0.25)) - 4.5) tmp = 0.0 if (v <= -8.6e+103) tmp = t_1; elseif (v <= 8e-7) tmp = Float64(Float64(t_0 - -3.0) - fma(Float64(Float64(r / Float64(1.0 - v)) * Float64(0.375 * w)), Float64(w * r), 4.5)); else tmp = t_1; end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(w * N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -8.6e+103], t$95$1, If[LessEqual[v, 8e-7], N[(N[(t$95$0 - -3.0), $MachinePrecision] - N[(N[(N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(0.375 * w), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(\left(3 + t\_0\right) - \left(w \cdot \left(\left(w \cdot r\right) \cdot r\right)\right) \cdot 0.25\right) - 4.5\\
\mathbf{if}\;v \leq -8.6 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 8 \cdot 10^{-7}:\\
\;\;\;\;\left(t\_0 - -3\right) - \mathsf{fma}\left(\frac{r}{1 - v} \cdot \left(0.375 \cdot w\right), w \cdot r, 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if v < -8.59999999999999938e103 or 7.9999999999999996e-7 < v Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around inf
Applied rewrites91.7%
if -8.59999999999999938e103 < v < 7.9999999999999996e-7Initial program 84.3%
Taylor expanded in v around 0
Applied rewrites77.5%
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
Applied rewrites82.6%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6484.2%
Applied rewrites84.2%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* w (* (* w r) r)) (/ (fma -0.25 v 0.375) (- 1.0 v)))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((w * ((w * r) * r)) * (fma(-0.25, v, 0.375) / (1.0 - v)))) - 4.5;
}
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(w * Float64(Float64(w * r) * r)) * Float64(fma(-0.25, v, 0.375) / Float64(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[(w * N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.25 * v + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(w \cdot \left(\left(w \cdot r\right) \cdot r\right)\right) \cdot \frac{\mathsf{fma}\left(-0.25, v, 0.375\right)}{1 - v}\right) - 4.5
Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<= v 8e-7)
(- (- t_0 (/ (* 0.375 (* (* w r) (* w r))) (- 1.0 v))) 4.5)
(- (- t_0 (* (* w (* (* w r) r)) 0.25)) 4.5))))double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= 8e-7) {
tmp = (t_0 - ((0.375 * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
} else {
tmp = (t_0 - ((w * ((w * r) * r)) * 0.25)) - 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 (v <= 8d-7) then
tmp = (t_0 - ((0.375d0 * ((w * r) * (w * r))) / (1.0d0 - v))) - 4.5d0
else
tmp = (t_0 - ((w * ((w * r) * r)) * 0.25d0)) - 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 (v <= 8e-7) {
tmp = (t_0 - ((0.375 * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
} else {
tmp = (t_0 - ((w * ((w * r) * r)) * 0.25)) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if v <= 8e-7: tmp = (t_0 - ((0.375 * ((w * r) * (w * r))) / (1.0 - v))) - 4.5 else: tmp = (t_0 - ((w * ((w * r) * r)) * 0.25)) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (v <= 8e-7) tmp = Float64(Float64(t_0 - Float64(Float64(0.375 * Float64(Float64(w * r) * Float64(w * r))) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(w * Float64(Float64(w * r) * r)) * 0.25)) - 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 (v <= 8e-7) tmp = (t_0 - ((0.375 * ((w * r) * (w * r))) / (1.0 - v))) - 4.5; else tmp = (t_0 - ((w * ((w * r) * r)) * 0.25)) - 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[v, 8e-7], N[(N[(t$95$0 - N[(N[(0.375 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(w * N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq 8 \cdot 10^{-7}:\\
\;\;\;\;\left(t\_0 - \frac{0.375 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(w \cdot \left(\left(w \cdot r\right) \cdot r\right)\right) \cdot 0.25\right) - 4.5\\
\end{array}
if v < 7.9999999999999996e-7Initial program 84.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.8%
Applied rewrites94.8%
Taylor expanded in v around 0
Applied rewrites86.2%
if 7.9999999999999996e-7 < v Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around inf
Applied rewrites91.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (* (* w (fabs r)) (fabs r)))))
(if (<= (fabs r) 360000.0)
(- (- (+ 3.0 (/ 2.0 (* (fabs r) (fabs r)))) (* t_0 0.25)) 4.5)
(- (- 3.0 (* t_0 (/ (fma -0.25 v 0.375) (- 1.0 v)))) 4.5))))double code(double v, double w, double r) {
double t_0 = w * ((w * fabs(r)) * fabs(r));
double tmp;
if (fabs(r) <= 360000.0) {
tmp = ((3.0 + (2.0 / (fabs(r) * fabs(r)))) - (t_0 * 0.25)) - 4.5;
} else {
tmp = (3.0 - (t_0 * (fma(-0.25, v, 0.375) / (1.0 - v)))) - 4.5;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(w * Float64(Float64(w * abs(r)) * abs(r))) tmp = 0.0 if (abs(r) <= 360000.0) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(abs(r) * abs(r)))) - Float64(t_0 * 0.25)) - 4.5); else tmp = Float64(Float64(3.0 - Float64(t_0 * Float64(fma(-0.25, v, 0.375) / Float64(1.0 - v)))) - 4.5); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[(N[(w * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 360000.0], N[(N[(N[(3.0 + N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 - N[(t$95$0 * N[(N[(-0.25 * v + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := w \cdot \left(\left(w \cdot \left|r\right|\right) \cdot \left|r\right|\right)\\
\mathbf{if}\;\left|r\right| \leq 360000:\\
\;\;\;\;\left(\left(3 + \frac{2}{\left|r\right| \cdot \left|r\right|}\right) - t\_0 \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - t\_0 \cdot \frac{\mathsf{fma}\left(-0.25, v, 0.375\right)}{1 - v}\right) - 4.5\\
\end{array}
if r < 3.6e5Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around inf
Applied rewrites91.7%
if 3.6e5 < r Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in r around inf
Applied rewrites52.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (* (* w r) r))) (t_1 (+ 3.0 (/ 2.0 (* r r)))))
(if (<= v 5e-14)
(- (- t_1 (* t_0 0.375)) 4.5)
(- (- t_1 (* t_0 0.25)) 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 (v <= 5e-14) {
tmp = (t_1 - (t_0 * 0.375)) - 4.5;
} else {
tmp = (t_1 - (t_0 * 0.25)) - 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 (v <= 5d-14) then
tmp = (t_1 - (t_0 * 0.375d0)) - 4.5d0
else
tmp = (t_1 - (t_0 * 0.25d0)) - 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 (v <= 5e-14) {
tmp = (t_1 - (t_0 * 0.375)) - 4.5;
} else {
tmp = (t_1 - (t_0 * 0.25)) - 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 v <= 5e-14: tmp = (t_1 - (t_0 * 0.375)) - 4.5 else: tmp = (t_1 - (t_0 * 0.25)) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(w * Float64(Float64(w * r) * r)) t_1 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (v <= 5e-14) tmp = Float64(Float64(t_1 - Float64(t_0 * 0.375)) - 4.5); else tmp = Float64(Float64(t_1 - Float64(t_0 * 0.25)) - 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 (v <= 5e-14) tmp = (t_1 - (t_0 * 0.375)) - 4.5; else tmp = (t_1 - (t_0 * 0.25)) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 5e-14], N[(N[(t$95$1 - N[(t$95$0 * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
t_0 := w \cdot \left(\left(w \cdot r\right) \cdot r\right)\\
t_1 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq 5 \cdot 10^{-14}:\\
\;\;\;\;\left(t\_1 - t\_0 \cdot 0.375\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - t\_0 \cdot 0.25\right) - 4.5\\
\end{array}
if v < 5.0000000000000002e-14Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around 0
Applied rewrites91.8%
if 5.0000000000000002e-14 < v Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around inf
Applied rewrites91.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v 4.4e+27)
(- (- t_0 -3.0) (fma (* (* 0.375 w) (* w r)) r 4.5))
(- (- (+ 3.0 t_0) (* (* w (* (* w r) r)) 0.25)) 4.5))))double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= 4.4e+27) {
tmp = (t_0 - -3.0) - fma(((0.375 * w) * (w * r)), r, 4.5);
} else {
tmp = ((3.0 + t_0) - ((w * ((w * r) * r)) * 0.25)) - 4.5;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= 4.4e+27) tmp = Float64(Float64(t_0 - -3.0) - fma(Float64(Float64(0.375 * w) * Float64(w * r)), r, 4.5)); else tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(w * Float64(Float64(w * r) * r)) * 0.25)) - 4.5); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 4.4e+27], N[(N[(t$95$0 - -3.0), $MachinePrecision] - N[(N[(N[(0.375 * w), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * r + 4.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(w * N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq 4.4 \cdot 10^{+27}:\\
\;\;\;\;\left(t\_0 - -3\right) - \mathsf{fma}\left(\left(0.375 \cdot w\right) \cdot \left(w \cdot r\right), r, 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \left(w \cdot \left(\left(w \cdot r\right) \cdot r\right)\right) \cdot 0.25\right) - 4.5\\
\end{array}
if v < 4.3999999999999997e27Initial program 84.3%
Taylor expanded in v around 0
Applied rewrites77.5%
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
Applied rewrites82.6%
Taylor expanded in v around 0
Applied rewrites90.9%
if 4.3999999999999997e27 < v Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.0%
Applied rewrites97.0%
Taylor expanded in v around inf
Applied rewrites91.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<=
(-
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-1.5)
(- (- t_0 -3.0) (fma (* (* 0.375 w) (* w r)) r 4.5))
(- (- 1.5 (/ 2.0 (pow r 2.0)))))))double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.5) {
tmp = (t_0 - -3.0) - fma(((0.375 * w) * (w * r)), r, 4.5);
} else {
tmp = -(1.5 - (2.0 / pow(r, 2.0)));
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(Float64(Float64(3.0 + 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) <= -1.5) tmp = Float64(Float64(t_0 - -3.0) - fma(Float64(Float64(0.375 * w) * Float64(w * r)), r, 4.5)); else tmp = Float64(-Float64(1.5 - Float64(2.0 / (r ^ 2.0)))); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$0), $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[(t$95$0 - -3.0), $MachinePrecision] - N[(N[(N[(0.375 * w), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * r + 4.5), $MachinePrecision]), $MachinePrecision], (-N[(1.5 - N[(2.0 / N[Power[r, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(\left(3 + t\_0\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(t\_0 - -3\right) - \mathsf{fma}\left(\left(0.375 \cdot w\right) \cdot \left(w \cdot r\right), r, 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;-\left(1.5 - \frac{2}{{r}^{2}}\right)\\
\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 84.3%
Taylor expanded in v around 0
Applied rewrites77.5%
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
Applied rewrites82.6%
Taylor expanded in v around 0
Applied rewrites90.9%
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 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
Applied rewrites87.2%
Taylor expanded in w around 0
lower-/.f64N/A
lower-pow.6457.9%
Applied rewrites57.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* (fabs r) (fabs r)))))
(if (<= (fabs r) 9.4e-116)
t_0
(- (- 1.5 (- t_0 (* 0.375 (* (* (* w w) (fabs r)) (fabs r)))))))))double code(double v, double w, double r) {
double t_0 = 2.0 / (fabs(r) * fabs(r));
double tmp;
if (fabs(r) <= 9.4e-116) {
tmp = t_0;
} else {
tmp = -(1.5 - (t_0 - (0.375 * (((w * w) * fabs(r)) * fabs(r)))));
}
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 = 2.0d0 / (abs(r) * abs(r))
if (abs(r) <= 9.4d-116) then
tmp = t_0
else
tmp = -(1.5d0 - (t_0 - (0.375d0 * (((w * w) * abs(r)) * abs(r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (Math.abs(r) * Math.abs(r));
double tmp;
if (Math.abs(r) <= 9.4e-116) {
tmp = t_0;
} else {
tmp = -(1.5 - (t_0 - (0.375 * (((w * w) * Math.abs(r)) * Math.abs(r)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (math.fabs(r) * math.fabs(r)) tmp = 0 if math.fabs(r) <= 9.4e-116: tmp = t_0 else: tmp = -(1.5 - (t_0 - (0.375 * (((w * w) * math.fabs(r)) * math.fabs(r))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(abs(r) * abs(r))) tmp = 0.0 if (abs(r) <= 9.4e-116) tmp = t_0; else tmp = Float64(-Float64(1.5 - Float64(t_0 - Float64(0.375 * Float64(Float64(Float64(w * w) * abs(r)) * abs(r)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (abs(r) * abs(r)); tmp = 0.0; if (abs(r) <= 9.4e-116) tmp = t_0; else tmp = -(1.5 - (t_0 - (0.375 * (((w * w) * abs(r)) * abs(r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 9.4e-116], t$95$0, (-N[(1.5 - N[(t$95$0 - N[(0.375 * N[(N[(N[(w * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
t_0 := \frac{2}{\left|r\right| \cdot \left|r\right|}\\
\mathbf{if}\;\left|r\right| \leq 9.4 \cdot 10^{-116}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-\left(1.5 - \left(t\_0 - 0.375 \cdot \left(\left(\left(w \cdot w\right) \cdot \left|r\right|\right) \cdot \left|r\right|\right)\right)\right)\\
\end{array}
if r < 9.39999999999999989e-116Initial program 84.3%
Taylor expanded in r around 0
lower-/.f64N/A
lower-pow.6444.7%
Applied rewrites44.7%
lift-pow.64N/A
pow2N/A
lift-*.f6444.7%
Applied rewrites44.7%
if 9.39999999999999989e-116 < r Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
Applied rewrites87.2%
Taylor expanded in v around 0
Applied rewrites82.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* (fabs r) (fabs r)))))
(if (<= (fabs r) 9.4e-116)
t_0
(- (- 1.5 (- t_0 (* 0.25 (* (* (* w w) (fabs r)) (fabs r)))))))))double code(double v, double w, double r) {
double t_0 = 2.0 / (fabs(r) * fabs(r));
double tmp;
if (fabs(r) <= 9.4e-116) {
tmp = t_0;
} else {
tmp = -(1.5 - (t_0 - (0.25 * (((w * w) * fabs(r)) * fabs(r)))));
}
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 = 2.0d0 / (abs(r) * abs(r))
if (abs(r) <= 9.4d-116) then
tmp = t_0
else
tmp = -(1.5d0 - (t_0 - (0.25d0 * (((w * w) * abs(r)) * abs(r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (Math.abs(r) * Math.abs(r));
double tmp;
if (Math.abs(r) <= 9.4e-116) {
tmp = t_0;
} else {
tmp = -(1.5 - (t_0 - (0.25 * (((w * w) * Math.abs(r)) * Math.abs(r)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (math.fabs(r) * math.fabs(r)) tmp = 0 if math.fabs(r) <= 9.4e-116: tmp = t_0 else: tmp = -(1.5 - (t_0 - (0.25 * (((w * w) * math.fabs(r)) * math.fabs(r))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(abs(r) * abs(r))) tmp = 0.0 if (abs(r) <= 9.4e-116) tmp = t_0; else tmp = Float64(-Float64(1.5 - Float64(t_0 - Float64(0.25 * Float64(Float64(Float64(w * w) * abs(r)) * abs(r)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (abs(r) * abs(r)); tmp = 0.0; if (abs(r) <= 9.4e-116) tmp = t_0; else tmp = -(1.5 - (t_0 - (0.25 * (((w * w) * abs(r)) * abs(r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 9.4e-116], t$95$0, (-N[(1.5 - N[(t$95$0 - N[(0.25 * N[(N[(N[(w * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
t_0 := \frac{2}{\left|r\right| \cdot \left|r\right|}\\
\mathbf{if}\;\left|r\right| \leq 9.4 \cdot 10^{-116}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-\left(1.5 - \left(t\_0 - 0.25 \cdot \left(\left(\left(w \cdot w\right) \cdot \left|r\right|\right) \cdot \left|r\right|\right)\right)\right)\\
\end{array}
if r < 9.39999999999999989e-116Initial program 84.3%
Taylor expanded in r around 0
lower-/.f64N/A
lower-pow.6444.7%
Applied rewrites44.7%
lift-pow.64N/A
pow2N/A
lift-*.f6444.7%
Applied rewrites44.7%
if 9.39999999999999989e-116 < r Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.9%
(FPCore (v w r) :precision binary64 (- (- 1.5 (/ 2.0 (pow r 2.0)))))
double code(double v, double w, double r) {
return -(1.5 - (2.0 / pow(r, 2.0)));
}
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 - (2.0d0 / (r ** 2.0d0)))
end function
public static double code(double v, double w, double r) {
return -(1.5 - (2.0 / Math.pow(r, 2.0)));
}
def code(v, w, r): return -(1.5 - (2.0 / math.pow(r, 2.0)))
function code(v, w, r) return Float64(-Float64(1.5 - Float64(2.0 / (r ^ 2.0)))) end
function tmp = code(v, w, r) tmp = -(1.5 - (2.0 / (r ^ 2.0))); end
code[v_, w_, r_] := (-N[(1.5 - N[(2.0 / N[Power[r, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
-\left(1.5 - \frac{2}{{r}^{2}}\right)
Initial program 84.3%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6484.3%
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2%
Applied rewrites87.2%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
Applied rewrites87.2%
Taylor expanded in w around 0
lower-/.f64N/A
lower-pow.6457.9%
Applied rewrites57.9%
(FPCore (v w r) :precision binary64 (- (- (/ 2.0 (* r r)) -3.0) 4.5))
double code(double v, double w, double r) {
return ((2.0 / (r * 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 = ((2.0d0 / (r * r)) - (-3.0d0)) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((2.0 / (r * r)) - -3.0) - 4.5;
}
def code(v, w, r): return ((2.0 / (r * r)) - -3.0) - 4.5
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) - -3.0) - 4.5) end
function tmp = code(v, w, r) tmp = ((2.0 / (r * r)) - -3.0) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - -3.0), $MachinePrecision] - 4.5), $MachinePrecision]
\left(\frac{2}{r \cdot r} - -3\right) - 4.5
Initial program 84.3%
Taylor expanded in v around 0
Applied rewrites77.5%
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
Applied rewrites82.6%
Taylor expanded in w around 0
Applied rewrites57.9%
(FPCore (v w r) :precision binary64 (/ 2.0 (* r r)))
double code(double v, double w, double r) {
return 2.0 / (r * 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 = 2.0d0 / (r * r)
end function
public static double code(double v, double w, double r) {
return 2.0 / (r * r);
}
def code(v, w, r): return 2.0 / (r * r)
function code(v, w, r) return Float64(2.0 / Float64(r * r)) end
function tmp = code(v, w, r) tmp = 2.0 / (r * r); end
code[v_, w_, r_] := N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]
\frac{2}{r \cdot r}
Initial program 84.3%
Taylor expanded in r around 0
lower-/.f64N/A
lower-pow.6444.7%
Applied rewrites44.7%
lift-pow.64N/A
pow2N/A
lift-*.f6444.7%
Applied rewrites44.7%
herbie shell --seed 2025183
(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))