
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* x 0.5)))) (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x))))
double code(double x) {
double t_0 = sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / sin(x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((x * 0.5d0))
code = (((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / Math.sin(x);
}
def code(x): t_0 = math.sin((x * 0.5)) return (((8.0 / 3.0) * t_0) * t_0) / math.sin(x)
function code(x) t_0 = sin(Float64(x * 0.5)) return Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x)) end
function tmp = code(x) t_0 = sin((x * 0.5)); tmp = (((8.0 / 3.0) * t_0) * t_0) / sin(x); end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x}
\end{array}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* x 0.5)))) (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x))))
double code(double x) {
double t_0 = sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / sin(x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((x * 0.5d0))
code = (((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / Math.sin(x);
}
def code(x): t_0 = math.sin((x * 0.5)) return (((8.0 / 3.0) * t_0) * t_0) / math.sin(x)
function code(x) t_0 = sin(Float64(x * 0.5)) return Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x)) end
function tmp = code(x) t_0 = sin((x * 0.5)); tmp = (((8.0 / 3.0) * t_0) * t_0) / sin(x); end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x}
\end{array}
\end{array}
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* x 0.5)))) (* (* (/ t_0 (sin x)) t_0) 2.6666666666666665)))
double code(double x) {
double t_0 = sin((x * 0.5));
return ((t_0 / sin(x)) * t_0) * 2.6666666666666665;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((x * 0.5d0))
code = ((t_0 / sin(x)) * t_0) * 2.6666666666666665d0
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
return ((t_0 / Math.sin(x)) * t_0) * 2.6666666666666665;
}
def code(x): t_0 = math.sin((x * 0.5)) return ((t_0 / math.sin(x)) * t_0) * 2.6666666666666665
function code(x) t_0 = sin(Float64(x * 0.5)) return Float64(Float64(Float64(t_0 / sin(x)) * t_0) * 2.6666666666666665) end
function tmp = code(x) t_0 = sin((x * 0.5)); tmp = ((t_0 / sin(x)) * t_0) * 2.6666666666666665; end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(t$95$0 / N[Sin[x], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * 2.6666666666666665), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\left(\frac{t\_0}{\sin x} \cdot t\_0\right) \cdot 2.6666666666666665
\end{array}
\end{array}
Initial program 76.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.2%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.2%
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* 0.5 x)))) (* t_0 (* 2.6666666666666665 (/ t_0 (sin x))))))
double code(double x) {
double t_0 = sin((0.5 * x));
return t_0 * (2.6666666666666665 * (t_0 / sin(x)));
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((0.5d0 * x))
code = t_0 * (2.6666666666666665d0 * (t_0 / sin(x)))
end function
public static double code(double x) {
double t_0 = Math.sin((0.5 * x));
return t_0 * (2.6666666666666665 * (t_0 / Math.sin(x)));
}
def code(x): t_0 = math.sin((0.5 * x)) return t_0 * (2.6666666666666665 * (t_0 / math.sin(x)))
function code(x) t_0 = sin(Float64(0.5 * x)) return Float64(t_0 * Float64(2.6666666666666665 * Float64(t_0 / sin(x)))) end
function tmp = code(x) t_0 = sin((0.5 * x)); tmp = t_0 * (2.6666666666666665 * (t_0 / sin(x))); end
code[x_] := Block[{t$95$0 = N[Sin[N[(0.5 * x), $MachinePrecision]], $MachinePrecision]}, N[(t$95$0 * N[(2.6666666666666665 * N[(t$95$0 / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot x\right)\\
t\_0 \cdot \left(2.6666666666666665 \cdot \frac{t\_0}{\sin x}\right)
\end{array}
\end{array}
Initial program 76.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites99.2%
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* 0.5 x)))) (* (/ t_0 (sin x)) (* t_0 2.6666666666666665))))
double code(double x) {
double t_0 = sin((0.5 * x));
return (t_0 / sin(x)) * (t_0 * 2.6666666666666665);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((0.5d0 * x))
code = (t_0 / sin(x)) * (t_0 * 2.6666666666666665d0)
end function
public static double code(double x) {
double t_0 = Math.sin((0.5 * x));
return (t_0 / Math.sin(x)) * (t_0 * 2.6666666666666665);
}
def code(x): t_0 = math.sin((0.5 * x)) return (t_0 / math.sin(x)) * (t_0 * 2.6666666666666665)
function code(x) t_0 = sin(Float64(0.5 * x)) return Float64(Float64(t_0 / sin(x)) * Float64(t_0 * 2.6666666666666665)) end
function tmp = code(x) t_0 = sin((0.5 * x)); tmp = (t_0 / sin(x)) * (t_0 * 2.6666666666666665); end
code[x_] := Block[{t$95$0 = N[Sin[N[(0.5 * x), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 / N[Sin[x], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * 2.6666666666666665), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot x\right)\\
\frac{t\_0}{\sin x} \cdot \left(t\_0 \cdot 2.6666666666666665\right)
\end{array}
\end{array}
Initial program 76.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.2%
(FPCore (x) :precision binary64 (if (<= x 2e-128) (* 0.6666666666666666 x) (/ (* (pow (sin (* x 0.5)) 2.0) 2.6666666666666665) (sin x))))
double code(double x) {
double tmp;
if (x <= 2e-128) {
tmp = 0.6666666666666666 * x;
} else {
tmp = (pow(sin((x * 0.5)), 2.0) * 2.6666666666666665) / sin(x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2d-128) then
tmp = 0.6666666666666666d0 * x
else
tmp = ((sin((x * 0.5d0)) ** 2.0d0) * 2.6666666666666665d0) / sin(x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 2e-128) {
tmp = 0.6666666666666666 * x;
} else {
tmp = (Math.pow(Math.sin((x * 0.5)), 2.0) * 2.6666666666666665) / Math.sin(x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 2e-128: tmp = 0.6666666666666666 * x else: tmp = (math.pow(math.sin((x * 0.5)), 2.0) * 2.6666666666666665) / math.sin(x) return tmp
function code(x) tmp = 0.0 if (x <= 2e-128) tmp = Float64(0.6666666666666666 * x); else tmp = Float64(Float64((sin(Float64(x * 0.5)) ^ 2.0) * 2.6666666666666665) / sin(x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2e-128) tmp = 0.6666666666666666 * x; else tmp = ((sin((x * 0.5)) ^ 2.0) * 2.6666666666666665) / sin(x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2e-128], N[(0.6666666666666666 * x), $MachinePrecision], N[(N[(N[Power[N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * 2.6666666666666665), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-128}:\\
\;\;\;\;0.6666666666666666 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{{\sin \left(x \cdot 0.5\right)}^{2} \cdot 2.6666666666666665}{\sin x}\\
\end{array}
\end{array}
if x < 2.00000000000000011e-128Initial program 64.1%
Taylor expanded in x around 0
lower-*.f6462.7
Applied rewrites62.7%
if 2.00000000000000011e-128 < x Initial program 99.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.7%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
sqr-sin-a-revN/A
unpow2N/A
lower-pow.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-*.f6499.1
Applied rewrites99.1%
(FPCore (x) :precision binary64 (if (<= x 0.0043) (* (* (fma 0.020833333333333332 (* x x) 0.25) x) 2.6666666666666665) (* (/ (- 0.5 (* (cos x) 0.5)) (sin x)) 2.6666666666666665)))
double code(double x) {
double tmp;
if (x <= 0.0043) {
tmp = (fma(0.020833333333333332, (x * x), 0.25) * x) * 2.6666666666666665;
} else {
tmp = ((0.5 - (cos(x) * 0.5)) / sin(x)) * 2.6666666666666665;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.0043) tmp = Float64(Float64(fma(0.020833333333333332, Float64(x * x), 0.25) * x) * 2.6666666666666665); else tmp = Float64(Float64(Float64(0.5 - Float64(cos(x) * 0.5)) / sin(x)) * 2.6666666666666665); end return tmp end
code[x_] := If[LessEqual[x, 0.0043], N[(N[(N[(0.020833333333333332 * N[(x * x), $MachinePrecision] + 0.25), $MachinePrecision] * x), $MachinePrecision] * 2.6666666666666665), $MachinePrecision], N[(N[(N[(0.5 - N[(N[Cos[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision] * 2.6666666666666665), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0043:\\
\;\;\;\;\left(\mathsf{fma}\left(0.020833333333333332, x \cdot x, 0.25\right) \cdot x\right) \cdot 2.6666666666666665\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 - \cos x \cdot 0.5}{\sin x} \cdot 2.6666666666666665\\
\end{array}
\end{array}
if x < 0.0043Initial program 69.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6467.7
Applied rewrites67.7%
if 0.0043 < x Initial program 99.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites99.0%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites98.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f6498.3
lift-*.f64N/A
*-lft-identity98.3
Applied rewrites98.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
(FPCore (x) :precision binary64 (if (<= x 0.0043) (* (* (fma 0.020833333333333332 (* x x) 0.25) x) 2.6666666666666665) (/ (* (- 0.5 (* 0.5 (cos x))) 2.6666666666666665) (sin x))))
double code(double x) {
double tmp;
if (x <= 0.0043) {
tmp = (fma(0.020833333333333332, (x * x), 0.25) * x) * 2.6666666666666665;
} else {
tmp = ((0.5 - (0.5 * cos(x))) * 2.6666666666666665) / sin(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.0043) tmp = Float64(Float64(fma(0.020833333333333332, Float64(x * x), 0.25) * x) * 2.6666666666666665); else tmp = Float64(Float64(Float64(0.5 - Float64(0.5 * cos(x))) * 2.6666666666666665) / sin(x)); end return tmp end
code[x_] := If[LessEqual[x, 0.0043], N[(N[(N[(0.020833333333333332 * N[(x * x), $MachinePrecision] + 0.25), $MachinePrecision] * x), $MachinePrecision] * 2.6666666666666665), $MachinePrecision], N[(N[(N[(0.5 - N[(0.5 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.6666666666666665), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0043:\\
\;\;\;\;\left(\mathsf{fma}\left(0.020833333333333332, x \cdot x, 0.25\right) \cdot x\right) \cdot 2.6666666666666665\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 - 0.5 \cdot \cos x\right) \cdot 2.6666666666666665}{\sin x}\\
\end{array}
\end{array}
if x < 0.0043Initial program 69.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6467.7
Applied rewrites67.7%
if 0.0043 < x Initial program 99.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
Taylor expanded in x around 0
Applied rewrites98.3%
(FPCore (x) :precision binary64 (if (<= x 0.0043) (* (* (fma 0.020833333333333332 (* x x) 0.25) x) 2.6666666666666665) (* (/ 2.6666666666666665 (sin x)) (- 0.5 (* (cos x) 0.5)))))
double code(double x) {
double tmp;
if (x <= 0.0043) {
tmp = (fma(0.020833333333333332, (x * x), 0.25) * x) * 2.6666666666666665;
} else {
tmp = (2.6666666666666665 / sin(x)) * (0.5 - (cos(x) * 0.5));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.0043) tmp = Float64(Float64(fma(0.020833333333333332, Float64(x * x), 0.25) * x) * 2.6666666666666665); else tmp = Float64(Float64(2.6666666666666665 / sin(x)) * Float64(0.5 - Float64(cos(x) * 0.5))); end return tmp end
code[x_] := If[LessEqual[x, 0.0043], N[(N[(N[(0.020833333333333332 * N[(x * x), $MachinePrecision] + 0.25), $MachinePrecision] * x), $MachinePrecision] * 2.6666666666666665), $MachinePrecision], N[(N[(2.6666666666666665 / N[Sin[x], $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(N[Cos[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0043:\\
\;\;\;\;\left(\mathsf{fma}\left(0.020833333333333332, x \cdot x, 0.25\right) \cdot x\right) \cdot 2.6666666666666665\\
\mathbf{else}:\\
\;\;\;\;\frac{2.6666666666666665}{\sin x} \cdot \left(0.5 - \cos x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 0.0043Initial program 69.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6467.7
Applied rewrites67.7%
if 0.0043 < x Initial program 99.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites99.0%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites98.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f6498.3
lift-*.f64N/A
*-lft-identity98.3
Applied rewrites98.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (sin (* x 0.5))))
(if (<= (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x)) 0.06)
(* (sin (* 0.5 x)) 1.3333333333333333)
(*
(* 1.3333333333333333 x)
(/ (pow (- 0.5 (* (cos (* 1.0 x)) 0.5)) 0.5) x)))))
double code(double x) {
double t_0 = sin((x * 0.5));
double tmp;
if (((((8.0 / 3.0) * t_0) * t_0) / sin(x)) <= 0.06) {
tmp = sin((0.5 * x)) * 1.3333333333333333;
} else {
tmp = (1.3333333333333333 * x) * (pow((0.5 - (cos((1.0 * x)) * 0.5)), 0.5) / x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sin((x * 0.5d0))
if (((((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)) <= 0.06d0) then
tmp = sin((0.5d0 * x)) * 1.3333333333333333d0
else
tmp = (1.3333333333333333d0 * x) * (((0.5d0 - (cos((1.0d0 * x)) * 0.5d0)) ** 0.5d0) / x)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
double tmp;
if (((((8.0 / 3.0) * t_0) * t_0) / Math.sin(x)) <= 0.06) {
tmp = Math.sin((0.5 * x)) * 1.3333333333333333;
} else {
tmp = (1.3333333333333333 * x) * (Math.pow((0.5 - (Math.cos((1.0 * x)) * 0.5)), 0.5) / x);
}
return tmp;
}
def code(x): t_0 = math.sin((x * 0.5)) tmp = 0 if ((((8.0 / 3.0) * t_0) * t_0) / math.sin(x)) <= 0.06: tmp = math.sin((0.5 * x)) * 1.3333333333333333 else: tmp = (1.3333333333333333 * x) * (math.pow((0.5 - (math.cos((1.0 * x)) * 0.5)), 0.5) / x) return tmp
function code(x) t_0 = sin(Float64(x * 0.5)) tmp = 0.0 if (Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x)) <= 0.06) tmp = Float64(sin(Float64(0.5 * x)) * 1.3333333333333333); else tmp = Float64(Float64(1.3333333333333333 * x) * Float64((Float64(0.5 - Float64(cos(Float64(1.0 * x)) * 0.5)) ^ 0.5) / x)); end return tmp end
function tmp_2 = code(x) t_0 = sin((x * 0.5)); tmp = 0.0; if (((((8.0 / 3.0) * t_0) * t_0) / sin(x)) <= 0.06) tmp = sin((0.5 * x)) * 1.3333333333333333; else tmp = (1.3333333333333333 * x) * (((0.5 - (cos((1.0 * x)) * 0.5)) ^ 0.5) / x); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision], 0.06], N[(N[Sin[N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * 1.3333333333333333), $MachinePrecision], N[(N[(1.3333333333333333 * x), $MachinePrecision] * N[(N[Power[N[(0.5 - N[(N[Cos[N[(1.0 * x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\mathbf{if}\;\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x} \leq 0.06:\\
\;\;\;\;\sin \left(0.5 \cdot x\right) \cdot 1.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\left(1.3333333333333333 \cdot x\right) \cdot \frac{{\left(0.5 - \cos \left(1 \cdot x\right) \cdot 0.5\right)}^{0.5}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (*.f64 (/.f64 #s(literal 8 binary64) #s(literal 3 binary64)) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 x)) < 0.059999999999999998Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites69.2%
if 0.059999999999999998 < (/.f64 (*.f64 (*.f64 (/.f64 #s(literal 8 binary64) #s(literal 3 binary64)) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 x)) Initial program 99.0%
Taylor expanded in x around 0
lower-*.f643.4
Applied rewrites3.4%
Taylor expanded in x around 0
Applied rewrites11.7%
metadata-eval11.7
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites11.7%
lift-*.f64N/A
lift-sin.f64N/A
unpow1N/A
metadata-evalN/A
pow-unpowN/A
*-commutativeN/A
unpow2N/A
sqr-sin-a-revN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
associate-*r*N/A
metadata-evalN/A
lower-*.f6421.0
Applied rewrites21.0%
(FPCore (x) :precision binary64 (* (sin (* 0.5 x)) 1.3333333333333333))
double code(double x) {
return sin((0.5 * x)) * 1.3333333333333333;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = sin((0.5d0 * x)) * 1.3333333333333333d0
end function
public static double code(double x) {
return Math.sin((0.5 * x)) * 1.3333333333333333;
}
def code(x): return math.sin((0.5 * x)) * 1.3333333333333333
function code(x) return Float64(sin(Float64(0.5 * x)) * 1.3333333333333333) end
function tmp = code(x) tmp = sin((0.5 * x)) * 1.3333333333333333; end
code[x_] := N[(N[Sin[N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * 1.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\sin \left(0.5 \cdot x\right) \cdot 1.3333333333333333
\end{array}
Initial program 76.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites99.2%
Taylor expanded in x around 0
Applied rewrites55.4%
(FPCore (x) :precision binary64 (* 0.6666666666666666 x))
double code(double x) {
return 0.6666666666666666 * x;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = 0.6666666666666666d0 * x
end function
public static double code(double x) {
return 0.6666666666666666 * x;
}
def code(x): return 0.6666666666666666 * x
function code(x) return Float64(0.6666666666666666 * x) end
function tmp = code(x) tmp = 0.6666666666666666 * x; end
code[x_] := N[(0.6666666666666666 * x), $MachinePrecision]
\begin{array}{l}
\\
0.6666666666666666 \cdot x
\end{array}
Initial program 76.7%
Taylor expanded in x around 0
lower-*.f6451.2
Applied rewrites51.2%
herbie shell --seed 2025119
(FPCore (x)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, A"
:precision binary64
(/ (* (* (/ 8.0 3.0) (sin (* x 0.5))) (sin (* x 0.5))) (sin x)))