Closed blissGitHub closed 8 years ago
Hi,
Thanks for the report. Maybe the problem in calc flags (SEFLG_MOSEPH)?
Hi,
I've tried it with SEFLG_SWIEPH and SEFLG_JPLEPH too and those give the same Julian Number which is 2 minutes off when converted to UTC.....
Do you think this is something that can be fixed?
I hope it can be...
Thank you...
I think that can be a problem with float numbers in javascript... Something like:
0.1+0.2 0.30000000000000004
Are you using the ephemeris files in both programs? If you set the flag SEFLG_SWIEPH, you still need the epehemeris.
Hi,
Yes I am using all of the ephemeris files for both SEFLG_SWIEPH and SEFLG_JPLEPH....
The difference in the C version and Javascript version is: 2444663.425763 vs 2444663.4275476774
Starting from the 3rd decimal place the difference already shows....
This too big error, it should't be because of javacript. I'll test this case later. Any one else see this error?
Hi,
There is error in your code when you call swisseph from C version. geopos1 must contains 3 values: lon, lan, height. and the next argument is atpress not height. Full syntax is:
int32 swe_rise_trans(
double tjd_ut,
int32 ipl,
char *starname,
int32 epheflag,
int32 rsmi,
double *geopos, /* in [3] */
double atpress,
double attemp,
double *tret, /* out [1] */
char *serr /* out [AS_MAXCH] */
)
Hi, Ok, I've made the necessary changes. this is the new C version:
double geopos1[3] = {121.133333, 14.550000,1013.25}; double sunriseBeforeBirth1[10];
swe_rise_trans(2444663.309024, //julian date
SE_SUN, //planet num
starname, //starname
SEFLG_MOSEPH,// was 2
SE_CALC_RISE, //SE_CALC_RISE OR SE_CALC_SET
geopos1, //geopos
10,//was 1013.25,
26, //10
sunriseBeforeBirth1, //return value
serr); //serr
This is the output: 2444663.427548
Now this is the Javascript result: 2444663.4275476774
and this is the C result: 2444663.427548
Smaller difference.
Thank you very much and sorry for the false alarm....
Hi,
There is no difference, because of printf in C version makes round by default. Try to use:
printf("%.10f", sunriseBeforeBirth1[0]);
You'll see exact the save value.
Hi, Ok....just tried it..yes you are right... Thank you very much....
swe_rise_trans is not working for swift
Hi, The C version's result for swe_rise_trans for the same input and the Javascript Wrapper version's result for swe_rise_trans is off by 2 minutes.
Here is an actual example. In C to calculate the sunrise of the julian day = 2444663.309024 one would use this:
The result of this is in sunriseBeforeBirth1[0] and the value is 2444663.425763
In Javascript for the same julian day 2444663.309024 with the same input:
The result gives: { name: '', transitTime: 2444663.4275476774 }
In summary, the first line below is the result of swe_rise_trans from C and the second line is from Javascript for the same inputs(parameters). 2444663.425763 2444663.4275476774 From above, the third decimal place number is different and it is causing a 2 minute difference.
What's the reason for this? Can this be fixed? I would have expected it to have the same result since it is essentially the same API.... Thank you...