Comment 5 for bug 515280

Revision history for this message
Robert Ancell (robert-ancell) wrote : Re: Taking the square root of the square root of negative one freezes

patch:
diff -Nur -x '*.orig' -x '*~' gcalctool-5.28.2/src/mp.c gcalctool-5.28.2.new/src/mp.c
--- gcalctool-5.28.2/src/mp.c 2009-12-16 10:24:32.000000000 +1100
+++ gcalctool-5.28.2.new/src/mp.c 2010-02-22 09:36:14.763690384 +1100
@@ -1705,8 +1705,10 @@
 void
 mp_sqrt(const MPNumber *x, MPNumber *z)
 {
- if (x->sign < 0)
+ if (x->sign < 0) {
         mperr("*** X NEGATIVE IN CALL TO SUBROUTINE MP_SQRT ***");
+ mp_set_from_integer(0, z);
+ }
     else if (x->sign == 0)
         mp_set_from_integer(0, z);
     else {