I want to calculate marking points for an exam by multiplying a percentage with the total number of points (e.g., 0.5 * \numpoints{}) to make a grading table. Problem is that before I run the compilation I cannot access \numpoints as a number and get an error. I have been trying to use some sort of if-statement to solve it but that has rendered nothing useful. A working example is below, my current solution is to comment these lines, compile the file and then uncomment and compile again. Is there an easy way to use an if-statement to solve this issue?
\documentclass[addpoints, 12pt]{exam}
\printanswers
\usepackage[utf8]{inputenc}
\usepackage{fp}
\begin{document}
\Large{Exam}\\
% Marking points COMMENT line 1-3 below to run first time
\FPeval{\gradethree}{clip(\numpoints{} * 0.5)}
\FPeval{\gradefour}{clip(\numpoints{} * 0.67)}
\FPeval{\gradefive}{clip(\numpoints{} * 0.83)}
% Marking table COMMENT lines 2-4 below to run first time
\noindent{}Total points: \numpoints{} \\
Grade 3: \gradethree \space points \\
Grade 4: \gradefour \space points \\
Grade 5: \gradefive \space points \\
\begin{questions}
\question[2]
Who is Mark Twain?
\begin{solution}
Not your daddy.
\end{solution}
\question[2]
Who is Mark Twain?
\begin{solution}
Not your daddy.
\end{solution}
\question[2]
Who is Mark Twain?
\begin{solution}
Not your daddy.
\end{solution}
\question[2]
Who is Mark Twain?
\begin{solution}
Not your daddy.
\end{solution}
\end{questions}
\end{document}
The output after my comment workaround looks like this (which is exactly what I want to achieve):