0

I'm converting a program from Scilab code to C++ and I've just read the following:

The IEEE standard does not require transcendental functions to be exactly rounded.

Source: What Every Computer Scientist Should Know About Floating-Point Arithmetic.

Note: Apparently the inaccuracy only resides on the last bit (according the answer found here). Also, the only transcendental functions I'm dealing with are sin(), cos(), and exp().

Is there a way I can go about handling these functions so that my calculations will remain the same in both languages?

Community
  • 1
  • 1
Paul Warnick
  • 903
  • 2
  • 13
  • 26
  • near exact duplicate of [a previous question](http://stackoverflow.com/questions/2670999/how-can-i-work-around-the-fact-that-in-c-sinm-pi-is-not-0) – Aumnayan Jun 16 '16 at 18:31
  • @Aumnayan I understand the topics discussed in your linked question. That is not what I'm asking. I'm asking whether or not it's possible to replicate the behaviour of sin, cos, etc in two different languages so that calculations using these functions will match up to the same level of precision. – Paul Warnick Jun 16 '16 at 18:41
  • 2
    Not utilizing the standard routines. You would need to examine third party high precision math libraries if you need more precision (http://www.nongnu.org/hpalib/). And even then it might not be an exact match. – Aumnayan Jun 16 '16 at 18:45
  • @Aumnayan Actually, that IS what I am asking but unfortunately (the poster even mentions it in the question as an edit) the there is no answer to the "work around" part. – Paul Warnick Jun 16 '16 at 18:46

0 Answers0