sin(PI)

Percentage Accurate: 3.2% → 100.0%
Time: 7.6s
Alternatives: 1
Speedup: 101.0×

Specification

?
\[\begin{array}{l} \\ \sin \pi \end{array} \]
(FPCore () :precision binary64 (sin PI))
double code() {
	return sin(((double) M_PI));
}
public static double code() {
	return Math.sin(Math.PI);
}
def code():
	return math.sin(math.pi)
function code()
	return sin(pi)
end
function tmp = code()
	tmp = sin(pi);
end
code[] := N[Sin[Pi], $MachinePrecision]
\begin{array}{l}

\\
\sin \pi
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 1 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 3.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin \pi \end{array} \]
(FPCore () :precision binary64 (sin PI))
double code() {
	return sin(((double) M_PI));
}
public static double code() {
	return Math.sin(Math.PI);
}
def code():
	return math.sin(math.pi)
function code()
	return sin(pi)
end
function tmp = code()
	tmp = sin(pi);
end
code[] := N[Sin[Pi], $MachinePrecision]
\begin{array}{l}

\\
\sin \pi
\end{array}

Alternative 1: 100.0% accurate, 101.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore () :precision binary64 0.0)
double code() {
	return 0.0;
}
real(8) function code()
    code = 0.0d0
end function
public static double code() {
	return 0.0;
}
def code():
	return 0.0
function code()
	return 0.0
end
function tmp = code()
	tmp = 0.0;
end
code[] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 3.2%

    \[\sin \pi \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sin-PI100.0

      \[\leadsto \color{blue}{0} \]
  4. Applied egg-rr100.0%

    \[\leadsto \color{blue}{0} \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 5 
(FPCore ()
  :name "sin(PI)"
  :precision binary64
  (sin PI))