Skip to content

Misc fixes#831

Merged
skirpichev merged 4 commits intompmath:masterfrom
skirpichev:misc
Aug 6, 2024
Merged

Misc fixes#831
skirpichev merged 4 commits intompmath:masterfrom
skirpichev:misc

Conversation

@skirpichev
Copy link
Copy Markdown
Collaborator

@skirpichev skirpichev commented Aug 3, 2024

skirpichev and others added 3 commits August 2, 2024 09:45
After python/cpython#121149 this was broken on CPython 3.14:

_______________ [doctest] mpmath.functions.orthogonal.spherharm ____________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> fp.chop(fp.quad(lambda t,p: Y1(t,p)*Y2(t,p)*dS(t,p), *sphere))
Expected:
    1.0000000000000007
Got:
    1.0000000000000004

This particular failure could be fixed by:
diff --git a/mpmath/ctx_base.py b/mpmath/ctx_base.py
index 3309bfa..2ca2fac 100644
--- a/mpmath/ctx_base.py
+++ b/mpmath/ctx_base.py
@@ -110,7 +110,8 @@ def fdot(ctx, xs, ys=None, conjugate=False):
             cf = ctx.conj
             return sum((x*cf(y) for (x,y) in xs), ctx.zero)
         else:
-            return sum((x*y for (x,y) in xs), ctx.zero)
+            return ctx.mpc(sum(((x*y).real for (x,y) in xs), ctx.zero),
+                           sum(((x*y).imag for (x,y) in xs), ctx.zero))

     def fprod(ctx, args):
         prod = ctx.one

But this is just one case for the whole test suite...
@skirpichev skirpichev merged commit f9099fc into mpmath:master Aug 6, 2024
@skirpichev skirpichev deleted the misc branch August 6, 2024 04:06
@skirpichev skirpichev added this to the 1.4 milestone May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

format(mpf(3.14), '') raises ValueError

2 participants