Math::...igFloat(3pm)

πŸ’– Math::Prime::Util::ZetaBigFloat β€” bestie edition πŸ’–

okay so quick lil intro: this is the manual for Math::Prime::Util::ZetaBigFloat, a Perl module, and it lives in the User Contributed Perl Documentation section (section 3pm, iykyk).


✨ NAME ✨

Math::Prime::Util::ZetaBigFloat β€” the Perl Big Float versions of Riemann Zeta and R functions. that's the whole vibe. πŸŽ€


🌸 VERSION 🌸

Version 0.74, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

These are the Math::BigFloat versions of the Riemann Zeta and Riemann R functions. They're kept in their own separate module on purpose β€” like, they drag in a whole bunch of big tables, and we'd really prefer to only load all of that if we actually need it. main character energy but make it lazy-loaded. πŸ’…


⭐ DESCRIPTION ⭐

Pure Perl implementations of Riemann Zeta and Riemann R, using Math::BigFloat. These functions get used when:

  • the input is a BigInt, a BigFloat, or the bignum module has been loaded, OR
  • the Math::Prime::Util::GMP module isn't available, or is old.
if you use these functions a LOT, bestie, i am literally begging you β€” please install Math::Prime::Util::GMP, because the main Math::Prime::Util functions will find it on their own. it gives you much better performance and better accuracy too. you can also use Math::Pari and Math::MPFR for the Riemann Zeta function. 🫢

πŸ”₯ FUNCTIONS πŸ”₯

πŸ’œ RiemannZeta

my $z = RiemannZeta($s);

Give it a floating point input s where s >= 0.5, and it hands you back the floating point value of ΞΆ(s)βˆ’1, where ΞΆ(s) is the Riemann zeta function. yes, we subtract one on purpose β€” that's so you get maximum precision for large values of s. the zeta function itself is the sum from k=1 to infinity of 1 / k^s, iconic formula, we love her. ✨

Results get calculated using either Borwein (1991) algorithm 2, or the basic series. it attempts full input accuracy, but ngl there are defects in Math::BigFloat with high accuracy computations that make this genuinely difficult. 😭

πŸ’– RiemannR

my $r = RiemannR($x);

Give it a positive non-zero floating point input, and it returns the floating point value of Riemann's R function. Riemann's R function gives a very close approximation to the prime counting function. slay. πŸ‘‘

Accuracy should be about 35 digits.


😭 LIMITATIONS 😭

Bugs in Math::BigFloat (RT 43692, RT 77105) cause many problems with this code. I've attempted to work around them, but it is possible there are cases they miss.

The accuracy goals (35 digits) are sometimes missed by a digit or two. tragic but true. πŸ’€


πŸ’€ PERFORMANCE πŸ’€

Performance is quite bad. like, genuinely. that's it, that's the whole section. πŸ™ˆ


🌈 SEE ALSO 🌈

  • Math::Prime::Util
  • Math::Prime::Util::GMP
  • Math::MPFR
  • Math::Pari

πŸ‘‘ AUTHORS πŸ‘‘

Dana Jacobsen <dana@acm.org>


Copyright 2012 by Dana Jacobsen <dana@acm.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page, you ate that fr fr 🧚 β€” this was perl v5.42.3, dated 2026-08-20. go forth and compute, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from