
(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 13 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 (- (+ (/ 2.0 (* r r)) 3.0) (fma (* (fma -2.0 v 3.0) 0.125) (/ (* (* r w) (* r w)) (- 1.0 v)) 4.5)))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 3.0) - fma((fma(-2.0, v, 3.0) * 0.125), (((r * w) * (r * w)) / (1.0 - v)), 4.5);
}
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - fma(Float64(fma(-2.0, v, 3.0) * 0.125), Float64(Float64(Float64(r * w) * Float64(r * w)) / Float64(1.0 - v)), 4.5)) end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + 3\right) - \mathsf{fma}\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right)
\end{array}
Initial program 84.6%
Applied rewrites99.7%
(FPCore (v w r)
:precision binary64
(if (<= r 35000000.0)
(- (/ 2.0 (* r r)) (fma 0.25 (* (* (* w r) r) w) 1.5))
(-
3.0
(fma (fma v -2.0 3.0) (* 0.125 (* (* (* w r) w) (/ r (- 1.0 v)))) 4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 35000000.0) {
tmp = (2.0 / (r * r)) - fma(0.25, (((w * r) * r) * w), 1.5);
} else {
tmp = 3.0 - fma(fma(v, -2.0, 3.0), (0.125 * (((w * r) * w) * (r / (1.0 - v)))), 4.5);
}
return tmp;
}
function code(v, w, r) tmp = 0.0 if (r <= 35000000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) - fma(0.25, Float64(Float64(Float64(w * r) * r) * w), 1.5)); else tmp = Float64(3.0 - fma(fma(v, -2.0, 3.0), Float64(0.125 * Float64(Float64(Float64(w * r) * w) * Float64(r / Float64(1.0 - v)))), 4.5)); end return tmp end
code[v_, w_, r_] := If[LessEqual[r, 35000000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - N[(0.25 * N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(N[(v * -2.0 + 3.0), $MachinePrecision] * N[(0.125 * N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 35000000:\\
\;\;\;\;\frac{2}{r \cdot r} - \mathsf{fma}\left(0.25, \left(\left(w \cdot r\right) \cdot r\right) \cdot w, 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \mathsf{fma}\left(\mathsf{fma}\left(v, -2, 3\right), 0.125 \cdot \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot \frac{r}{1 - v}\right), 4.5\right)\\
\end{array}
\end{array}
if r < 3.5e7Initial program 83.1%
Applied rewrites99.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6485.2
Applied rewrites85.2%
Taylor expanded in v around inf
Applied rewrites93.6%
if 3.5e7 < r Initial program 89.2%
Taylor expanded in r around inf
Applied rewrites89.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6493.7
Applied rewrites93.7%
Applied rewrites99.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1
(-
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5))
(t_2 (* (* (* w r) w) r)))
(if (<= t_1 -2e+272)
(- (- 3.0 (* t_2 0.25)) 4.5)
(if (<= t_1 4e+74) (- t_0 (fma t_2 0.375 1.5)) t_0))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double t_2 = ((w * r) * w) * r;
double tmp;
if (t_1 <= -2e+272) {
tmp = (3.0 - (t_2 * 0.25)) - 4.5;
} else if (t_1 <= 4e+74) {
tmp = t_0 - fma(t_2, 0.375, 1.5);
} else {
tmp = t_0;
}
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(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) t_2 = Float64(Float64(Float64(w * r) * w) * r) tmp = 0.0 if (t_1 <= -2e+272) tmp = Float64(Float64(3.0 - Float64(t_2 * 0.25)) - 4.5); elseif (t_1 <= 4e+74) tmp = Float64(t_0 - fma(t_2, 0.375, 1.5)); else tmp = t_0; 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[(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$2 = N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+272], N[(N[(3.0 - N[(t$95$2 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, 4e+74], N[(t$95$0 - N[(t$95$2 * 0.375 + 1.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \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\\
t_2 := \left(\left(w \cdot r\right) \cdot w\right) \cdot r\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+272}:\\
\;\;\;\;\left(3 - t\_2 \cdot 0.25\right) - 4.5\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+74}:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(t\_2, 0.375, 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)) < -2.0000000000000001e272Initial program 83.7%
Taylor expanded in r around inf
Applied rewrites83.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.7
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6489.6
Applied rewrites89.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
pow2N/A
unpow-prod-downN/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6490.3
Applied rewrites90.3%
if -2.0000000000000001e272 < (-.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)) < 3.99999999999999981e74Initial program 88.6%
Applied rewrites99.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6488.6
Applied rewrites88.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in v around 0
Applied rewrites86.1%
if 3.99999999999999981e74 < (-.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 82.6%
Taylor expanded in r around 0
pow2N/A
lift-/.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1
(-
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5))
(t_2 (* (* (* w r) w) r)))
(if (<= t_1 -2e+272)
(- (- 3.0 (* t_2 0.25)) 4.5)
(if (<= t_1 -1.5)
(- (- 3.0 (* t_2 0.375)) 4.5)
(- t_0 (fma (* (* (* r r) 0.375) w) w 1.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double t_2 = ((w * r) * w) * r;
double tmp;
if (t_1 <= -2e+272) {
tmp = (3.0 - (t_2 * 0.25)) - 4.5;
} else if (t_1 <= -1.5) {
tmp = (3.0 - (t_2 * 0.375)) - 4.5;
} else {
tmp = t_0 - fma((((r * r) * 0.375) * w), w, 1.5);
}
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(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) t_2 = Float64(Float64(Float64(w * r) * w) * r) tmp = 0.0 if (t_1 <= -2e+272) tmp = Float64(Float64(3.0 - Float64(t_2 * 0.25)) - 4.5); elseif (t_1 <= -1.5) tmp = Float64(Float64(3.0 - Float64(t_2 * 0.375)) - 4.5); else tmp = Float64(t_0 - fma(Float64(Float64(Float64(r * r) * 0.375) * w), w, 1.5)); 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[(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$2 = N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+272], N[(N[(3.0 - N[(t$95$2 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, -1.5], N[(N[(3.0 - N[(t$95$2 * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 - N[(N[(N[(N[(r * r), $MachinePrecision] * 0.375), $MachinePrecision] * w), $MachinePrecision] * w + 1.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \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\\
t_2 := \left(\left(w \cdot r\right) \cdot w\right) \cdot r\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+272}:\\
\;\;\;\;\left(3 - t\_2 \cdot 0.25\right) - 4.5\\
\mathbf{elif}\;t\_1 \leq -1.5:\\
\;\;\;\;\left(3 - t\_2 \cdot 0.375\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(\left(\left(r \cdot r\right) \cdot 0.375\right) \cdot w, w, 1.5\right)\\
\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)) < -2.0000000000000001e272Initial program 83.7%
Taylor expanded in r around inf
Applied rewrites83.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.7
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6489.6
Applied rewrites89.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
pow2N/A
unpow-prod-downN/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6490.3
Applied rewrites90.3%
if -2.0000000000000001e272 < (-.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 86.7%
Taylor expanded in r around inf
Applied rewrites86.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.4
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6488.7
Applied rewrites88.7%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6471.4
Applied rewrites71.4%
Taylor expanded in v around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6483.6
Applied rewrites83.6%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.1%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.2
Applied rewrites84.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6499.8
Applied rewrites99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1
(-
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5))
(t_2 (* (* (* w r) w) r)))
(if (<= t_1 -2e+272)
(- (- 3.0 (* t_2 0.25)) 4.5)
(if (<= t_1 -1.5) (- (- 3.0 (* t_2 0.375)) 4.5) (- t_0 1.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double t_2 = ((w * r) * w) * r;
double tmp;
if (t_1 <= -2e+272) {
tmp = (3.0 - (t_2 * 0.25)) - 4.5;
} else if (t_1 <= -1.5) {
tmp = (3.0 - (t_2 * 0.375)) - 4.5;
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = ((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
t_2 = ((w * r) * w) * r
if (t_1 <= (-2d+272)) then
tmp = (3.0d0 - (t_2 * 0.25d0)) - 4.5d0
else if (t_1 <= (-1.5d0)) then
tmp = (3.0d0 - (t_2 * 0.375d0)) - 4.5d0
else
tmp = t_0 - 1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double t_2 = ((w * r) * w) * r;
double tmp;
if (t_1 <= -2e+272) {
tmp = (3.0 - (t_2 * 0.25)) - 4.5;
} else if (t_1 <= -1.5) {
tmp = (3.0 - (t_2 * 0.375)) - 4.5;
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5 t_2 = ((w * r) * w) * r tmp = 0 if t_1 <= -2e+272: tmp = (3.0 - (t_2 * 0.25)) - 4.5 elif t_1 <= -1.5: tmp = (3.0 - (t_2 * 0.375)) - 4.5 else: tmp = t_0 - 1.5 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(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) t_2 = Float64(Float64(Float64(w * r) * w) * r) tmp = 0.0 if (t_1 <= -2e+272) tmp = Float64(Float64(3.0 - Float64(t_2 * 0.25)) - 4.5); elseif (t_1 <= -1.5) tmp = Float64(Float64(3.0 - Float64(t_2 * 0.375)) - 4.5); else tmp = Float64(t_0 - 1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; t_2 = ((w * r) * w) * r; tmp = 0.0; if (t_1 <= -2e+272) tmp = (3.0 - (t_2 * 0.25)) - 4.5; elseif (t_1 <= -1.5) tmp = (3.0 - (t_2 * 0.375)) - 4.5; else tmp = t_0 - 1.5; end tmp_2 = 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[(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$2 = N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+272], N[(N[(3.0 - N[(t$95$2 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, -1.5], N[(N[(3.0 - N[(t$95$2 * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \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\\
t_2 := \left(\left(w \cdot r\right) \cdot w\right) \cdot r\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+272}:\\
\;\;\;\;\left(3 - t\_2 \cdot 0.25\right) - 4.5\\
\mathbf{elif}\;t\_1 \leq -1.5:\\
\;\;\;\;\left(3 - t\_2 \cdot 0.375\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -2.0000000000000001e272Initial program 83.7%
Taylor expanded in r around inf
Applied rewrites83.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.7
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6489.6
Applied rewrites89.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
pow2N/A
unpow-prod-downN/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6490.3
Applied rewrites90.3%
if -2.0000000000000001e272 < (-.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 86.7%
Taylor expanded in r around inf
Applied rewrites86.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.4
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6488.7
Applied rewrites88.7%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6471.4
Applied rewrites71.4%
Taylor expanded in v around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6483.6
Applied rewrites83.6%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.1%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f6499.7
Applied rewrites99.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)
-2e+256)
(- (- 3.0 (* (* (* (* w r) w) r) 0.25)) 4.5)
(- t_0 (fma (* (* (* w r) r) w) 0.375 1.5)))))
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) <= -2e+256) {
tmp = (3.0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else {
tmp = t_0 - fma((((w * r) * r) * w), 0.375, 1.5);
}
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) <= -2e+256) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5); else tmp = Float64(t_0 - fma(Float64(Float64(Float64(w * r) * r) * w), 0.375, 1.5)); 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], -2e+256], N[(N[(3.0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 - N[(N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision] * 0.375 + 1.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\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 -2 \cdot 10^{+256}:\\
\;\;\;\;\left(3 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w, 0.375, 1.5\right)\\
\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)) < -2.0000000000000001e256Initial program 83.9%
Taylor expanded in r around inf
Applied rewrites83.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.9
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6484.7
Applied rewrites84.7%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6489.0
Applied rewrites89.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
pow2N/A
unpow-prod-downN/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6489.8
Applied rewrites89.8%
if -2.0000000000000001e256 < (-.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.0%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6475.0
Applied rewrites75.0%
Applied rewrites92.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1
(-
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)))
(if (<= t_1 -2e+256)
(- (- 3.0 (* (* (* (* w r) w) r) 0.25)) 4.5)
(if (<= t_1 -1.5)
(- (- 3.0 (* (* (* (* w r) r) w) 0.375)) 4.5)
(- t_0 1.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -2e+256) {
tmp = (3.0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else if (t_1 <= -1.5) {
tmp = (3.0 - ((((w * r) * r) * w) * 0.375)) - 4.5;
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = ((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
if (t_1 <= (-2d+256)) then
tmp = (3.0d0 - ((((w * r) * w) * r) * 0.25d0)) - 4.5d0
else if (t_1 <= (-1.5d0)) then
tmp = (3.0d0 - ((((w * r) * r) * w) * 0.375d0)) - 4.5d0
else
tmp = t_0 - 1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -2e+256) {
tmp = (3.0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else if (t_1 <= -1.5) {
tmp = (3.0 - ((((w * r) * r) * w) * 0.375)) - 4.5;
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5 tmp = 0 if t_1 <= -2e+256: tmp = (3.0 - ((((w * r) * w) * r) * 0.25)) - 4.5 elif t_1 <= -1.5: tmp = (3.0 - ((((w * r) * r) * w) * 0.375)) - 4.5 else: tmp = t_0 - 1.5 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(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_1 <= -2e+256) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5); elseif (t_1 <= -1.5) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(w * r) * r) * w) * 0.375)) - 4.5); else tmp = Float64(t_0 - 1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_1 <= -2e+256) tmp = (3.0 - ((((w * r) * w) * r) * 0.25)) - 4.5; elseif (t_1 <= -1.5) tmp = (3.0 - ((((w * r) * r) * w) * 0.375)) - 4.5; else tmp = t_0 - 1.5; end tmp_2 = 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[(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$1, -2e+256], N[(N[(3.0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, -1.5], N[(N[(3.0 - N[(N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \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\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+256}:\\
\;\;\;\;\left(3 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\right) - 4.5\\
\mathbf{elif}\;t\_1 \leq -1.5:\\
\;\;\;\;\left(3 - \left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w\right) \cdot 0.375\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -2.0000000000000001e256Initial program 83.9%
Taylor expanded in r around inf
Applied rewrites83.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.9
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6484.7
Applied rewrites84.7%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6489.0
Applied rewrites89.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
pow2N/A
unpow-prod-downN/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6489.8
Applied rewrites89.8%
if -2.0000000000000001e256 < (-.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 86.6%
Taylor expanded in r around inf
Applied rewrites86.2%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.2
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6489.0
Applied rewrites89.0%
Taylor expanded in v around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6477.6
Applied rewrites77.6%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.1%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* w r) r) w))
(t_1 (/ 2.0 (* r r)))
(t_2
(-
(-
(+ 3.0 t_1)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)))
(if (<= t_2 (- INFINITY))
(- (- 3.0 (* 0.25 t_0)) 4.5)
(if (<= t_2 -1.5) (- (- 3.0 (* t_0 0.375)) 4.5) (- t_1 1.5)))))
double code(double v, double w, double r) {
double t_0 = ((w * r) * r) * w;
double t_1 = 2.0 / (r * r);
double t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (3.0 - (0.25 * t_0)) - 4.5;
} else if (t_2 <= -1.5) {
tmp = (3.0 - (t_0 * 0.375)) - 4.5;
} else {
tmp = t_1 - 1.5;
}
return tmp;
}
public static double code(double v, double w, double r) {
double t_0 = ((w * r) * r) * w;
double t_1 = 2.0 / (r * r);
double t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (3.0 - (0.25 * t_0)) - 4.5;
} else if (t_2 <= -1.5) {
tmp = (3.0 - (t_0 * 0.375)) - 4.5;
} else {
tmp = t_1 - 1.5;
}
return tmp;
}
def code(v, w, r): t_0 = ((w * r) * r) * w t_1 = 2.0 / (r * r) t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5 tmp = 0 if t_2 <= -math.inf: tmp = (3.0 - (0.25 * t_0)) - 4.5 elif t_2 <= -1.5: tmp = (3.0 - (t_0 * 0.375)) - 4.5 else: tmp = t_1 - 1.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(w * r) * r) * w) t_1 = Float64(2.0 / Float64(r * r)) t_2 = Float64(Float64(Float64(3.0 + t_1) - 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_2 <= Float64(-Inf)) tmp = Float64(Float64(3.0 - Float64(0.25 * t_0)) - 4.5); elseif (t_2 <= -1.5) tmp = Float64(Float64(3.0 - Float64(t_0 * 0.375)) - 4.5); else tmp = Float64(t_1 - 1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((w * r) * r) * w; t_1 = 2.0 / (r * r); t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_2 <= -Inf) tmp = (3.0 - (0.25 * t_0)) - 4.5; elseif (t_2 <= -1.5) tmp = (3.0 - (t_0 * 0.375)) - 4.5; else tmp = t_1 - 1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(3.0 + t$95$1), $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$2, (-Infinity)], N[(N[(3.0 - N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$2, -1.5], N[(N[(3.0 - N[(t$95$0 * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$1 - 1.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(w \cdot r\right) \cdot r\right) \cdot w\\
t_1 := \frac{2}{r \cdot r}\\
t_2 := \left(\left(3 + t\_1\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\_2 \leq -\infty:\\
\;\;\;\;\left(3 - 0.25 \cdot t\_0\right) - 4.5\\
\mathbf{elif}\;t\_2 \leq -1.5:\\
\;\;\;\;\left(3 - t\_0 \cdot 0.375\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_1 - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -inf.0Initial program 83.3%
Taylor expanded in r around inf
Applied rewrites83.3%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.3
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6485.5
Applied rewrites85.5%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6491.5
Applied rewrites91.5%
if -inf.0 < (-.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 87.2%
Taylor expanded in r around inf
Applied rewrites86.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.9
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6487.6
Applied rewrites87.6%
Taylor expanded in v around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6476.6
Applied rewrites76.6%
if -1.5 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.1%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* w r) r) w))
(t_1 (/ 2.0 (* r r)))
(t_2
(-
(-
(+ 3.0 t_1)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)))
(if (<= t_2 (- INFINITY))
(- (- 3.0 (* 0.25 t_0)) 4.5)
(if (<= t_2 -5e+82) (* -0.375 t_0) (- t_1 1.5)))))
double code(double v, double w, double r) {
double t_0 = ((w * r) * r) * w;
double t_1 = 2.0 / (r * r);
double t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (3.0 - (0.25 * t_0)) - 4.5;
} else if (t_2 <= -5e+82) {
tmp = -0.375 * t_0;
} else {
tmp = t_1 - 1.5;
}
return tmp;
}
public static double code(double v, double w, double r) {
double t_0 = ((w * r) * r) * w;
double t_1 = 2.0 / (r * r);
double t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (3.0 - (0.25 * t_0)) - 4.5;
} else if (t_2 <= -5e+82) {
tmp = -0.375 * t_0;
} else {
tmp = t_1 - 1.5;
}
return tmp;
}
def code(v, w, r): t_0 = ((w * r) * r) * w t_1 = 2.0 / (r * r) t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5 tmp = 0 if t_2 <= -math.inf: tmp = (3.0 - (0.25 * t_0)) - 4.5 elif t_2 <= -5e+82: tmp = -0.375 * t_0 else: tmp = t_1 - 1.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(w * r) * r) * w) t_1 = Float64(2.0 / Float64(r * r)) t_2 = Float64(Float64(Float64(3.0 + t_1) - 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_2 <= Float64(-Inf)) tmp = Float64(Float64(3.0 - Float64(0.25 * t_0)) - 4.5); elseif (t_2 <= -5e+82) tmp = Float64(-0.375 * t_0); else tmp = Float64(t_1 - 1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((w * r) * r) * w; t_1 = 2.0 / (r * r); t_2 = ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_2 <= -Inf) tmp = (3.0 - (0.25 * t_0)) - 4.5; elseif (t_2 <= -5e+82) tmp = -0.375 * t_0; else tmp = t_1 - 1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(3.0 + t$95$1), $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$2, (-Infinity)], N[(N[(3.0 - N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$2, -5e+82], N[(-0.375 * t$95$0), $MachinePrecision], N[(t$95$1 - 1.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(w \cdot r\right) \cdot r\right) \cdot w\\
t_1 := \frac{2}{r \cdot r}\\
t_2 := \left(\left(3 + t\_1\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\_2 \leq -\infty:\\
\;\;\;\;\left(3 - 0.25 \cdot t\_0\right) - 4.5\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+82}:\\
\;\;\;\;-0.375 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1 - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -inf.0Initial program 83.3%
Taylor expanded in r around inf
Applied rewrites83.3%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.3
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6485.5
Applied rewrites85.5%
Taylor expanded in v around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6491.5
Applied rewrites91.5%
if -inf.0 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -5.00000000000000015e82Initial program 98.7%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6451.6
Applied rewrites51.6%
Taylor expanded in w around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6463.1
Applied rewrites63.1%
if -5.00000000000000015e82 < (-.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 83.8%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f6491.5
Applied rewrites91.5%
(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)
-5e+82)
(* -0.375 (* (* (* w r) r) w))
(- t_0 1.5))))
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) <= -5e+82) {
tmp = -0.375 * (((w * r) * r) * w);
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-5d+82)) then
tmp = (-0.375d0) * (((w * r) * r) * w)
else
tmp = t_0 - 1.5d0
end if
code = tmp
end function
public static 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) <= -5e+82) {
tmp = -0.375 * (((w * r) * r) * w);
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -5e+82: tmp = -0.375 * (((w * r) * r) * w) else: tmp = t_0 - 1.5 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) <= -5e+82) tmp = Float64(-0.375 * Float64(Float64(Float64(w * r) * r) * w)); else tmp = Float64(t_0 - 1.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -5e+82) tmp = -0.375 * (((w * r) * r) * w); else tmp = t_0 - 1.5; end tmp_2 = 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], -5e+82], N[(-0.375 * N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\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 -5 \cdot 10^{+82}:\\
\;\;\;\;-0.375 \cdot \left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - 1.5\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -5.00000000000000015e82Initial program 85.7%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6479.4
Applied rewrites79.4%
Taylor expanded in w around inf
lower-*.f64N/A
pow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6482.7
Applied rewrites82.7%
if -5.00000000000000015e82 < (-.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 83.8%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f6491.5
Applied rewrites91.5%
(FPCore (v w r) :precision binary64 (- (/ 2.0 (* r r)) 1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) - 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 = (2.0d0 / (r * r)) - 1.5d0
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) - 1.5;
}
def code(v, w, r): return (2.0 / (r * r)) - 1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) - 1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) - 1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} - 1.5
\end{array}
Initial program 84.6%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
pow2N/A
lift-/.f64N/A
lift-*.f6457.4
Applied rewrites57.4%
(FPCore (v w r) :precision binary64 (if (<= r 1.15) (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.15) {
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 <= 1.15d0) 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 <= 1.15) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.15: tmp = 2.0 / (r * r) else: tmp = -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.15) 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 <= 1.15) tmp = 2.0 / (r * r); else tmp = -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.15], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.15:\\
\;\;\;\;\frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 1.1499999999999999Initial program 83.0%
Taylor expanded in r around 0
pow2N/A
lift-/.f64N/A
lift-*.f6458.5
Applied rewrites58.5%
if 1.1499999999999999 < r Initial program 89.1%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6419.4
Applied rewrites19.4%
Taylor expanded in r around inf
Applied rewrites26.4%
(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 84.6%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6453.6
Applied rewrites53.6%
Taylor expanded in r around inf
Applied rewrites14.2%
herbie shell --seed 2025120
(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))