Skip Menu |
 

This queue is for tickets about the DateTime-Event-Lunar CPAN distribution.

Report information
The Basics
Id: 31157
Status: open
Priority: 0/
Queue: DateTime-Event-Lunar

People
Owner: Nobody in particular
Requestors: FLIP [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.06
Fixed in: (no value)



Subject: Incorrect Values for 1800 to 1988 (lunations 22251 to 24575)
Download (untitled) / with headers
text/plain 6.2k
There seems to be a major problem with the calculations. Between lunation 22250 (Dec 1799) and 22251 (Jan 1800) the module calculates a month of 3 days and then is wildly divergent from values reported elsewhere. It returns to reasonable after 24575 (Dec 1987), at 24576 (Jan 1988). I'm comparing the output of this module against official NASA calculations: http://sunearth.gsfc.nasa.gov/eclipse/phase/phasecat.html and the Munich Astro Archive: http://www.maa.mhn.de/StarDate/ They agree with each other but not with the output I'm seeing. Here's a snippet that demonstrates the issue (note the new moons on december 26th and on jan 1st): perl -e ' use DateTime::Event::Lunar; use DateTime::Util::Astro::Moon qw(nth_new_moon); print $DateTime::Event::Lunar::VERSION, " -- ", $DateTime::Util::Astro::Moon::VERSION, "\n"; @lunations = (0,22248..22254, 24573..24579); my $fmt= "%-8s %-20s %-20s %-20s %-10s\n"; printf $fmt, "lunation","Estimated","From Phase","From new_moon","RD for new_moon"; map { my $moonest = nth_new_moon($_); my $newmoon = DateTime::Event::Lunar->new_moon_after(datetime=>$moonest,on_or_after=>1); my $newmoonph = DateTime::Event::Lunar->lunar_phase_after(datetime=>$moonest, $phase=>NEW_MOON); printf $fmt, $_, $moonest, $newmoonph, $newmoon, join ",",$newmoon->utc_rd_values; } @lunations;' lunation Estimated From Phase From new_moon RD new_moon -- NASA values --- 22248 1799-10-28T17:20:02 1799-10-28T17:21:06 1799-10-28T17:20:02 56765467202 1799 Oct 28 17:20 OK 22249 1799-11-27T03:38:11 1799-11-27T03:39:08 1799-11-27T03:38:11 56768009891 1799 Nov 27 03:38 OK 22250 1799-12-26T14:55:38 1799-12-26T14:56:23 1799-12-26T14:55:38 56770556138 1799 Dec 26 14:56 OK 22251 1800-01-01T04:14:44 1800-01-01T04:15:17 1800-01-01T04:14:44 56771036084 1800 Jan 25 03:21 BAD 22252 1800-01-30T18:02:08 1800-01-30T18:02:41 1800-01-30T18:02:08 56773591328 1800 Feb 23 17:08 BAD 22253 1800-03-01T09:15:03 1800-03-01T09:15:23 1800-03-01T09:15:03 56776151703 1800 Mar 25 08:21 BAD 22254 1800-03-31T01:24:47 1800-03-31T01:25:13 1800-03-31T01:24:47 56778715487 1800 Apr 24 00:31 BAD lunation Estimated From Phase From new_moon RD new_moon -- NASA values --- 24573 1987-10-21T10:26:08 1987-10-21T10:26:47 1987-10-21T10:26:08 62697493568 1987 Oct 22 17:28 BAD 24574 1987-11-19T23:31:06 1987-11-19T23:31:41 1987-11-19T23:31:06 62700046266 1987 Nov 21 06:33 BAD 24575 1987-12-19T11:23:28 1987-12-19T11:24:13 1987-12-19T11:23:28 62702594608 1987 Dec 20 18:25 BAD 24576 1988-01-19T05:25:30 1988-01-19T05:26:15 1988-01-19T05:25:30 62705251530 1988 Jan 19 05:26 OK 24577 1988-02-17T15:54:08 1988-02-17T15:54:47 1988-02-17T15:54:08 62707794848 1988 Feb 17 15:54 OK 24578 1988-03-18T02:02:13 1988-03-18T02:02:54 1988-03-18T02:02:13 62710336933 1988 Mar 18 02:02 OK 24579 1988-04-16T11:59:53 1988-04-16T12:00:38 1988-04-16T11:59:53 62712878393 1988 Apr 16 12:00 OK lunation Estimated From Phase From new_moon RD new_moon -- NASA values --- If I plot this against the first order estimate rataDie_seconds = ( 11.4563 + 29.5305888531*n )* 60*60*24 (that's the date of the first new moon plus n months, converted to seconds ), the error spikes upward at 1800 and relaxes back to zero, with scattered large negative spikes; the error is small for lunations ~23000 to ~24000 before a small spike, and behaving again after 24576. I've tried this on two different machines (debian Linux and OSX), and appended perl -V from the debian machine below. I seem to have all of Pari, GMP, and BigFloat installed on the debian; (I think no GMP on the OSX box). Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.15.7, archname=i486-linux-gnu-thread-multi uname='linux rothera 2.6.15.7 #1 smp sat sep 30 10:21:42 utc 2006 i686 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.8 -Dsitearch=/usr/local/lib/perl/5.8.8 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.8 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.1.2 (Ubuntu 4.1.2-0ubuntu4)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/public/share/perl/lib /usr/local/lib /lib /usr/lib libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8 gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Mar 6 2007 01:40:14
Download (untitled) / with headers
text/plain 1.2k
Here's a hopefully more readable version of the table. NASA values come from http://sunearth.gsfc.nasa.gov/eclipse/phase/phasecat.html lun# From new_moon RataDie sec -- NASA values --- 22248 1799-10-28T17:20:02 56765467202 1799 Oct 28 17:20 OK 22249 1799-11-27T03:38:11 56768009891 1799 Nov 27 03:38 OK 22250 1799-12-26T14:55:38 56770556138 1799 Dec 26 14:56 OK 22251 1800-01-01T04:14:44 56771036084 1800 Jan 25 03:21 BAD 22252 1800-01-30T18:02:08 56773591328 1800 Feb 23 17:08 BAD 22253 1800-03-01T09:15:03 56776151703 1800 Mar 25 08:21 BAD 22254 1800-03-31T01:24:47 56778715487 1800 Apr 24 00:31 BAD lun# From new_moon RataDie sec -- NASA values --- 24573 1987-10-21T10:26:08 62697493568 1987 Oct 22 17:28 BAD 24574 1987-11-19T23:31:06 62700046266 1987 Nov 21 06:33 BAD 24575 1987-12-19T11:23:28 62702594608 1987 Dec 20 18:25 BAD 24576 1988-01-19T05:25:30 62705251530 1988 Jan 19 05:26 OK 24577 1988-02-17T15:54:08 62707794848 1988 Feb 17 15:54 OK 24578 1988-03-18T02:02:13 62710336933 1988 Mar 18 02:02 OK 24579 1988-04-16T11:59:53 62712878393 1988 Apr 16 12:00 OK lun# From new_moon RataDie sec -- NASA values ---
From: DMAKI [...] cpan.org
Download (untitled) / with headers
text/plain 363b
Thanks for the very thorough bug report. I really appreciate it (it's a pretty rare occurance ;) However, due to $work and other stuff, I won't have much time to spend on this for some time. I'll try to do my best to look into this, but in the meantime, if you could assist me by getting into the guts of the module further, that would be wonderful. Thanks, --d
Download (untitled) / with headers
text/plain 488b
Okay, taking a wild guess here. First, I think this bug should be in DateTime::Util::Astro, not Event::Lunar, as it affects nth_new_moon, which is from DateTime::Util::Astro::Moon the dates that you specify perfectly correlate to the calculations in ephemeris_correction() (EC2 and EC3). It's quite possible that the values in these two equations are wrong. I don't have my copy of calendrical calculations handy at the moment so I can't confirm, but I think that's where the error is.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.