I can't reproduce your results for pitch errors (to ensure I tested with C++ and Octave).
E.g. this minimal test (using your frequency data for the three notes) shows:
Code: Select all
pitch index: 46 623 954
relative errors: 1.63845501223e-007 9.93477199191e-008 1.50108653945e-007
pitch errors: 2.83654887341e-006 1.71994146807e-006 2.59873232001e-006
(The relative error values are basically the same as yours so it's only your pitch errors being sort of up-side-down).
I can't see any mistakes in your code so it's most likely something wrong with the "output" itself (like "corrupted" from elsewhere, no idea what could it be though).