>> So I think this patch improves result for some input
>> while not make it worse for others.
>
> Yes.

So this patch is acceptable?

This improved version will speed up a little.
(Note that in ilog0, a is of higher degree than b, so we
test b first.)

diff --git a/src/algebra/irexpand.spad b/src/algebra/irexpand.spad
index 3e1ca4f7..7ca50d6d 100644
--- a/src/algebra/irexpand.spad
+++ b/src/algebra/irexpand.spad
@@ -104,6 +104,11 @@
 -- they differ by a constant so it's ok to do it from an IR
     tantrick(a, b) ==
       retractIfCan(a)@Union(Q, "failed") case Q => 2 * atan(-b/a)
+      sb := sign b
+      if sb case Z then return 2 * atan(a/b)
+      sa := sign a
+      if sa case Z then return 2 * atan(-b/a)
+      -- print("potentially noncontinuous"::OutputForm)
       2 * atan(a/b)

 -- transforms i log((a + i b) / (a - i b)) into a sum of real

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to