If you are the book keeper for a publicly traded company and you misrepresent the financial earnings of the company (even if by accident) for an earnings quarter, is this illegal?
Intentional misrepresentation of financial records is most likely punishable by law. You may want to compare the outcome of accounting scandals. The degree of punishment may depend however on the the jurisdiction not only of the company and type of company but also where it is listed. Whether an individual is accountable often depends on the position and responsibilities the individuals hold. The Sarbanes-Oxley Act is one of the more prominent ordinances governing accounting issues for US listed companies.
Accidental errors do occur from time to time. Apart from the ethical obligations for some professionals there may be legal obligations regarding the correction of such errors. For example IAS8 defines how errors should be handled in within the IFRS framework and the there is guidance on errors in SEC 8K filings. I am not sure regarding the punishment for corporate or individuals if errors are not handled appropriately.