sweph 2.10.3-4 → 2.10.3-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,9 @@ This library is version locked to the Swiss Ephemeris in addition to its own rev
38
38
 
39
39
  Updates to this library will be released under new revisions, while updates to Swiss Ephemeris will be released under matching SemVer versions.
40
40
 
41
+ **Current Version: 2.10.3-b-1**
42
+ **Equivalent to Swiss Ephemeris version: 2.10.03b revision 1**
43
+
41
44
  ## Documentation
42
45
 
43
46
  This library is fully typed and documented via intellisense. To access its documentation simply hover over its functions in your favorite code editor:
package/binding.gyp CHANGED
@@ -14,7 +14,8 @@
14
14
  "swisseph"
15
15
  ],
16
16
  "defines": [
17
- "NAPI_DISABLE_CPP_EXCEPTIONS"
17
+ "NAPI_DISABLE_CPP_EXCEPTIONS",
18
+ 'NAPI_VERSION=6'
18
19
  ]
19
20
  },
20
21
  {
package/index.js CHANGED
@@ -1,7 +1,16 @@
1
- "use strict";
2
-
3
- const sweph = require("./build/Release/sweph.node");
4
- sweph.constants = require("./constants.js");
5
- sweph.sweph = sweph;
6
- sweph.default = sweph;
7
- module.exports = sweph;
1
+ /// <reference path="index.d.ts"/>
2
+ "use strict";
3
+
4
+ /** @type {Omit<import("sweph"), "constants" | "sweph" | "default">} */
5
+ // @ts-ignore
6
+ const s = require("node-gyp-build")(__dirname);
7
+ const c = require("./constants.js");
8
+
9
+ const sweph = {
10
+ ...s,
11
+ constants: c,
12
+ sweph: s,
13
+ default: s
14
+ }
15
+
16
+ module.exports = sweph;
package/index.mjs CHANGED
@@ -1,109 +1,116 @@
1
1
  import { createRequire } from "module";
2
+ import { fileURLToPath } from "url";
2
3
  import c from "./constants.js";
3
4
 
5
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
4
6
  const require = createRequire(import.meta.url);
5
- export const sweph = require("./build/Release/sweph.node");
6
7
 
7
- sweph.constants = c;
8
- sweph.sweph = sweph;
9
- sweph.default = sweph;
8
+ /** @type {Omit<import("sweph"), "constants" | "sweph" | "default">} */
9
+ const s = require("node-gyp-build")(__dirname);
10
+
11
+ export const sweph = {
12
+ ...s,
13
+ constants: c,
14
+ sweph: s,
15
+ default: s
16
+ }
10
17
 
11
18
  export default sweph;
12
- export const constants = sweph.constants;
13
- export const close = sweph.close;
14
- export const set_delta_t_userdef = sweph.set_delta_t_userdef;
15
- export const set_ephe_path = sweph.set_ephe_path;
16
- export const set_jpl_file = sweph.set_jpl_file;
17
- export const set_sid_mode = sweph.set_sid_mode;
18
- export const set_tid_acc = sweph.set_tid_acc;
19
- export const set_topo = sweph.set_topo;
20
- export const version = sweph.version;
21
- export const get_library_path = sweph.get_library_path;
22
- export const get_tid_acc = sweph.get_tid_acc;
23
- export const get_planet_name = sweph.get_planet_name;
24
- export const get_current_file_data = sweph.get_current_file_data;
25
- export const get_orbital_elements = sweph.get_orbital_elements;
26
- export const get_ayanamsa_name = sweph.get_ayanamsa_name;
27
- export const get_ayanamsa_ex_ut = sweph.get_ayanamsa_ex_ut;
28
- export const get_ayanamsa_ex = sweph.get_ayanamsa_ex;
29
- export const get_ayanamsa_ut = sweph.get_ayanamsa_ut;
30
- export const get_ayanamsa = sweph.get_ayanamsa;
31
- export const calc = sweph.calc;
32
- export const calc_ut = sweph.calc_ut;
33
- export const calc_pctr = sweph.calc_pctr;
34
- export const fixstar = sweph.fixstar;
35
- export const fixstar_ut = sweph.fixstar_ut;
36
- export const fixstar_mag = sweph.fixstar_mag;
37
- export const fixstar2 = sweph.fixstar2;
38
- export const fixstar2_ut = sweph.fixstar2_ut;
39
- export const fixstar2_mag = sweph.fixstar2_mag;
40
- export const nod_aps = sweph.nod_aps;
41
- export const nod_aps_ut = sweph.nod_aps_ut;
42
- export const orbit_max_min_true_distance = sweph.orbit_max_min_true_distance;
43
- export const sol_eclipse_when_loc = sweph.sol_eclipse_when_loc;
44
- export const sol_eclipse_when_glob = sweph.sol_eclipse_when_glob;
45
- export const sol_eclipse_how = sweph.sol_eclipse_how;
46
- export const sol_eclipse_where = sweph.sol_eclipse_where;
47
- export const lun_occult_when_loc = sweph.lun_occult_when_loc;
48
- export const lun_occult_when_glob = sweph.lun_occult_when_glob;
49
- export const lun_occult_where = sweph.lun_occult_where;
50
- export const lun_eclipse_when_loc = sweph.lun_eclipse_when_loc;
51
- export const lun_eclipse_when = sweph.lun_eclipse_when;
52
- export const lun_eclipse_how = sweph.lun_eclipse_how;
53
- export const rise_trans = sweph.rise_trans;
54
- export const rise_trans_true_hor = sweph.rise_trans_true_hor;
55
- export const pheno = sweph.pheno;
56
- export const pheno_ut = sweph.pheno_ut;
57
- export const azalt = sweph.azalt;
58
- export const azalt_rev = sweph.azalt_rev;
59
- export const refrac = sweph.refrac;
60
- export const refrac_extended = sweph.refrac_extended;
61
- export const heliacal_ut = sweph.heliacal_ut;
62
- export const vis_limit_mag = sweph.vis_limit_mag;
63
- export const heliacal_pheno_ut = sweph.heliacal_pheno_ut;
64
- export const julday = sweph.julday;
65
- export const date_conversion = sweph.date_conversion;
66
- export const revjul = sweph.revjul;
67
- export const utc_time_zone = sweph.utc_time_zone;
68
- export const utc_to_jd = sweph.utc_to_jd;
69
- export const jdet_to_utc = sweph.jdet_to_utc;
70
- export const jdut1_to_utc = sweph.jdut1_to_utc;
71
- export const time_equ = sweph.time_equ;
72
- export const lmt_to_lat = sweph.lmt_to_lat;
73
- export const lat_to_lmt = sweph.lat_to_lmt;
74
- export const deltat = sweph.deltat;
75
- export const deltat_ex = sweph.deltat_ex;
76
- export const house_name = sweph.house_name;
77
- export const houses = sweph.houses;
78
- export const houses_armc = sweph.houses_armc;
79
- export const houses_armc_ex2 = sweph.houses_armc_ex2;
80
- export const houses_ex = sweph.houses_ex;
81
- export const houses_ex2 = sweph.houses_ex2;
82
- export const house_pos = sweph.house_pos;
83
- export const gauquelin_sector = sweph.gauquelin_sector;
84
- export const sidtime = sweph.sidtime;
85
- export const sidtime0 = sweph.sidtime0;
86
- export const cotrans = sweph.cotrans;
87
- export const cotrans_sp = sweph.cotrans_sp;
88
- export const degnorm = sweph.degnorm;
89
- export const radnorm = sweph.radnorm;
90
- export const split_deg = sweph.split_deg;
91
- export const csnorm = sweph.csnorm;
92
- export const difcsn = sweph.difcsn;
93
- export const difdegn = sweph.difdegn;
94
- export const difcs2n = sweph.difcs2n;
95
- export const difdeg2n = sweph.difdeg2n;
96
- export const csroundsec = sweph.csroundsec;
97
- export const d2l = sweph.d2l;
98
- export const day_of_week = sweph.day_of_week;
99
- export const cs2timestr = sweph.cs2timestr;
100
- export const cs2lonlatstr = sweph.cs2lonlatstr;
101
- export const cs2degstr = sweph.cs2degstr;
102
- export const solcross = sweph.solcross;
103
- export const solcross_ut = sweph.solcross_ut;
104
- export const mooncross = sweph.mooncross;
105
- export const mooncross_ut = sweph.mooncross_ut;
106
- export const mooncross_node = sweph.mooncross_node;
107
- export const mooncross_node_ut = sweph.mooncross_node_ut;
108
- export const helio_cross = sweph.helio_cross;
109
- export const helio_cross_ut = sweph.helio_cross_ut;
19
+ export const constants = c;
20
+ export const close = s.close;
21
+ export const set_delta_t_userdef = s.set_delta_t_userdef;
22
+ export const set_ephe_path = s.set_ephe_path;
23
+ export const set_jpl_file = s.set_jpl_file;
24
+ export const set_sid_mode = s.set_sid_mode;
25
+ export const set_tid_acc = s.set_tid_acc;
26
+ export const set_topo = s.set_topo;
27
+ export const version = s.version;
28
+ export const get_library_path = s.get_library_path;
29
+ export const get_tid_acc = s.get_tid_acc;
30
+ export const get_planet_name = s.get_planet_name;
31
+ export const get_current_file_data = s.get_current_file_data;
32
+ export const get_orbital_elements = s.get_orbital_elements;
33
+ export const get_ayanamsa_name = s.get_ayanamsa_name;
34
+ export const get_ayanamsa_ex_ut = s.get_ayanamsa_ex_ut;
35
+ export const get_ayanamsa_ex = s.get_ayanamsa_ex;
36
+ export const get_ayanamsa_ut = s.get_ayanamsa_ut;
37
+ export const get_ayanamsa = s.get_ayanamsa;
38
+ export const calc = s.calc;
39
+ export const calc_ut = s.calc_ut;
40
+ export const calc_pctr = s.calc_pctr;
41
+ export const fixstar = s.fixstar;
42
+ export const fixstar_ut = s.fixstar_ut;
43
+ export const fixstar_mag = s.fixstar_mag;
44
+ export const fixstar2 = s.fixstar2;
45
+ export const fixstar2_ut = s.fixstar2_ut;
46
+ export const fixstar2_mag = s.fixstar2_mag;
47
+ export const nod_aps = s.nod_aps;
48
+ export const nod_aps_ut = s.nod_aps_ut;
49
+ export const orbit_max_min_true_distance = s.orbit_max_min_true_distance;
50
+ export const sol_eclipse_when_loc = s.sol_eclipse_when_loc;
51
+ export const sol_eclipse_when_glob = s.sol_eclipse_when_glob;
52
+ export const sol_eclipse_how = s.sol_eclipse_how;
53
+ export const sol_eclipse_where = s.sol_eclipse_where;
54
+ export const lun_occult_when_loc = s.lun_occult_when_loc;
55
+ export const lun_occult_when_glob = s.lun_occult_when_glob;
56
+ export const lun_occult_where = s.lun_occult_where;
57
+ export const lun_eclipse_when_loc = s.lun_eclipse_when_loc;
58
+ export const lun_eclipse_when = s.lun_eclipse_when;
59
+ export const lun_eclipse_how = s.lun_eclipse_how;
60
+ export const rise_trans = s.rise_trans;
61
+ export const rise_trans_true_hor = s.rise_trans_true_hor;
62
+ export const pheno = s.pheno;
63
+ export const pheno_ut = s.pheno_ut;
64
+ export const azalt = s.azalt;
65
+ export const azalt_rev = s.azalt_rev;
66
+ export const refrac = s.refrac;
67
+ export const refrac_extended = s.refrac_extended;
68
+ export const heliacal_ut = s.heliacal_ut;
69
+ export const vis_limit_mag = s.vis_limit_mag;
70
+ export const heliacal_pheno_ut = s.heliacal_pheno_ut;
71
+ export const julday = s.julday;
72
+ export const date_conversion = s.date_conversion;
73
+ export const revjul = s.revjul;
74
+ export const utc_time_zone = s.utc_time_zone;
75
+ export const utc_to_jd = s.utc_to_jd;
76
+ export const jdet_to_utc = s.jdet_to_utc;
77
+ export const jdut1_to_utc = s.jdut1_to_utc;
78
+ export const time_equ = s.time_equ;
79
+ export const lmt_to_lat = s.lmt_to_lat;
80
+ export const lat_to_lmt = s.lat_to_lmt;
81
+ export const deltat = s.deltat;
82
+ export const deltat_ex = s.deltat_ex;
83
+ export const house_name = s.house_name;
84
+ export const houses = s.houses;
85
+ export const houses_armc = s.houses_armc;
86
+ export const houses_armc_ex2 = s.houses_armc_ex2;
87
+ export const houses_ex = s.houses_ex;
88
+ export const houses_ex2 = s.houses_ex2;
89
+ export const house_pos = s.house_pos;
90
+ export const gauquelin_sector = s.gauquelin_sector;
91
+ export const sidtime = s.sidtime;
92
+ export const sidtime0 = s.sidtime0;
93
+ export const cotrans = s.cotrans;
94
+ export const cotrans_sp = s.cotrans_sp;
95
+ export const degnorm = s.degnorm;
96
+ export const radnorm = s.radnorm;
97
+ export const split_deg = s.split_deg;
98
+ export const csnorm = s.csnorm;
99
+ export const difcsn = s.difcsn;
100
+ export const difdegn = s.difdegn;
101
+ export const difcs2n = s.difcs2n;
102
+ export const difdeg2n = s.difdeg2n;
103
+ export const csroundsec = s.csroundsec;
104
+ export const d2l = s.d2l;
105
+ export const day_of_week = s.day_of_week;
106
+ export const cs2timestr = s.cs2timestr;
107
+ export const cs2lonlatstr = s.cs2lonlatstr;
108
+ export const cs2degstr = s.cs2degstr;
109
+ export const solcross = s.solcross;
110
+ export const solcross_ut = s.solcross_ut;
111
+ export const mooncross = s.mooncross;
112
+ export const mooncross_ut = s.mooncross_ut;
113
+ export const mooncross_node = s.mooncross_node;
114
+ export const mooncross_node_ut = s.mooncross_node_ut;
115
+ export const helio_cross = s.helio_cross;
116
+ export const helio_cross_ut = s.helio_cross_ut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sweph",
3
- "version": "2.10.3-4",
3
+ "version": "2.10.3-5",
4
4
  "description": "The definitive Swiss Ephemeris bindings for Node.js",
5
5
  "keywords": [
6
6
  "sweph",
@@ -21,9 +21,9 @@
21
21
  "license": "(AGPL-3.0-or-later OR LGPL-3.0-or-later)",
22
22
  "author": "Timotej Valentin Rojko",
23
23
  "exports": {
24
+ "types": "./index.d.ts",
24
25
  "require": "./index.js",
25
- "import": "./index.mjs",
26
- "types": "./index.d.ts"
26
+ "import": "./index.mjs"
27
27
  },
28
28
  "main": "index.js",
29
29
  "types": "./index.d.ts",
@@ -32,6 +32,7 @@
32
32
  "./index.mjs",
33
33
  "./index.d.ts",
34
34
  "./constants.js",
35
+ "./prebuilds",
35
36
  "./binding.gyp",
36
37
  "./swisseph",
37
38
  "./src/functions",
@@ -40,13 +41,16 @@
40
41
  ],
41
42
  "scripts": {
42
43
  "preinstall": "node -e \"const { readdirSync, readFileSync, writeFileSync } = require('fs'); const file = readdirSync('./src/functions').map((x,i) => readFileSync('./src/functions/' + x, 'utf8').replace(/args/g, 'args' + i).replace('#include <sweph.h>', '')).reduce((a,b) => a + b, '#include <sweph.h>'); writeFileSync('./src/functions.cpp', file, 'utf8');\"",
43
- "install": "node-gyp rebuild && npm run test",
44
- "test": "node -e \"const s = require('./'); const c = s.calc(2222222,0,4); console.log('OK')\""
44
+ "rebuild": "node-gyp rebuild && npm run test",
45
+ "test": "node -e \"const s = require('./'); const c = s.calc(2222222,0,4); console.log('OK')\"",
46
+ "install": "node-gyp-build && npm run test",
47
+ "prebuild": "prebuildify --napi --strip"
45
48
  },
46
49
  "dependencies": {
47
- "node-addon-api": "*"
50
+ "node-addon-api": "^8.7.0",
51
+ "node-gyp-build": "^4.8.4"
48
52
  },
49
53
  "devDependencies": {
50
- "eslint": "^8.44.0"
54
+ "prebuildify": "^6.0.1"
51
55
  }
52
56
  }
Binary file
Binary file
Binary file
package/swisseph/swecl.c CHANGED
@@ -771,7 +771,7 @@ iter_where:
771
771
  } else {
772
772
  if (serr != NULL)
773
773
  sprintf(serr, "no solar eclipse at tjd = %f", tjd);
774
- for (i = 0; i < 10; i++)
774
+ for (i = 0; i < 2; i++)
775
775
  geopos[i] = 0;
776
776
  *dcore = 0;
777
777
  retc = 0;
@@ -1991,7 +1991,7 @@ end_search_global:
1991
1991
  * SE_ECL_VISIBLE,
1992
1992
  * SE_ECL_MAX_VISIBLE,
1993
1993
  * SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
1994
- * SE_ECL_3ST_VISIBLE, SE_ECL_4ND_VISIBLE
1994
+ * SE_ECL_3RD_VISIBLE, SE_ECL_4TH_VISIBLE
1995
1995
  *
1996
1996
  * tret[0] time of maximum eclipse
1997
1997
  * tret[1] time of first contact
@@ -2048,7 +2048,7 @@ int32 CALL_CONV swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
2048
2048
  * SE_ECL_VISIBLE,
2049
2049
  * SE_ECL_MAX_VISIBLE,
2050
2050
  * SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
2051
- * SE_ECL_3ST_VISIBLE, SE_ECL_4ND_VISIBLE
2051
+ * SE_ECL_3RD_VISIBLE, SE_ECL_4TH_VISIBLE
2052
2052
  * SE_ECL_OCC_BEG_DAYLIGHT, SE_ECL_OCC_END_DAYLIGHT
2053
2053
  * The latter two indicate that the beginning or end of the occultation takes
2054
2054
  * place during the day. If Venus is occulted, it may be observable with the
@@ -2103,7 +2103,7 @@ static int32 eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, doubl
2103
2103
  int32 retflag = 0, retc;
2104
2104
  double t, tjd, dt, dtint, K, T, T2, T3, T4, F, M, Mm;
2105
2105
  double tjdr, tjds;
2106
- double E, Ff, A1, Om;
2106
+ double E, Ff; // A1, Om;
2107
2107
  double xs[6], xm[6], ls[6], lm[6], x1[6], x2[6], dm, ds;
2108
2108
  double rmoon, rsun, rsplusrm, rsminusrm;
2109
2109
  double dc[3], dctr, dctrmin;
@@ -2149,16 +2149,14 @@ next_try:
2149
2149
  + 0.1017438 * T2
2150
2150
  + 0.00001239 * T3
2151
2151
  + 0.000000058 * T4);
2152
- Om = swe_degnorm(124.7746 - 1.56375580 * K
2153
- + 0.0020691 * T2
2154
- + 0.00000215 * T3);
2152
+ // Om = swe_degnorm(124.7746 - 1.56375580 * K + 0.0020691 * T2 + 0.00000215 * T3);
2155
2153
  E = 1 - 0.002516 * T - 0.0000074 * T2;
2156
- A1 = swe_degnorm(299.77 + 0.107408 * K - 0.009173 * T2);
2154
+ // A1 = swe_degnorm(299.77 + 0.107408 * K - 0.009173 * T2);
2157
2155
  M *= DEGTORAD;
2158
2156
  Mm *= DEGTORAD;
2159
2157
  F *= DEGTORAD;
2160
- Om *= DEGTORAD;
2161
- A1 *= DEGTORAD;
2158
+ // Om *= DEGTORAD;
2159
+ // A1 *= DEGTORAD;
2162
2160
  tjd = tjd - 0.4075 * sin(Mm)
2163
2161
  + 0.1721 * E * sin(M);
2164
2162
  swe_set_topo(geopos[0], geopos[1], geopos[2]);
@@ -4213,7 +4211,6 @@ static int32 rise_set_fast(
4213
4211
  int i;
4214
4212
  double xx[6], xaz[6], xaz2[6];
4215
4213
  double dd, dt, refr;
4216
- double dtsum = 0;
4217
4214
  int32 iflag = epheflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
4218
4215
  int32 iflagtopo = iflag | SEFLG_EQUATORIAL;
4219
4216
  double sda, armc, md, dmd, mdrise, rdi, tr, dalt;
@@ -4307,9 +4304,11 @@ run_rise_again:
4307
4304
  dd = (xaz2[1] - xaz[1]);
4308
4305
  dalt = xaz[1] + rdi;
4309
4306
  dt = dalt / dd / 1000.0;
4310
- if (dt > 0.1) dt = 0.1;
4311
- else if (dt < -0.1) dt = -0.1;
4312
- dtsum += dt;
4307
+ if (dt > 0.1) {
4308
+ dt = 0.1;
4309
+ } else if (dt < -0.1) {
4310
+ dt = -0.1;
4311
+ }
4313
4312
  if ((0) && fabs(dt) > 5.0 / 86400.0 && nloop < 20)
4314
4313
  nloop++;
4315
4314
  tr -= dt;
@@ -4403,8 +4402,8 @@ int32 CALL_CONV swe_rise_trans_true_hor(
4403
4402
  double t, te, tt, dt, twohrs = 1.0 / 12.0;
4404
4403
  double curdist;
4405
4404
  int32 tohor_flag = SE_EQU2HOR;
4406
- int nazalt = 0;
4407
- int ncalc = 0;
4405
+ int nazalt = 0;
4406
+ int ncalc = 0;
4408
4407
  AS_BOOL do_fixstar = (starname != NULL && *starname != '\0');
4409
4408
  if (geopos[2] < SEI_ECL_GEOALT_MIN || geopos[2] > SEI_ECL_GEOALT_MAX) {
4410
4409
  if (serr != NULL)
@@ -4676,8 +4675,8 @@ nazalt++;
4676
4675
  }
4677
4676
  if (t > tjd_ut) {
4678
4677
  *tret = t;
4679
- // fprintf(stderr, "nazalt=%d\n", nazalt);
4680
- // fprintf(stderr, "ncalc=%d\n", ncalc);
4678
+ if (0) fprintf(stderr, "nazalt=%d\n", nazalt);
4679
+ if (0) fprintf(stderr, "ncalc=%d\n", ncalc);
4681
4680
  return OK;
4682
4681
  }
4683
4682
  }
@@ -5782,7 +5781,7 @@ int32 CALL_CONV swe_get_orbital_elements(
5782
5781
  int32 iflJ2000 = (iflag & SEFLG_EPHMASK)|SEFLG_J2000|SEFLG_XYZ|SEFLG_TRUEPOS|SEFLG_NONUT|SEFLG_SPEED;
5783
5782
  int32 iflJ2000p = (iflag & SEFLG_EPHMASK)|SEFLG_J2000|SEFLG_TRUEPOS|SEFLG_NONUT|SEFLG_SPEED;
5784
5783
  double Gmsm;
5785
- int32 iflg0 = 0;
5784
+ // int32 iflg0 = 0;
5786
5785
  double fac, sgn, rxy, rxyz, c2, cosnode, sinnode;
5787
5786
  double incl, node, parg, peri, mlon;
5788
5787
  double csid, ctro, csyn, dmot, pa;
@@ -5795,8 +5794,7 @@ int32 CALL_CONV swe_get_orbital_elements(
5795
5794
  sprintf(serr, "error in swe_get_orbital_elements(): object %d not valid\n", ipl);
5796
5795
  return ERR;
5797
5796
  }
5798
- if (ipl != SE_MOON)
5799
- iflg0 |= SEFLG_HELCTR;
5797
+ // if (ipl != SE_MOON) iflg0 |= SEFLG_HELCTR;
5800
5798
  /* first, we need a heliocentric distance of the planet */
5801
5799
  if (swe_calc(tjd_et, ipl, iflJ2000p, x, serr) == ERR)
5802
5800
  return ERR;
package/swisseph/swehel.c CHANGED
@@ -3164,8 +3164,8 @@ static int32 heliacal_ut_vis_lim(double tjd_start, double *dgeo, double *datm, d
3164
3164
  {
3165
3165
  int i;
3166
3166
  double d, darr[10], direct = 1, tjd, tday;
3167
- int32 epheflag, retval = OK, helflag2;
3168
- int32 iflag, ipl;
3167
+ int32 retval = OK, helflag2;
3168
+ int32 ipl;
3169
3169
  int32 TypeEvent = TypeEventIn;
3170
3170
  char serr[AS_MAXCH];
3171
3171
  for (i = 0; i < 10; i++)
@@ -3173,10 +3173,6 @@ static int32 heliacal_ut_vis_lim(double tjd_start, double *dgeo, double *datm, d
3173
3173
  *dret = tjd_start;
3174
3174
  *serr = '\0';
3175
3175
  ipl = DeterObject(ObjectName);
3176
- epheflag = helflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
3177
- iflag = SEFLG_TOPOCTR | SEFLG_EQUATORIAL | epheflag;
3178
- if (!(helflag & SE_HELFLAG_HIGH_PRECISION))
3179
- iflag |= SEFLG_NONUT | SEFLG_TRUEPOS;
3180
3176
  if (ipl == SE_MERCURY)
3181
3177
  tjd = tjd_start - 30;
3182
3178
  else
@@ -3255,8 +3251,7 @@ static int32 moon_event_vis_lim(double tjdstart, double *dgeo, double *datm, dou
3255
3251
  double tjd, trise;
3256
3252
  char serr[AS_MAXCH];
3257
3253
  char ObjectName[30];
3258
- int32 iflag, ipl, retval, helflag2, direct;
3259
- int32 epheflag = helflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
3254
+ int32 ipl, retval, helflag2, direct;
3260
3255
  dret[0] = tjdstart; /* will be returned in error case */
3261
3256
  if (TypeEvent == 1 || TypeEvent == 2) {
3262
3257
  if (serr_ret != NULL)
@@ -3265,9 +3260,6 @@ static int32 moon_event_vis_lim(double tjdstart, double *dgeo, double *datm, dou
3265
3260
  }
3266
3261
  strcpy(ObjectName, "moon");
3267
3262
  ipl = SE_MOON;
3268
- iflag = SEFLG_TOPOCTR | SEFLG_EQUATORIAL | epheflag;
3269
- if (!(helflag & SE_HELFLAG_HIGH_PRECISION))
3270
- iflag |= SEFLG_NONUT|SEFLG_TRUEPOS;
3271
3263
  helflag2 = helflag;
3272
3264
  helflag2 &= ~SE_HELFLAG_HIGH_PRECISION;
3273
3265
  /* check Synodic/phase Period */
@@ -3392,7 +3384,7 @@ static int32 heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, doub
3392
3384
  */
3393
3385
  int32 CALL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, double *dobs, char *ObjectNameIn, int32 TypeEvent, int32 helflag, double *dret, char *serr_ret)
3394
3386
  {
3395
- int32 retval, Planet, itry;
3387
+ int32 retval, Planet;
3396
3388
  char ObjectName[AS_MAXCH], serr[AS_MAXCH], s[AS_MAXCH];
3397
3389
  double tjd0 = JDNDaysUTStart, tjd, dsynperiod, tjdmax, tadd;
3398
3390
  int32 MaxCountSynodicPeriod = MAX_COUNT_SYNPER;
@@ -3490,11 +3482,8 @@ int32 CALL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *dat
3490
3482
  /*
3491
3483
  * this is the outer loop over n synodic periods
3492
3484
  */
3493
- tjd = tjd0;
3494
3485
  retval = -2; /* indicates that another synodic period has to be done */
3495
- for (itry = 0;
3496
- tjd < tjdmax && retval == -2;
3497
- itry++, tjd += tadd) {
3486
+ for (tjd = tjd0; tjd < tjdmax && retval == -2; tjd += tadd) {
3498
3487
  *serr = '\0';
3499
3488
  retval = heliacal_ut(tjd, dgeo, datm, dobs, ObjectName, TypeEvent, helflag, dret, serr);
3500
3489
  /* if resulting event date < start date for search (tjd0): retry starting
@@ -967,7 +967,9 @@ static int CalcH(
967
967
  } /* if */
968
968
  hsp->mc = swe_degnorm(hsp->mc);
969
969
  if (hsp->do_speed) hsp->mc_speed = AscDash(th, 0, sine, cose);
970
- /* ascendant */
970
+ // ascendant
971
+ // In case of ascendant, the great circle is the horizon, which has pole height latitude.
972
+ // intersection equator horizon is at th + 90, reactasce 90° east of meridian.
971
973
  hsp->ac = Asc1(th + 90, fi, sine, cose);
972
974
  if (hsp->do_speed)
973
975
  hsp->ac_speed = AscDash(th + 90, fi, sine, cose);
@@ -2049,7 +2051,7 @@ porphyry:
2049
2051
 
2050
2052
  /*****
2051
2053
  * oblique triangle formed by: great circle with pole height f, ecliptic and equator,
2052
- * x = intersection equator - great circle.
2054
+ * x = intersection equator - great circle, measured along equator.
2053
2055
  * return crossing of ecliptic with great circle.
2054
2056
  * Prepare quadrants before doing the work in Asc2.
2055
2057
  */
@@ -2091,7 +2093,8 @@ static double Asc1(double x1, double f, double sine, double cose)
2091
2093
  * f in range -90 .. +90
2092
2094
  * sine, cose around e=23°
2093
2095
  * oblique triangle formed by: great circle with pole height f, ecliptic and equator,
2094
- * x = intersection equator - great circle.
2096
+ * In case of ascendant, the great circle is the horizon, which has pole height latitude.
2097
+ * x = intersection equator - great circle, measured along equator.
2095
2098
  * return crossing of ecliptic with great circle.
2096
2099
  */
2097
2100
  static double Asc2(double x, double f, double sine, double cose)
package/swisseph/swejpl.c CHANGED
@@ -81,6 +81,12 @@
81
81
  typedef off_t off_t64;
82
82
  #define FSEEK fseeko
83
83
  #define FTELL ftello
84
+ // #ifdef __ANDROID_API__
85
+ // #undef FSEEK
86
+ // #undef FTELL
87
+ // #define FSEEK fseek
88
+ // #define FTELL ftell
89
+ // #endif
84
90
  #endif
85
91
 
86
92
  #define DEBUG_DO_SHOW FALSE
@@ -945,7 +951,7 @@ int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
945
951
  return retc;
946
952
  }
947
953
 
948
- int32 swi_get_jpl_denum()
954
+ int32 swi_get_jpl_denum(void)
949
955
  {
950
956
  return js->eh_denum;
951
957
  }
@@ -1179,7 +1179,7 @@ moonpol[1] *= a;
1179
1179
  moonpol[2] *= a;
1180
1180
  }
1181
1181
  #else
1182
- static void moon1()
1182
+ static void moon1(void)
1183
1183
  {
1184
1184
  double a;
1185
1185
  /* This code added by Bhanu Pinnamaneni, 17-aug-2009 */
@@ -1364,7 +1364,7 @@ moonpol[2] *= a;
1364
1364
  }
1365
1365
  #endif /* MOSH_MOON_200 */
1366
1366
 
1367
- static void moon2()
1367
+ static void moon2(void)
1368
1368
  {
1369
1369
  /* terms in T^0 */
1370
1370
  g = STR*(2*(Ea-Ju+D)-MP+648431.172);
@@ -1441,7 +1441,7 @@ g = STR*(SWELP - 2.0*D + 2.5);
1441
1441
  B += 0.29855 * sin(g);
1442
1442
  }
1443
1443
 
1444
- static void moon3()
1444
+ static void moon3(void)
1445
1445
  {
1446
1446
  /* terms in T^0 */
1447
1447
  moonpol[0] = 0.0;
@@ -1455,7 +1455,7 @@ moonpol[2] = 1.0e-4 * moonpol[2] + 385000.52899; /* kilometers */
1455
1455
 
1456
1456
  /* Compute final ecliptic polar coordinates
1457
1457
  */
1458
- static void moon4()
1458
+ static void moon4(void)
1459
1459
  {
1460
1460
  moonpol[2] /= AUNIT / 1000;
1461
1461
  moonpol[0] = STR * mods3600( moonpol[0] );
@@ -1760,7 +1760,7 @@ void swi_mean_lunar_elements(double tjd,
1760
1760
  *peri = swe_degnorm(*peri - dcor);
1761
1761
  }
1762
1762
 
1763
- static void mean_elements()
1763
+ static void mean_elements(void)
1764
1764
  {
1765
1765
  double fracT = fmod(T, 1);
1766
1766
  /* Mean anomaly of sun = l' (J. Laskar) */
@@ -1817,7 +1817,7 @@ SWELP += ((z[11]*T + z[10])*T + z[9])*T2;
1817
1817
  */
1818
1818
  }
1819
1819
 
1820
- void mean_elements_pl()
1820
+ void mean_elements_pl(void)
1821
1821
  {
1822
1822
  /* Mean longitudes of planets (Laskar, Bretagnon) */
1823
1823
  Ve = mods3600( 210664136.4335482 * T + 655127.283046 );
@@ -139,12 +139,6 @@
139
139
  # define WATCOMC
140
140
  #endif
141
141
 
142
- #ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
143
- # if macintosh && powerc
144
- # define MACOS MY_TRUE /* let it undefined otherwise */
145
- # define MSDOS MY_FALSE /* in case one above fired falsely */
146
- # endif
147
- #endif
148
142
 
149
143
  #ifdef MSDOS
150
144
  # define HPUNIX MY_FALSE
@@ -154,17 +148,12 @@
154
148
  # endif
155
149
  # define UNIX_FS MY_FALSE
156
150
  #else
157
- # ifdef MACOS
158
- # define HPUNIX MY_FALSE
159
- # define UNIX_FS MY_FALSE
160
- # else
161
151
  # define MSDOS MY_FALSE
162
152
  # define HPUNIX MY_TRUE
163
153
  # ifndef _HPUX_SOURCE
164
154
  # define _HPUX_SOURCE
165
155
  # endif
166
156
  # define UNIX_FS MY_TRUE
167
- # endif
168
157
  #endif
169
158
 
170
159
  #include <math.h>
@@ -321,13 +310,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
321
310
  # define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
322
311
  # define PATH_SEPARATOR ";" /* semicolon as PATH separator */
323
312
  # define OPEN_MODE 0666 /* default file creation mode */
324
- # ifdef MACOS
325
- # define FILE_R_ACCESS "r" /* open text file for reading */
326
- # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
327
- # define FILE_W_CREATE "w" /* create/open text file for write*/
328
- # define FILE_A_ACCESS "a+" /* create/open text file for append*/
329
- # define DIR_GLUE ":" /* glue string for directory/file */
330
- # else
331
313
  # define FILE_R_ACCESS "rt" /* open text file for reading */
332
314
  # define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
333
315
  # define FILE_W_CREATE "wt" /* create/open text file for write*/
@@ -335,7 +317,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
335
317
  /* attention, all backslashes for msdos directry names must be written as \\,
336
318
  because it is the C escape character */
337
319
  # define DIR_GLUE "\\" /* glue string for directory/file */
338
- # endif
339
320
  #endif
340
321
 
341
322
  #include <string.h>
package/swisseph/sweph.c CHANGED
@@ -1316,6 +1316,7 @@ void CALL_CONV swe_set_ephe_path(const char *path)
1316
1316
  {
1317
1317
  int i, iflag;
1318
1318
  char s[AS_MAXCH];
1319
+ char serr[AS_MAXCH];
1319
1320
  char *sp;
1320
1321
  double xx[6];
1321
1322
  /* close all open files and delete all planetary data */
@@ -1343,7 +1344,7 @@ void CALL_CONV swe_set_ephe_path(const char *path)
1343
1344
  * tidal acceleration of the Moon */
1344
1345
  iflag = SEFLG_SWIEPH|SEFLG_J2000|SEFLG_TRUEPOS|SEFLG_ICRS;
1345
1346
  swed.last_epheflag = 2;
1346
- swe_calc(J2000, SE_MOON, iflag, xx, NULL);
1347
+ swe_calc(J2000, SE_MOON, iflag, xx, serr);
1347
1348
  if (swed.fidat[SEI_FILE_MOON].fptr != NULL) {
1348
1349
  swi_set_tid_acc(0, 0, swed.fidat[SEI_FILE_MOON].sweph_denum, NULL);
1349
1350
  }
@@ -6210,7 +6211,7 @@ static int CMP_CALL_CONV fstar_node_compare(const void *node1, const void *node2
6210
6211
  int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata, char *serr)
6211
6212
  {
6212
6213
  int i;
6213
- char s[AS_MAXCH];
6214
+ char s[AS_MAXCH + 20];
6214
6215
  char *sde_d;
6215
6216
  char *cpos[20];
6216
6217
  double epoch, radv, parall, mag;
@@ -6256,6 +6257,7 @@ int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata,
6256
6257
  de_pm = atof(cpos[10]);
6257
6258
  radv = atof(cpos[11]);
6258
6259
  parall = atof(cpos[12]);
6260
+ if (parall < 0) parall = -parall; // to fix bug like old Rasalgheti
6259
6261
  mag = atof(cpos[13]);
6260
6262
  /****************************************
6261
6263
  * position and speed (equinox)
@@ -6322,7 +6324,7 @@ int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata,
6322
6324
  static int32 load_all_fixed_stars(char *serr)
6323
6325
  {
6324
6326
  int32 retc = OK;
6325
- int nstars = 0, line = 0, fline = 0, nrecs = 0, nnamed = 0;
6327
+ int nstars = 0, nrecs = 0, nnamed = 0;
6326
6328
  char s[AS_MAXCH], *sp;
6327
6329
  char srecord[AS_MAXCH];
6328
6330
  struct fixed_star fstdata;
@@ -6344,13 +6346,11 @@ static int32 load_all_fixed_stars(char *serr)
6344
6346
  rewind(swed.fixfp);
6345
6347
  swed.fixed_stars = NULL;
6346
6348
  while (fgets(s, AS_MAXCH, swed.fixfp) != NULL) {
6347
- fline++;
6348
6349
  // skip comment lines
6349
6350
  if (*s == '#') continue;
6350
6351
  if (*s == '\n') continue;
6351
6352
  if (*s == '\r') continue;
6352
6353
  if (*s == '\0') continue;
6353
- line++;
6354
6354
  strcpy(srecord, s);
6355
6355
  retc = fixstar_cut_string(srecord, NULL, &fstdata, serr);
6356
6356
  if (retc == ERR) return ERR;
@@ -6388,7 +6388,7 @@ static int32 load_all_fixed_stars(char *serr)
6388
6388
  swed.n_fixstars_real = nstars;
6389
6389
  swed.n_fixstars_named = nnamed;
6390
6390
  swed.n_fixstars_records = nrecs;
6391
- //printf("nstars=%d, nrecords=%d\n", nstars, nrecs);
6391
+ // fprintf(stderr, "nstars=%d, nrecords=%d\n", nstars, nrecs);
6392
6392
  (void) qsort ((void *) swed.fixed_stars, (size_t) nrecs, sizeof (struct fixed_star),
6393
6393
  (int (CMP_CALL_CONV *)(const void *,const void *))(fixedstar_name_compare));
6394
6394
  return retc;
@@ -7266,7 +7266,7 @@ void CALL_CONV swe_set_topo(double geolon, double geolat, double geoalt)
7266
7266
  swi_force_app_pos_etc();
7267
7267
  }
7268
7268
 
7269
- void swi_force_app_pos_etc()
7269
+ void swi_force_app_pos_etc(void)
7270
7270
  {
7271
7271
  int i;
7272
7272
  for (i = 0; i < SEI_NPLANETS; i++)
package/swisseph/sweph.h CHANGED
@@ -445,14 +445,14 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
445
445
  /*************************/
446
446
  /* 8: J.N. Bhasin; (David Cochrane)
447
447
  We don't have any sources or detailed information about this ayanamsha. */
448
- {J1900, 360 - 338.634444, FALSE, -1}, // Bhasin
448
+ {J1900, 360 - 338.634444, FALSE, -1}, // 8: Bhasin
449
449
  /*************************/
450
450
  /* 14 Sept. 2018: the following three ayanamshas have been wrong for
451
451
  many years */
452
452
  /* 9 - 11: Babylonian, Kugler */
453
- {1684532.5, -5.66667, TRUE, -1}, /* 9: Babylonian, Kugler 1 */
454
- {1684532.5, -4.26667, TRUE, -1}, /* 10: Babylonian, Kugler 2 */
455
- {1684532.5, -3.41667, TRUE, -1}, /* 11: Babylonian, Kugler 3 */
453
+ {1684532.5, -5.66667, TRUE, -1}, // 9: Babylonian, Kugler 1
454
+ {1684532.5, -4.26667, TRUE, -1}, // 10: Babylonian, Kugler 2
455
+ {1684532.5, -3.41667, TRUE, -1}, // 11: Babylonian, Kugler 3
456
456
  /*************************/
457
457
  /* 12: Babylonian, Huber
458
458
  P. Huber, "Über den Nullpunkt der babylonischen Ekliptik", in: Centaurus
@@ -464,7 +464,7 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
464
464
  {1673941, -5.079167, TRUE, -1}, // 13: Babylonian, Mercier
465
465
  /*************************/
466
466
  /* 14: t0 is defined by Aldebaran at 15 Taurus in year -100 */
467
- {1684532.5, -4.44138598, TRUE, 0},
467
+ {1684532.5, -4.44138598, TRUE, 0}, // 14: Babylonian/Aldebaran = 15 Tau
468
468
  /*************************/
469
469
  /* 15: Hipparchos */
470
470
  {1674484.0, -9.33333, TRUE, -1}, // 15: Hipparchos
@@ -476,34 +476,34 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
476
476
  {0, 0, FALSE, 0}, // 17: Galactic Center at 0 Sagittarius
477
477
  /*************************/
478
478
  /* 18: J2000 */
479
- {J2000, 0, FALSE, 0}, /* 18: J2000 */
479
+ {J2000, 0, FALSE, 0}, // 18: J2000
480
480
  /*************************/
481
481
  /* 19: J1900 */
482
- {J1900, 0, FALSE, 0}, /* 19: J1900 */
482
+ {J1900, 0, FALSE, 0}, // 19: J1900
483
483
  /*************************/
484
484
  /* 20: B1950 */
485
- {B1950, 0, FALSE, 0}, /* 20: B1950 */
485
+ {B1950, 0, FALSE, 0}, // 20: B1950
486
486
  /*************************/
487
487
  /* 21: Suryasiddhanta, assuming ingress of mean Sun into Aries at point of mean
488
488
  equinox of date on 21.3.499, near noon, Ujjain (75.7684565 E)
489
489
  = 7:30:31.57 UT = 12:33:36 LMT*/
490
- {1903396.8128654, 0, TRUE, 0}, // 21:
490
+ {1903396.8128654, 0, TRUE, 0}, // 21: Suryasiddhanta
491
491
  /*************************/
492
492
  /* 22: Suryasiddhanta, assuming ingress of mean Sun into Aries at true position
493
493
  of mean Sun at same epoch */
494
- {1903396.8128654,-0.21463395, TRUE, 0}, // 22:
494
+ {1903396.8128654,-0.21463395, TRUE, 0}, // 22: Suryasiddhanta, mean Sun
495
495
  /*************************/
496
496
  /* 23: Aryabhata, same date, but UT 6:56:55.57 analogous to 21 */
497
- {1903396.7895321, 0, TRUE, 0}, // 23:
497
+ {1903396.7895321, 0, TRUE, 0}, // 23: Aryabhata
498
498
  /*************************/
499
499
  /* 24: Aryabhata, analogous 22 */
500
- {1903396.7895321,-0.23763238, TRUE, 0}, // 24:
500
+ {1903396.7895321,-0.23763238, TRUE, 0}, // 24: Aryabhata, mean Sun
501
501
  /*************************/
502
502
  /* 25: Suryasiddhanta, Revati/zePsc at polar long. 359°50'*/
503
- {1903396.8128654,-0.79167046, TRUE, 0}, // 25:
503
+ {1903396.8128654,-0.79167046, TRUE, 0}, // 25: SS Revati
504
504
  /*************************/
505
505
  /* 26: Suryasiddhanta, Citra/Spica at polar long. 180° */
506
- {1903396.8128654, 2.11070444, TRUE, 0}, // 26:
506
+ {1903396.8128654, 2.11070444, TRUE, 0}, // 26: SS Citra
507
507
  /*************************/
508
508
  /* 27: True Citra (Spica exactly at 0 Libra) */
509
509
  {0, 0, FALSE, 0}, // 27: True Citra
@@ -400,15 +400,10 @@ extern "C" {
400
400
  #if MSDOS
401
401
  # define SE_EPHE_PATH "\\sweph\\ephe\\"
402
402
  #else
403
- # ifdef MACOS
404
- # define SE_EPHE_PATH ":ephe:"
405
- # else
406
403
  # define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
407
- /* At Astrodienst, we maintain two ephemeris areas for
408
- the thousands of asteroid files:
409
- the short files in /users/ephe/ast*,
410
- the long file in /users/ephe2/ast*. */
411
- # endif
404
+ /* At Astrodienst, we maintain two ephemeris areas for the 600'000+ asteroid files:
405
+ the short files in /users/ephe/ast*, the long file in /users/ephe2/ast*.
406
+ /users is a synonym for /home on many systems */
412
407
  #endif
413
408
  #endif /* SE_EPHE_PATH */
414
409
 
@@ -3151,7 +3151,7 @@ static double adjust_for_tidacc(double ans, double Y, double tid_acc, double tid
3151
3151
  }
3152
3152
 
3153
3153
  /* returns tidal acceleration used in swe_deltat() and swe_deltat_ex() */
3154
- double CALL_CONV swe_get_tid_acc()
3154
+ double CALL_CONV swe_get_tid_acc(void)
3155
3155
  {
3156
3156
  return swed.tid_acc;
3157
3157
  }
@@ -3183,7 +3183,7 @@ void CALL_CONV swe_set_delta_t_userdef(double dt)
3183
3183
  }
3184
3184
  }
3185
3185
 
3186
- int32 swi_guess_ephe_flag()
3186
+ int32 swi_guess_ephe_flag(void)
3187
3187
  {
3188
3188
  int32 iflag = SEFLG_SWIEPH;
3189
3189
  /* if jpl file is open, assume SEFLG_JPLEPH */
@@ -3933,9 +3933,9 @@ char *CALL_CONV swe_cs2degstr(CSEC t, char *a)
3933
3933
  * for definition of input see function swe_split_deg().
3934
3934
  * output:
3935
3935
  * ideg degrees,
3936
- * imin minutes,
3937
- * isec seconds,
3938
- * dsecfr fraction of seconds
3936
+ * imin minutes, (zero if rounding to degree)
3937
+ * isec seconds, (zero if rounding to minute)
3938
+ * dsecfr fraction of seconds (zero if rounding used)
3939
3939
  * inak nakshatra number;
3940
3940
  ******************************************************************/
3941
3941
  static void split_deg_nakshatra(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *inak)
@@ -3977,8 +3977,12 @@ static void split_deg_nakshatra(double ddeg, int32 roundflag, int32 *ideg, int32
3977
3977
  if (!(roundflag & (SE_SPLIT_DEG_ROUND_DEG | SE_SPLIT_DEG_ROUND_MIN | SE_SPLIT_DEG_ROUND_SEC))) {
3978
3978
  *dsecfr = ddeg * 3600 - *isec;
3979
3979
  } else {
3980
- *dsecfr = *isec; // is rounded, no fractional seconds
3980
+ *dsecfr = 0;
3981
3981
  }
3982
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG))
3983
+ *imin = 0;
3984
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG | SE_SPLIT_DEG_ROUND_MIN))
3985
+ *isec = 0;
3982
3986
  } /* end split_deg_nakshtra */
3983
3987
 
3984
3988
  /************************************************************
@@ -4003,8 +4007,8 @@ static void split_deg_nakshatra(double ddeg, int32 roundflag, int32 *ideg, int32
4003
4007
  * to 10d59'59" (or 10d59' or 10d) *
4004
4008
  * output:
4005
4009
  * ideg degrees,
4006
- * imin minutes,
4007
- * isec seconds,
4010
+ * imin minutes, (zero if rounding to degree)
4011
+ * isec seconds, (zero if rounding to minute or degree)
4008
4012
  * dsecfr fraction of seconds (zero if rounding used)
4009
4013
  * isgn zodiac sign number;
4010
4014
  * or +/- sign
@@ -4052,6 +4056,10 @@ void CALL_CONV swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *i
4052
4056
  } else {
4053
4057
  *dsecfr = 0;
4054
4058
  }
4059
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG))
4060
+ *imin = 0;
4061
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG | SE_SPLIT_DEG_ROUND_MIN))
4062
+ *isec = 0;
4055
4063
  } /* end split_deg */
4056
4064
 
4057
4065
  double swi_kepler(double E, double M, double ecce)