mpf_class x("+0.73") aborts

Torbjorn Granlund tg at swox.com
Fri May 23 11:08:35 CEST 2008


"Pasquale Tricarico" <tricaric at gmail.com> writes:

  
  If you include a statement in your code such as
  
  #include <gmpxx.h>
  [...]
  mpf_class x("+0.73");
  
  or any other string in the form "+XYZ", it will abort at runtime with:
  
  terminate called after throwing an instance of 'std::invalid_argument'
    what():  mpf_set_str
  Aborted
  
  I believe that a signed string, with a plus, should be a valid
  argument. The same with a minus instead of a plus is valid, as it is
  an unsigned value, of course.
  
  Comments and solutions welcome.
  
None of the GMP input function accept a leading +, and gmpcc.h just
inherits its from mpz_set_str.

We will consider changing this for a future GMP release.

-- 
Torbjörn


More information about the gmp-bugs mailing list