Your arguments to
sprintf()
are backwards, the output string goes first, then the format statement, then the values to be formatted into the string. See
here[
^]
Also, the default precision (6) is not usually adequate for very small numbers. anything e-12 is pretty small. Try something like %.20f :)