[GiNaC-devel] abs evaluation bug

Burcin Erocal burcin at erocal.org
Tue Feb 28 11:34:12 CET 2012


Hi,

automatic evaluation of the abs() function returns wrong results:

ginsh - GiNaC Interactive Shell (ginac V1.5.8)
  __,  _______  Copyright (C) 1999-2010 Johannes Gutenberg University Mainz,
 (__) *       | Germany.  This is free software with ABSOLUTELY NO WARRANTY.
  ._) i N a C | You are welcome to redistribute it under certain conditions.
<-------------' For details type `warranty;'.

Type ?? for a list of help topics.
> abs(Pi+I);
I+Pi


abs_eval() thinks that I + Pi is nonnegative, since numeric::is_negative()
returns false for complex numbers:

http://www.ginac.de/ginac.git?p=ginac.git;a=blob;f=ginac/numeric.cpp;h=f05763da1fe9d4ef231b6cbd88cd5018706ac5ff;hb=4077d8b144e2e5f3db75cf95fbb590981b2eb8d4#l1146


Any suggestions for a fix? Would it be acceptable to raise an error when
comparing complex numbers?


This was reported to Sage:

http://trac.sagemath.org/sage_trac/ticket/11155


Cheers,
Burcin


More information about the GiNaC-devel mailing list