Dear wise Monks,

I found that useful script to calculate factorials of rational numbers:

# Pragmas. use strict; # Modules. use bignum; use Math::Complex; # Global variables. use vars qw($g $lanczos_coef); $g = 7; $lanczos_coef = [ 0.99999999999980993, 676.5203681218851, -1259.1392167224028, 771.32342877765313, -176.61502916214059, 12.507343278686905, -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7 ]; sub gamma_lanczos { my $z = shift; $z = Math::Complex->make($z); if (Re($z) < 0.5) { return pi / (sin(pi * $z) * gamma(1 - $z)); } else { $z -= 1; my $x = $lanczos_coef->[0]; foreach my $i (1 .. $g + 2) { $x += $lanczos_coef->[$i] / ($z + $i); } my $t = $z + $g + 0.5; return sqrt(2 * pi) * $t ** ($z + 0.5) * exp(-$t) * $x +; } } print gamma_lanczos(25.78), "\n"; system("pause");
But using it together with the bignum module returns the error message: Can't locate object method "_cartesian" via package "Math::BigInt". The Math::BigInt module is up to date. All I want to do is calculating factorials of rational numbers up to 999.9. Can someone help?

In reply to Factorials of rational numbers up to 999.9 by Microcebus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.