sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.36k stars 462 forks source link

PARI's qfbclassno() may give incorrect results #34801

Open yyyyx4 opened 1 year ago

yyyyx4 commented 1 year ago

Since #23986, Sage calls PARI's qfbclassno() to compute the class number of a quadratic order. However, the documentation for that PARI function says:

[...] this function only implements part of Shanks's method (which allows to speed it up considerably). It gives unconditionnally correct results for |D| < 2.10¹⁰, but may give incorrect results for larger values if the class group has many cyclic factors. We thus recommend to double-check results using the function quadclassunit [...]

Thus, Sage should probably default to quadclassunit() and only use qfbclassno() if proof=False is set.

CC: @tscholl2 @roed314

Component: number fields

Issue created by migration from https://trac.sagemath.org/ticket/34801

b1acktothefuture commented 1 week ago

Is this already taken care of here: #36184? @yyyyx4

yyyyx4 commented 6 days ago

No: The check there follows the recommendation in the PARI documentation for when to use quadclassunit() instead of qfbclassno(), but for the latter there still is a warning that the results could be incorrect even in a nonempty part of the range where the documentation recommends it should be used. In contrast, for quadclassunit() the PARI documentation promises that the results are correct assuming GRH.