
(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 14 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 (- (+ v v) 3.0))
(t_1 (+ 3.0 (/ 2.0 (* (fabs r) (fabs r)))))
(t_2 (* w (fabs r))))
(if (<= (fabs r) 1e+144)
(-
(- t_1 (* (* (* (/ -0.125 (- 1.0 v)) t_0) w) (* t_2 (fabs r))))
4.5)
(-
(- t_1 (* (* (* t_2 w) (fabs r)) (/ (* t_0 0.125) (- v 1.0))))
4.5))))double code(double v, double w, double r) {
double t_0 = (v + v) - 3.0;
double t_1 = 3.0 + (2.0 / (fabs(r) * fabs(r)));
double t_2 = w * fabs(r);
double tmp;
if (fabs(r) <= 1e+144) {
tmp = (t_1 - ((((-0.125 / (1.0 - v)) * t_0) * w) * (t_2 * fabs(r)))) - 4.5;
} else {
tmp = (t_1 - (((t_2 * w) * fabs(r)) * ((t_0 * 0.125) / (v - 1.0)))) - 4.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (v + v) - 3.0d0
t_1 = 3.0d0 + (2.0d0 / (abs(r) * abs(r)))
t_2 = w * abs(r)
if (abs(r) <= 1d+144) then
tmp = (t_1 - (((((-0.125d0) / (1.0d0 - v)) * t_0) * w) * (t_2 * abs(r)))) - 4.5d0
else
tmp = (t_1 - (((t_2 * w) * abs(r)) * ((t_0 * 0.125d0) / (v - 1.0d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (v + v) - 3.0;
double t_1 = 3.0 + (2.0 / (Math.abs(r) * Math.abs(r)));
double t_2 = w * Math.abs(r);
double tmp;
if (Math.abs(r) <= 1e+144) {
tmp = (t_1 - ((((-0.125 / (1.0 - v)) * t_0) * w) * (t_2 * Math.abs(r)))) - 4.5;
} else {
tmp = (t_1 - (((t_2 * w) * Math.abs(r)) * ((t_0 * 0.125) / (v - 1.0)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (v + v) - 3.0 t_1 = 3.0 + (2.0 / (math.fabs(r) * math.fabs(r))) t_2 = w * math.fabs(r) tmp = 0 if math.fabs(r) <= 1e+144: tmp = (t_1 - ((((-0.125 / (1.0 - v)) * t_0) * w) * (t_2 * math.fabs(r)))) - 4.5 else: tmp = (t_1 - (((t_2 * w) * math.fabs(r)) * ((t_0 * 0.125) / (v - 1.0)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(v + v) - 3.0) t_1 = Float64(3.0 + Float64(2.0 / Float64(abs(r) * abs(r)))) t_2 = Float64(w * abs(r)) tmp = 0.0 if (abs(r) <= 1e+144) tmp = Float64(Float64(t_1 - Float64(Float64(Float64(Float64(-0.125 / Float64(1.0 - v)) * t_0) * w) * Float64(t_2 * abs(r)))) - 4.5); else tmp = Float64(Float64(t_1 - Float64(Float64(Float64(t_2 * w) * abs(r)) * Float64(Float64(t_0 * 0.125) / Float64(v - 1.0)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (v + v) - 3.0; t_1 = 3.0 + (2.0 / (abs(r) * abs(r))); t_2 = w * abs(r); tmp = 0.0; if (abs(r) <= 1e+144) tmp = (t_1 - ((((-0.125 / (1.0 - v)) * t_0) * w) * (t_2 * abs(r)))) - 4.5; else tmp = (t_1 - (((t_2 * w) * abs(r)) * ((t_0 * 0.125) / (v - 1.0)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(v + v), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(w * N[Abs[r], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 1e+144], N[(N[(t$95$1 - N[(N[(N[(N[(-0.125 / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * w), $MachinePrecision] * N[(t$95$2 * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(N[(N[(t$95$2 * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(v + v\right) - 3\\
t_1 := 3 + \frac{2}{\left|r\right| \cdot \left|r\right|}\\
t_2 := w \cdot \left|r\right|\\
\mathbf{if}\;\left|r\right| \leq 10^{+144}:\\
\;\;\;\;\left(t\_1 - \left(\left(\frac{-0.125}{1 - v} \cdot t\_0\right) \cdot w\right) \cdot \left(t\_2 \cdot \left|r\right|\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \left(\left(t\_2 \cdot w\right) \cdot \left|r\right|\right) \cdot \frac{t\_0 \cdot 0.125}{v - 1}\right) - 4.5\\
\end{array}
if r < 1e144Initial program 84.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.5%
Applied rewrites94.5%
Applied rewrites97.3%
if 1e144 < r Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
(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) 1.45e-66)
(- (- t_1 (/ (* (* 0.375 t_0) t_0) 1.0)) 4.5)
(-
(-
t_1
(*
(* (* t_0 w) (fabs r))
(/ (* (- (+ v v) 3.0) 0.125) (- v 1.0))))
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) <= 1.45e-66) {
tmp = (t_1 - (((0.375 * t_0) * t_0) / 1.0)) - 4.5;
} else {
tmp = (t_1 - (((t_0 * w) * fabs(r)) * ((((v + v) - 3.0) * 0.125) / (v - 1.0)))) - 4.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = w * abs(r)
t_1 = 3.0d0 + (2.0d0 / (abs(r) * abs(r)))
if (abs(r) <= 1.45d-66) then
tmp = (t_1 - (((0.375d0 * t_0) * t_0) / 1.0d0)) - 4.5d0
else
tmp = (t_1 - (((t_0 * w) * abs(r)) * ((((v + v) - 3.0d0) * 0.125d0) / (v - 1.0d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = w * Math.abs(r);
double t_1 = 3.0 + (2.0 / (Math.abs(r) * Math.abs(r)));
double tmp;
if (Math.abs(r) <= 1.45e-66) {
tmp = (t_1 - (((0.375 * t_0) * t_0) / 1.0)) - 4.5;
} else {
tmp = (t_1 - (((t_0 * w) * Math.abs(r)) * ((((v + v) - 3.0) * 0.125) / (v - 1.0)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = w * math.fabs(r) t_1 = 3.0 + (2.0 / (math.fabs(r) * math.fabs(r))) tmp = 0 if math.fabs(r) <= 1.45e-66: tmp = (t_1 - (((0.375 * t_0) * t_0) / 1.0)) - 4.5 else: tmp = (t_1 - (((t_0 * w) * math.fabs(r)) * ((((v + v) - 3.0) * 0.125) / (v - 1.0)))) - 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) <= 1.45e-66) tmp = Float64(Float64(t_1 - Float64(Float64(Float64(0.375 * t_0) * t_0) / 1.0)) - 4.5); else tmp = Float64(Float64(t_1 - Float64(Float64(Float64(t_0 * w) * abs(r)) * Float64(Float64(Float64(Float64(v + v) - 3.0) * 0.125) / Float64(v - 1.0)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = w * abs(r); t_1 = 3.0 + (2.0 / (abs(r) * abs(r))); tmp = 0.0; if (abs(r) <= 1.45e-66) tmp = (t_1 - (((0.375 * t_0) * t_0) / 1.0)) - 4.5; else tmp = (t_1 - (((t_0 * w) * abs(r)) * ((((v + v) - 3.0) * 0.125) / (v - 1.0)))) - 4.5; end tmp_2 = 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], 1.45e-66], N[(N[(t$95$1 - N[(N[(N[(0.375 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(N[(N[(t$95$0 * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(v + v), $MachinePrecision] - 3.0), $MachinePrecision] * 0.125), $MachinePrecision] / N[(v - 1.0), $MachinePrecision]), $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 1.45 \cdot 10^{-66}:\\
\;\;\;\;\left(t\_1 - \frac{\left(0.375 \cdot t\_0\right) \cdot t\_0}{1}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \left(\left(t\_0 \cdot w\right) \cdot \left|r\right|\right) \cdot \frac{\left(\left(v + v\right) - 3\right) \cdot 0.125}{v - 1}\right) - 4.5\\
\end{array}
if r < 1.4500000000000001e-66Initial program 84.1%
Taylor expanded in v around 0
Applied rewrites76.5%
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-*.f6485.0%
Applied rewrites85.0%
Taylor expanded in v around 0
Applied rewrites93.0%
if 1.4500000000000001e-66 < r Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1 (- (- (+ 3.0 t_0) (* (* (* (* w r) w) r) 0.25)) 4.5)))
(if (<= v -19000000000000.0)
t_1
(if (<= v 1.5e-12)
(- (- 1.5 (- t_0 (/ (* (* (* 0.375 r) w) (* w r)) (- 1.0 v)))))
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 * r) * w) * r) * 0.25)) - 4.5;
double tmp;
if (v <= -19000000000000.0) {
tmp = t_1;
} else if (v <= 1.5e-12) {
tmp = -(1.5 - (t_0 - ((((0.375 * r) * w) * (w * r)) / (1.0 - v))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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) - ((((w * r) * w) * r) * 0.25d0)) - 4.5d0
if (v <= (-19000000000000.0d0)) then
tmp = t_1
else if (v <= 1.5d-12) then
tmp = -(1.5d0 - (t_0 - ((((0.375d0 * r) * w) * (w * r)) / (1.0d0 - v))))
else
tmp = t_1
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) - ((((w * r) * w) * r) * 0.25)) - 4.5;
double tmp;
if (v <= -19000000000000.0) {
tmp = t_1;
} else if (v <= 1.5e-12) {
tmp = -(1.5 - (t_0 - ((((0.375 * r) * w) * (w * r)) / (1.0 - v))));
} else {
tmp = t_1;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = ((3.0 + t_0) - ((((w * r) * w) * r) * 0.25)) - 4.5 tmp = 0 if v <= -19000000000000.0: tmp = t_1 elif v <= 1.5e-12: tmp = -(1.5 - (t_0 - ((((0.375 * r) * w) * (w * r)) / (1.0 - v)))) 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(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5) tmp = 0.0 if (v <= -19000000000000.0) tmp = t_1; elseif (v <= 1.5e-12) tmp = Float64(-Float64(1.5 - Float64(t_0 - Float64(Float64(Float64(Float64(0.375 * r) * w) * Float64(w * r)) / Float64(1.0 - v))))); else tmp = t_1; end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = ((3.0 + t_0) - ((((w * r) * w) * r) * 0.25)) - 4.5; tmp = 0.0; if (v <= -19000000000000.0) tmp = t_1; elseif (v <= 1.5e-12) tmp = -(1.5 - (t_0 - ((((0.375 * r) * w) * (w * r)) / (1.0 - v)))); else tmp = t_1; 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[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -19000000000000.0], t$95$1, If[LessEqual[v, 1.5e-12], (-N[(1.5 - N[(t$95$0 - N[(N[(N[(N[(0.375 * r), $MachinePrecision] * w), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), t$95$1]]]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(\left(3 + t\_0\right) - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\right) - 4.5\\
\mathbf{if}\;v \leq -19000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;-\left(1.5 - \left(t\_0 - \frac{\left(\left(0.375 \cdot r\right) \cdot w\right) \cdot \left(w \cdot r\right)}{1 - v}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if v < -1.9e13 or 1.5000000000000001e-12 < v Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
if -1.9e13 < v < 1.5000000000000001e-12Initial program 84.1%
Taylor expanded in v around 0
Applied rewrites76.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6476.5%
Applied rewrites76.5%
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
metadata-evalN/A
Applied rewrites85.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r))))
(t_1 (- (- t_0 (* (* (* (* w r) w) r) 0.25)) 4.5)))
(if (<= v -7.5e+16)
t_1
(if (<= v 1.5e-12)
(- (- t_0 (/ (* (* 0.375 (* w r)) (* w r)) 1.0)) 4.5)
t_1))))double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
double tmp;
if (v <= -7.5e+16) {
tmp = t_1;
} else if (v <= 1.5e-12) {
tmp = (t_0 - (((0.375 * (w * r)) * (w * r)) / 1.0)) - 4.5;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 = 3.0d0 + (2.0d0 / (r * r))
t_1 = (t_0 - ((((w * r) * w) * r) * 0.25d0)) - 4.5d0
if (v <= (-7.5d+16)) then
tmp = t_1
else if (v <= 1.5d-12) then
tmp = (t_0 - (((0.375d0 * (w * r)) * (w * r)) / 1.0d0)) - 4.5d0
else
tmp = t_1
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 t_1 = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
double tmp;
if (v <= -7.5e+16) {
tmp = t_1;
} else if (v <= 1.5e-12) {
tmp = (t_0 - (((0.375 * (w * r)) * (w * r)) / 1.0)) - 4.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) t_1 = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5 tmp = 0 if v <= -7.5e+16: tmp = t_1 elif v <= 1.5e-12: tmp = (t_0 - (((0.375 * (w * r)) * (w * r)) / 1.0)) - 4.5 else: tmp = t_1 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) t_1 = Float64(Float64(t_0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5) tmp = 0.0 if (v <= -7.5e+16) tmp = t_1; elseif (v <= 1.5e-12) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(0.375 * Float64(w * r)) * Float64(w * r)) / 1.0)) - 4.5); else tmp = t_1; end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); t_1 = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5; tmp = 0.0; if (v <= -7.5e+16) tmp = t_1; elseif (v <= 1.5e-12) tmp = (t_0 - (((0.375 * (w * r)) * (w * r)) / 1.0)) - 4.5; else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(t$95$0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -7.5e+16], t$95$1, If[LessEqual[v, 1.5e-12], N[(N[(t$95$0 - N[(N[(N[(0.375 * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
t_1 := \left(t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\right) - 4.5\\
\mathbf{if}\;v \leq -7.5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;\left(t\_0 - \frac{\left(0.375 \cdot \left(w \cdot r\right)\right) \cdot \left(w \cdot r\right)}{1}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if v < -7.5e16 or 1.5000000000000001e-12 < v Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
if -7.5e16 < v < 1.5000000000000001e-12Initial program 84.1%
Taylor expanded in v around 0
Applied rewrites76.5%
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-*.f6485.0%
Applied rewrites85.0%
Taylor expanded in v around 0
Applied rewrites93.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<=
(-
(-
t_0
(/
(* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r))
(- 1.0 v)))
4.5)
(- INFINITY))
(- (- t_0 (* (* (* (* w r) w) r) 0.25)) 4.5)
(-
(-
t_0
(/ (* (* (+ 0.375 (* -0.25 v)) (* w r)) (* w r)) (- 1.0 v)))
4.5))))double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -((double) INFINITY)) {
tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else {
tmp = (t_0 - ((((0.375 + (-0.25 * v)) * (w * r)) * (w * r)) / (1.0 - v))) - 4.5;
}
return tmp;
}
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -Double.POSITIVE_INFINITY) {
tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else {
tmp = (t_0 - ((((0.375 + (-0.25 * v)) * (w * r)) * (w * r)) / (1.0 - v))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if ((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -math.inf: tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5 else: tmp = (t_0 - ((((0.375 + (-0.25 * v)) * (w * r)) * (w * r)) / (1.0 - v))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (Float64(Float64(t_0 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= Float64(-Inf)) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(Float64(Float64(0.375 + Float64(-0.25 * v)) * Float64(w * r)) * Float64(w * r)) / Float64(1.0 - v))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -Inf) tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5; else tmp = (t_0 - ((((0.375 + (-0.25 * v)) * (w * r)) * (w * r)) / (1.0 - v))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], (-Infinity)], N[(N[(t$95$0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(N[(N[(0.375 + N[(-0.25 * v), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(t\_0 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -\infty:\\
\;\;\;\;\left(t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \frac{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \left(w \cdot r\right)\right) \cdot \left(w \cdot r\right)}{1 - v}\right) - 4.5\\
\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 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
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)) Initial program 84.1%
Taylor expanded in v around 0
Applied rewrites76.5%
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-*.f6485.0%
Applied rewrites85.0%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6494.5%
Applied rewrites94.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<=
(-
(-
t_0
(/
(* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r))
(- 1.0 v)))
4.5)
(- INFINITY))
(- (- t_0 (* (* (* (* w r) w) r) 0.25)) 4.5)
(-
(-
t_0
(/ (* (+ 0.375 (* -0.25 v)) (* (* w r) (* w r))) (- 1.0 v)))
4.5))))double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -((double) INFINITY)) {
tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else {
tmp = (t_0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
}
return tmp;
}
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -Double.POSITIVE_INFINITY) {
tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else {
tmp = (t_0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if ((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -math.inf: tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5 else: tmp = (t_0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (Float64(Float64(t_0 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) <= Float64(-Inf)) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(Float64(0.375 + Float64(-0.25 * v)) * Float64(Float64(w * r) * Float64(w * r))) / Float64(1.0 - v))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (((t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -Inf) tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5; else tmp = (t_0 - (((0.375 + (-0.25 * v)) * ((w * r) * (w * r))) / (1.0 - v))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], (-Infinity)], N[(N[(t$95$0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(N[(0.375 + N[(-0.25 * v), $MachinePrecision]), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(t\_0 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -\infty:\\
\;\;\;\;\left(t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \frac{\left(0.375 + -0.25 \cdot v\right) \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)}{1 - v}\right) - 4.5\\
\end{array}
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 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
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)) Initial program 84.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.5%
Applied rewrites94.5%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6494.5%
Applied rewrites94.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r))))
(t_1
(-
(-
t_0
(/
(* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r))
(- 1.0 v)))
4.5)))
(if (<= t_1 (- INFINITY))
(- (- t_0 (* (* (* (* w r) w) r) 0.25)) 4.5)
(if (<= t_1 -1.0)
(-
(-
3.0
(/ (* (* (+ 0.375 (* -0.25 v)) (* 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 t_1 = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else if (t_1 <= -1.0) {
tmp = (3.0 - ((((0.375 + (-0.25 * v)) * (w * r)) * (w * r)) / (1.0 - v))) - 4.5;
} else {
tmp = (t_0 - ((w * (w * (r * r))) * 0.25)) - 4.5;
}
return tmp;
}
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5;
} else if (t_1 <= -1.0) {
tmp = (3.0 - ((((0.375 + (-0.25 * v)) * (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)) t_1 = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5 tmp = 0 if t_1 <= -math.inf: tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5 elif t_1 <= -1.0: tmp = (3.0 - ((((0.375 + (-0.25 * v)) * (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))) t_1 = Float64(Float64(t_0 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25)) - 4.5); elseif (t_1 <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(0.375 + Float64(-0.25 * v)) * Float64(w * r)) * Float64(w * r)) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(w * Float64(w * Float64(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)); t_1 = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_1 <= -Inf) tmp = (t_0 - ((((w * r) * w) * r) * 0.25)) - 4.5; elseif (t_1 <= -1.0) tmp = (3.0 - ((((0.375 + (-0.25 * v)) * (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]}, Block[{t$95$1 = N[(N[(t$95$0 - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t$95$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.0], N[(N[(3.0 - N[(N[(N[(N[(0.375 + N[(-0.25 * v), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(w * N[(w * N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
t_1 := \left(t\_0 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(t\_0 - \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:\\
\;\;\;\;\left(3 - \frac{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \left(w \cdot r\right)\right) \cdot \left(w \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(w \cdot \left(w \cdot \left(r \cdot r\right)\right)\right) \cdot 0.25\right) - 4.5\\
\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 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
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)) < -1Initial program 84.1%
Taylor expanded in v around 0
Applied rewrites76.5%
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-*.f6485.0%
Applied rewrites85.0%
Taylor expanded in v around 0
lower-+.f64N/A
lower-*.f6494.5%
Applied rewrites94.5%
Taylor expanded in r around inf
Applied rewrites51.6%
if -1 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6487.5%
Applied rewrites87.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* w r) w) r))
(t_1 (+ 3.0 (/ 2.0 (* r r))))
(t_2 (- (- t_1 (* t_0 0.25)) 4.5)))
(if (<= v -1.2e+16)
t_2
(if (<= v 1.5e-12) (- (- t_1 (* t_0 0.375)) 4.5) t_2))))double code(double v, double w, double r) {
double t_0 = ((w * r) * w) * r;
double t_1 = 3.0 + (2.0 / (r * r));
double t_2 = (t_1 - (t_0 * 0.25)) - 4.5;
double tmp;
if (v <= -1.2e+16) {
tmp = t_2;
} else if (v <= 1.5e-12) {
tmp = (t_1 - (t_0 * 0.375)) - 4.5;
} else {
tmp = t_2;
}
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 = ((w * r) * w) * r
t_1 = 3.0d0 + (2.0d0 / (r * r))
t_2 = (t_1 - (t_0 * 0.25d0)) - 4.5d0
if (v <= (-1.2d+16)) then
tmp = t_2
else if (v <= 1.5d-12) then
tmp = (t_1 - (t_0 * 0.375d0)) - 4.5d0
else
tmp = t_2
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = ((w * r) * w) * r;
double t_1 = 3.0 + (2.0 / (r * r));
double t_2 = (t_1 - (t_0 * 0.25)) - 4.5;
double tmp;
if (v <= -1.2e+16) {
tmp = t_2;
} else if (v <= 1.5e-12) {
tmp = (t_1 - (t_0 * 0.375)) - 4.5;
} else {
tmp = t_2;
}
return tmp;
}
def code(v, w, r): t_0 = ((w * r) * w) * r t_1 = 3.0 + (2.0 / (r * r)) t_2 = (t_1 - (t_0 * 0.25)) - 4.5 tmp = 0 if v <= -1.2e+16: tmp = t_2 elif v <= 1.5e-12: tmp = (t_1 - (t_0 * 0.375)) - 4.5 else: tmp = t_2 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(w * r) * w) * r) t_1 = Float64(3.0 + Float64(2.0 / Float64(r * r))) t_2 = Float64(Float64(t_1 - Float64(t_0 * 0.25)) - 4.5) tmp = 0.0 if (v <= -1.2e+16) tmp = t_2; elseif (v <= 1.5e-12) tmp = Float64(Float64(t_1 - Float64(t_0 * 0.375)) - 4.5); else tmp = t_2; end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((w * r) * w) * r; t_1 = 3.0 + (2.0 / (r * r)); t_2 = (t_1 - (t_0 * 0.25)) - 4.5; tmp = 0.0; if (v <= -1.2e+16) tmp = t_2; elseif (v <= 1.5e-12) tmp = (t_1 - (t_0 * 0.375)) - 4.5; else tmp = t_2; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -1.2e+16], t$95$2, If[LessEqual[v, 1.5e-12], N[(N[(t$95$1 - N[(t$95$0 * 0.375), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_0 := \left(\left(w \cdot r\right) \cdot w\right) \cdot r\\
t_1 := 3 + \frac{2}{r \cdot r}\\
t_2 := \left(t\_1 - t\_0 \cdot 0.25\right) - 4.5\\
\mathbf{if}\;v \leq -1.2 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;v \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;\left(t\_1 - t\_0 \cdot 0.375\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if v < -1.2e16 or 1.5000000000000001e-12 < v Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
if -1.2e16 < v < 1.5000000000000001e-12Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in v around 0
Applied rewrites90.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (fabs r) (fabs r))) (t_1 (+ 3.0 (/ 2.0 t_0))))
(if (<= (fabs r) 1e+88)
(- (- t_1 (* (* w (* w t_0)) 0.25)) 4.5)
(- (- t_1 (* (* (* (* w (fabs r)) w) (fabs r)) 0.25)) 4.5))))double code(double v, double w, double r) {
double t_0 = fabs(r) * fabs(r);
double t_1 = 3.0 + (2.0 / t_0);
double tmp;
if (fabs(r) <= 1e+88) {
tmp = (t_1 - ((w * (w * t_0)) * 0.25)) - 4.5;
} else {
tmp = (t_1 - ((((w * fabs(r)) * w) * fabs(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) :: t_1
real(8) :: tmp
t_0 = abs(r) * abs(r)
t_1 = 3.0d0 + (2.0d0 / t_0)
if (abs(r) <= 1d+88) then
tmp = (t_1 - ((w * (w * t_0)) * 0.25d0)) - 4.5d0
else
tmp = (t_1 - ((((w * abs(r)) * w) * abs(r)) * 0.25d0)) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = Math.abs(r) * Math.abs(r);
double t_1 = 3.0 + (2.0 / t_0);
double tmp;
if (Math.abs(r) <= 1e+88) {
tmp = (t_1 - ((w * (w * t_0)) * 0.25)) - 4.5;
} else {
tmp = (t_1 - ((((w * Math.abs(r)) * w) * Math.abs(r)) * 0.25)) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = math.fabs(r) * math.fabs(r) t_1 = 3.0 + (2.0 / t_0) tmp = 0 if math.fabs(r) <= 1e+88: tmp = (t_1 - ((w * (w * t_0)) * 0.25)) - 4.5 else: tmp = (t_1 - ((((w * math.fabs(r)) * w) * math.fabs(r)) * 0.25)) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(abs(r) * abs(r)) t_1 = Float64(3.0 + Float64(2.0 / t_0)) tmp = 0.0 if (abs(r) <= 1e+88) tmp = Float64(Float64(t_1 - Float64(Float64(w * Float64(w * t_0)) * 0.25)) - 4.5); else tmp = Float64(Float64(t_1 - Float64(Float64(Float64(Float64(w * abs(r)) * w) * abs(r)) * 0.25)) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = abs(r) * abs(r); t_1 = 3.0 + (2.0 / t_0); tmp = 0.0; if (abs(r) <= 1e+88) tmp = (t_1 - ((w * (w * t_0)) * 0.25)) - 4.5; else tmp = (t_1 - ((((w * abs(r)) * w) * abs(r)) * 0.25)) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 1e+88], N[(N[(t$95$1 - N[(N[(w * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(N[(N[(N[(w * N[Abs[r], $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|r\right| \cdot \left|r\right|\\
t_1 := 3 + \frac{2}{t\_0}\\
\mathbf{if}\;\left|r\right| \leq 10^{+88}:\\
\;\;\;\;\left(t\_1 - \left(w \cdot \left(w \cdot t\_0\right)\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \left(\left(\left(w \cdot \left|r\right|\right) \cdot w\right) \cdot \left|r\right|\right) \cdot 0.25\right) - 4.5\\
\end{array}
if r < 9.9999999999999996e87Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6487.5%
Applied rewrites87.5%
if 9.9999999999999996e87 < r Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6%
Applied rewrites90.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (fabs r) (fabs r))) (t_1 (/ 2.0 t_0)))
(if (<= (fabs r) 5e+69)
(- (- (+ 3.0 t_1) (* (* w (* w t_0)) 0.25)) 4.5)
(- (- 1.5 (- t_1 (* (* 0.25 (fabs r)) (* (* w w) (fabs r)))))))))double code(double v, double w, double r) {
double t_0 = fabs(r) * fabs(r);
double t_1 = 2.0 / t_0;
double tmp;
if (fabs(r) <= 5e+69) {
tmp = ((3.0 + t_1) - ((w * (w * t_0)) * 0.25)) - 4.5;
} else {
tmp = -(1.5 - (t_1 - ((0.25 * fabs(r)) * ((w * w) * 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) :: t_1
real(8) :: tmp
t_0 = abs(r) * abs(r)
t_1 = 2.0d0 / t_0
if (abs(r) <= 5d+69) then
tmp = ((3.0d0 + t_1) - ((w * (w * t_0)) * 0.25d0)) - 4.5d0
else
tmp = -(1.5d0 - (t_1 - ((0.25d0 * abs(r)) * ((w * w) * abs(r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = Math.abs(r) * Math.abs(r);
double t_1 = 2.0 / t_0;
double tmp;
if (Math.abs(r) <= 5e+69) {
tmp = ((3.0 + t_1) - ((w * (w * t_0)) * 0.25)) - 4.5;
} else {
tmp = -(1.5 - (t_1 - ((0.25 * Math.abs(r)) * ((w * w) * Math.abs(r)))));
}
return tmp;
}
def code(v, w, r): t_0 = math.fabs(r) * math.fabs(r) t_1 = 2.0 / t_0 tmp = 0 if math.fabs(r) <= 5e+69: tmp = ((3.0 + t_1) - ((w * (w * t_0)) * 0.25)) - 4.5 else: tmp = -(1.5 - (t_1 - ((0.25 * math.fabs(r)) * ((w * w) * math.fabs(r))))) return tmp
function code(v, w, r) t_0 = Float64(abs(r) * abs(r)) t_1 = Float64(2.0 / t_0) tmp = 0.0 if (abs(r) <= 5e+69) tmp = Float64(Float64(Float64(3.0 + t_1) - Float64(Float64(w * Float64(w * t_0)) * 0.25)) - 4.5); else tmp = Float64(-Float64(1.5 - Float64(t_1 - Float64(Float64(0.25 * abs(r)) * Float64(Float64(w * w) * abs(r)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = abs(r) * abs(r); t_1 = 2.0 / t_0; tmp = 0.0; if (abs(r) <= 5e+69) tmp = ((3.0 + t_1) - ((w * (w * t_0)) * 0.25)) - 4.5; else tmp = -(1.5 - (t_1 - ((0.25 * abs(r)) * ((w * w) * abs(r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 5e+69], N[(N[(N[(3.0 + t$95$1), $MachinePrecision] - N[(N[(w * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], (-N[(1.5 - N[(t$95$1 - N[(N[(0.25 * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
t_0 := \left|r\right| \cdot \left|r\right|\\
t_1 := \frac{2}{t\_0}\\
\mathbf{if}\;\left|r\right| \leq 5 \cdot 10^{+69}:\\
\;\;\;\;\left(\left(3 + t\_1\right) - \left(w \cdot \left(w \cdot t\_0\right)\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;-\left(1.5 - \left(t\_1 - \left(0.25 \cdot \left|r\right|\right) \cdot \left(\left(w \cdot w\right) \cdot \left|r\right|\right)\right)\right)\\
\end{array}
if r < 5.0000000000000004e69Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6487.5%
Applied rewrites87.5%
if 5.0000000000000004e69 < r Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
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
metadata-evalN/A
Applied rewrites82.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1 (* (* w w) r))
(t_2 (* t_1 r))
(t_3
(-
(-
(+ 3.0 t_0)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) t_2) (- 1.0 v)))
4.5)))
(if (<= t_3 (- INFINITY))
(- (- 3.0 (* t_2 0.25)) 4.5)
(if (<= t_3 -1.5000000000126734)
(- (- 3.0 (/ (* t_1 (* r 0.375)) (- 1.0 v))) 4.5)
(- (- t_0 -3.0) 4.5)))))double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (w * w) * r;
double t_2 = t_1 * r;
double t_3 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * t_2) / (1.0 - v))) - 4.5;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = (3.0 - (t_2 * 0.25)) - 4.5;
} else if (t_3 <= -1.5000000000126734) {
tmp = (3.0 - ((t_1 * (r * 0.375)) / (1.0 - v))) - 4.5;
} else {
tmp = (t_0 - -3.0) - 4.5;
}
return tmp;
}
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (w * w) * r;
double t_2 = t_1 * r;
double t_3 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * t_2) / (1.0 - v))) - 4.5;
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = (3.0 - (t_2 * 0.25)) - 4.5;
} else if (t_3 <= -1.5000000000126734) {
tmp = (3.0 - ((t_1 * (r * 0.375)) / (1.0 - v))) - 4.5;
} else {
tmp = (t_0 - -3.0) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (w * w) * r t_2 = t_1 * r t_3 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * t_2) / (1.0 - v))) - 4.5 tmp = 0 if t_3 <= -math.inf: tmp = (3.0 - (t_2 * 0.25)) - 4.5 elif t_3 <= -1.5000000000126734: tmp = (3.0 - ((t_1 * (r * 0.375)) / (1.0 - v))) - 4.5 else: tmp = (t_0 - -3.0) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(w * w) * r) t_2 = Float64(t_1 * r) t_3 = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * t_2) / Float64(1.0 - v))) - 4.5) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(3.0 - Float64(t_2 * 0.25)) - 4.5); elseif (t_3 <= -1.5000000000126734) tmp = Float64(Float64(3.0 - Float64(Float64(t_1 * Float64(r * 0.375)) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(t_0 - -3.0) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (w * w) * r; t_2 = t_1 * r; t_3 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * t_2) / (1.0 - v))) - 4.5; tmp = 0.0; if (t_3 <= -Inf) tmp = (3.0 - (t_2 * 0.25)) - 4.5; elseif (t_3 <= -1.5000000000126734) tmp = (3.0 - ((t_1 * (r * 0.375)) / (1.0 - v))) - 4.5; else tmp = (t_0 - -3.0) - 4.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[(w * w), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * r), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(3.0 - N[(t$95$2 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$3, -1.5000000000126734], N[(N[(3.0 - N[(N[(t$95$1 * N[(r * 0.375), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - -3.0), $MachinePrecision] - 4.5), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(w \cdot w\right) \cdot r\\
t_2 := t\_1 \cdot r\\
t_3 := \left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot t\_2}{1 - v}\right) - 4.5\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\left(3 - t\_2 \cdot 0.25\right) - 4.5\\
\mathbf{elif}\;t\_3 \leq -1.5000000000126734:\\
\;\;\;\;\left(3 - \frac{t\_1 \cdot \left(r \cdot 0.375\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - -3\right) - 4.5\\
\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 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
Taylor expanded in r around inf
Applied rewrites47.0%
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.5000000000126734Initial program 84.1%
Taylor expanded in v around 0
Applied rewrites76.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6476.5%
Applied rewrites76.5%
Taylor expanded in r around inf
Applied rewrites40.8%
if -1.5000000000126734 < (-.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%
Applied rewrites69.4%
Taylor expanded in w around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6457.6%
Applied rewrites57.6%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
add-to-fraction-revN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval57.7%
Applied rewrites57.7%
(FPCore (v w r)
:precision binary64
(if (<= (fabs r) 6.8e-106)
(- (- (/ (/ 2.0 (fabs r)) (fabs r)) -3.0) 4.5)
(-
(-
1.5
(-
(/ 2.0 (* (fabs r) (fabs r)))
(* (* 0.25 (fabs r)) (* (* w w) (fabs r))))))))double code(double v, double w, double r) {
double tmp;
if (fabs(r) <= 6.8e-106) {
tmp = (((2.0 / fabs(r)) / fabs(r)) - -3.0) - 4.5;
} else {
tmp = -(1.5 - ((2.0 / (fabs(r) * fabs(r))) - ((0.25 * fabs(r)) * ((w * w) * 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) :: tmp
if (abs(r) <= 6.8d-106) then
tmp = (((2.0d0 / abs(r)) / abs(r)) - (-3.0d0)) - 4.5d0
else
tmp = -(1.5d0 - ((2.0d0 / (abs(r) * abs(r))) - ((0.25d0 * abs(r)) * ((w * w) * abs(r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (Math.abs(r) <= 6.8e-106) {
tmp = (((2.0 / Math.abs(r)) / Math.abs(r)) - -3.0) - 4.5;
} else {
tmp = -(1.5 - ((2.0 / (Math.abs(r) * Math.abs(r))) - ((0.25 * Math.abs(r)) * ((w * w) * Math.abs(r)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if math.fabs(r) <= 6.8e-106: tmp = (((2.0 / math.fabs(r)) / math.fabs(r)) - -3.0) - 4.5 else: tmp = -(1.5 - ((2.0 / (math.fabs(r) * math.fabs(r))) - ((0.25 * math.fabs(r)) * ((w * w) * math.fabs(r))))) return tmp
function code(v, w, r) tmp = 0.0 if (abs(r) <= 6.8e-106) tmp = Float64(Float64(Float64(Float64(2.0 / abs(r)) / abs(r)) - -3.0) - 4.5); else tmp = Float64(-Float64(1.5 - Float64(Float64(2.0 / Float64(abs(r) * abs(r))) - Float64(Float64(0.25 * abs(r)) * Float64(Float64(w * w) * abs(r)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (abs(r) <= 6.8e-106) tmp = (((2.0 / abs(r)) / abs(r)) - -3.0) - 4.5; else tmp = -(1.5 - ((2.0 / (abs(r) * abs(r))) - ((0.25 * abs(r)) * ((w * w) * abs(r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[N[Abs[r], $MachinePrecision], 6.8e-106], N[(N[(N[(N[(2.0 / N[Abs[r], $MachinePrecision]), $MachinePrecision] / N[Abs[r], $MachinePrecision]), $MachinePrecision] - -3.0), $MachinePrecision] - 4.5), $MachinePrecision], (-N[(1.5 - N[(N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.25 * N[Abs[r], $MachinePrecision]), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
\mathbf{if}\;\left|r\right| \leq 6.8 \cdot 10^{-106}:\\
\;\;\;\;\left(\frac{\frac{2}{\left|r\right|}}{\left|r\right|} - -3\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;-\left(1.5 - \left(\frac{2}{\left|r\right| \cdot \left|r\right|} - \left(0.25 \cdot \left|r\right|\right) \cdot \left(\left(w \cdot w\right) \cdot \left|r\right|\right)\right)\right)\\
\end{array}
if r < 6.7999999999999996e-106Initial program 84.1%
Applied rewrites69.4%
Taylor expanded in w around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6457.6%
Applied rewrites57.6%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
add-to-fraction-revN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval57.7%
Applied rewrites57.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6457.7%
Applied rewrites57.7%
if 6.7999999999999996e-106 < r Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
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
metadata-evalN/A
Applied rewrites82.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* w w) r) r)) (t_1 (/ 2.0 (* r r))))
(if (<=
(-
(-
(+ 3.0 t_1)
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) t_0) (- 1.0 v)))
4.5)
-1.5000000000126734)
(- (- 3.0 (* t_0 0.25)) 4.5)
(- (- t_1 -3.0) 4.5))))double code(double v, double w, double r) {
double t_0 = ((w * w) * r) * r;
double t_1 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5000000000126734) {
tmp = (3.0 - (t_0 * 0.25)) - 4.5;
} else {
tmp = (t_1 - -3.0) - 4.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((w * w) * r) * r
t_1 = 2.0d0 / (r * r)
if ((((3.0d0 + t_1) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * t_0) / (1.0d0 - v))) - 4.5d0) <= (-1.5000000000126734d0)) then
tmp = (3.0d0 - (t_0 * 0.25d0)) - 4.5d0
else
tmp = (t_1 - (-3.0d0)) - 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 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5000000000126734) {
tmp = (3.0 - (t_0 * 0.25)) - 4.5;
} else {
tmp = (t_1 - -3.0) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = ((w * w) * r) * r t_1 = 2.0 / (r * r) tmp = 0 if (((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5000000000126734: tmp = (3.0 - (t_0 * 0.25)) - 4.5 else: tmp = (t_1 - -3.0) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(w * w) * r) * r) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(Float64(Float64(3.0 + t_1) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * t_0) / Float64(1.0 - v))) - 4.5) <= -1.5000000000126734) tmp = Float64(Float64(3.0 - Float64(t_0 * 0.25)) - 4.5); else tmp = Float64(Float64(t_1 - -3.0) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((w * w) * r) * r; t_1 = 2.0 / (r * r); tmp = 0.0; if ((((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * t_0) / (1.0 - v))) - 4.5) <= -1.5000000000126734) tmp = (3.0 - (t_0 * 0.25)) - 4.5; else tmp = (t_1 - -3.0) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$1), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.5000000000126734], N[(N[(3.0 - N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - -3.0), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(w \cdot w\right) \cdot r\right) \cdot r\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(\left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot t\_0}{1 - v}\right) - 4.5 \leq -1.5000000000126734:\\
\;\;\;\;\left(3 - t\_0 \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - -3\right) - 4.5\\
\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.5000000000126734Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites87.2%
Taylor expanded in v around inf
Applied rewrites82.8%
Taylor expanded in r around inf
Applied rewrites47.0%
if -1.5000000000126734 < (-.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%
Applied rewrites69.4%
Taylor expanded in w around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6457.6%
Applied rewrites57.6%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
add-to-fraction-revN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval57.7%
Applied rewrites57.7%
(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.1%
Applied rewrites69.4%
Taylor expanded in w around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6457.6%
Applied rewrites57.6%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
add-to-fraction-revN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval57.7%
Applied rewrites57.7%
herbie shell --seed 2025258
(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))