A little diversion right into floating point (im) accuracy, component 1

The majority of mathematicians concur that:

eπi + 1 = 0

Nonetheless, most floating point executions differ. Just how well can we resolve this disagreement?

I'm eager to read about various languages and also executions, and also numerous approaches to make the outcome as near absolutely no as feasible. Be imaginative!

0
2019-05-07 01:13:02
Source Share
Answers: 2

Here's a list of executions and also languages I've attempted. It's arranged by distance to absolutely no :

  • Scheme : (+ 1 (make-polar 1 (atan 0 -1)))
    • 0.0+1.2246063538223773e-16i (Chez Scheme, MIT Scheme)
    • 0.0+1.22460635382238e-16i (Guile)
    • 0.0+1.22464679914735e-16i (Chicken with numbers egg)
    • 0.0+1.2246467991473532e-16i (MzScheme, SISC, Gauche, Gambit)
    • 0.0+1.2246467991473533e-16i (SCM)
  • Common Lisp : (1+ (exp (complex 0 pi)))
    • #C(0.0L0 -5.0165576136843360246L-20) (CLISP)
    • #C(0.0d0 1.2246063538223773d-16) (CMUCL)
    • #C(0.0d0 1.2246467991473532d-16) (SBCL)
  • Perl : use Math::Complex; Math::Complex->emake(1, pi) + 1
    • 1.22464679914735e-16i
  • Python : from cmath import exp, pi; exp(complex(0, pi)) + 1
    • 1.2246467991473532e-16j (CPython)
  • Ruby : require 'complex'; Complex::polar(1, Math::PI) + 1
    • Complex(0.0, 1.22464679914735e-16) (MRI)
    • Complex(0.0, 1.2246467991473532e-16) (JRuby)
  • R : complex(argument = pi) + 1
    • 0+1.224606353822377e-16i
0
2019-05-08 21:25:16
Source

Is it feasible to resolve this disagreement?

My first idea is to aim to a symbolic language, like Maple. I do not assume that counts as floating point though.

Actually, just how does one stand for i (or j for the designers) in a standard shows language?

Probably a far better instance is wrong (π) = 0? (Or have I misreaded once more?)

0
2019-05-08 21:16:17
Source