cyjoelchen / php-sweph

PHP Extension for Swiss Ephemeris
Other
63 stars 29 forks source link

swe_lat_to_lmt problem ? #73

Closed astrorigin closed 3 years ago

astrorigin commented 3 years ago

I fail to understand why the test for swe_lat_to_lmt does not result in tjd_lmt = 2452275.5000 like in C and Python.

(Its counterpart swe_lmt_to_lat seems ok...)

#include <stdlib.h>
#include "swephexp.h"

int main(void)
{
    double tjd_lat = 2452275.4978254;
    double tjd_lmt;
    int i;
    char serr[256];
    double geolon = 121.34;

    swe_set_ephe_path(NULL);
    i = swe_lat_to_lmt(tjd_lat, geolon, &tjd_lmt, serr);
    if (i != 0)
        exit(1);
    printf("tjd_lmt = %f\n", tjd_lmt);
    return 0;
}
aloistr commented 3 years ago

The error was in line 5012 of sweph.c, where the wrong function was called. Thank you for pointing out this error.

The fix was so simple that I pushed directly to the master branch.

kevindecapite commented 3 years ago

Fix: https://github.com/cyjoelchen/php-sweph/commit/5d5069f43a6036c9010b1f54aca211aed2c00cac