On Tuesday 23 November 2010, VictorMiller wrote:
> Thanks!  Then perhaps Sage should raise an exception when it gets back
> genus -1 from singular.

Here's what Hannes Schönemann from the Singular team replied to me when I 
reported this on [libsingular-devel]:

"""
Singular uses (currently) 32bit int on all platforms.
Here our overflow detection represents -1 as a result of a subtraction
as 4294967295.
Fix (in Singular/iparith.cc, routine jjMINUS_I):
--- iparith.cc  (Revision 13661)
+++ iparith.cc  (Arbeitskopie)
@@ -697,14 +697,18 @@
}
static BOOLEAN jjMINUS_I(leftv res, leftv u, leftv v)
{
-  unsigned int a=(unsigned int)(unsigned long)u->Data();
-  unsigned int b=(unsigned int)(unsigned long)v->Data();
+  void *ap=u->Data(); void *bp=v->Data();
+  int aa=(int)(long)ap;
+  int bb=(int)(long)bp;
+  int cc=aa-bb;
+  unsigned int a=(unsigned int)(unsigned long)ap;
+  unsigned int b=(unsigned int)(unsigned long)bp;
   unsigned int c=a-b;
  if (((Sy_bit(31)&a)!=(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
  {
     WarnS("int overflow(-), result may be wrong");
  }
-  res->data = (char *)((long)c);
+  res->data = (char *)((long)cc);
   return jjPLUSMINUS_Gen(res,u,v);
}
"""

It seems with the new patch the overflow would at least be detected? Can you 
give it a try?

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: [email protected]

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to