Programming interface to the

Swiss Ephemeris 3Revision 2-dec-2026 16:36

Developed by Dieter Koch and Alois Treindl

Copyright Astrodienst AG 1997-2026.

This document describes the proprietary programmer's interface to the Swiss Ephemeris library.

The Swiss Ephemeris is made available by its authors under a dual licensing system. The software developer, who uses any part of Swiss Ephemeris in his or her software, must choose between one of the two license models, which are:

a) GNU Affero General Public License (AGPL);

b) Swiss Ephemeris Professional License.

The choice must be made before the software developer distributes software containing parts of Swiss Ephemeris to others, and before any public service using the developed software is activated.

If the developer chooses the AGPL software license, he or she must fulfill the conditions of that license, which includes the obligation to place his or her whole software project under the AGPL or a compatible license. See

If the developer chooses the Swiss Ephemeris Professional license, he must follow the instructions as found in

and purchase the Swiss Ephemeris Professional Edition from Astrodienst and sign the corresponding license contract.

C 1 The programming steps to get a planet’s position

To compute a celestial body or point with SE, you have to do the following steps (use swetest.c as an example). The details of the functions will be explained in the following chapters.

  1. Set the directory path of the ephemeris files, e.g.:
swe_set_ephe_path("C:\\SWEPH\\EPHE");
  1. From the birth date, compute the Julian day number:
jul_day_UT = swe_julday(year, month, day, hour, gregflag);
  1. Compute a planet or other bodies:
ret_flag = swe_calc_ut(jul_day_UT, planet_no, flag, lon_lat_rad, err_msg);

or a fixed star:

ret_flag = swe_fixstar_ut(star_nam, jul_day_UT, flag, lon_lat_rad, err_msg);
  1. At the end of your computations close all files and free memory calling

    swe_close();

Here is a miniature sample program, it is in the source distribution as swemini.c:

#include "swephexp.h" /* this includes "sweodef.h" */
int main()
{
char *sp, sdate[AS_MAXCH], snam[40], serr[AS_MAXCH];
int jday = 1, jmon = 1, jyear = 2000;
double jut = 0.0;
double tjd_ut, te, x2[6];
long iflag, iflgret;
int p;
swe_set_ephe_path(NULL);
iflag = SEFLG_SPEED;
while (TRUE) {
printf("\nDate (d.m.y) ?");
gets(sdate);
/* stop if a period . is entered */
if (*sdate == '.')
return OK;
if (sscanf (sdate, "%d%*c%d%*c%d", &jday, &jmon, &jyear) < 1) exit(1);
/*
* we have day, month and year and convert to Julian day number
*/
tjd_ut = swe_julday(jyear, jmon, jday, jut, SE_GREG_CAL);
/*
* compute Ephemeris time from Universal time by adding delta_t
* not required for SE versions smaller than 1.60
*/
printf("date: %02d.%02d.%d at 0:00 Universal time\n", jday, jmon, jyear);
printf("planet \tlongitude\tlatitude\tdistance\tspeed long.\n");
/*
* a loop over all planets
*/
for (p = SE_SUN; p <= SE_CHIRON; p++) {
if (p == SE_EARTH) continue;
/*
* do the coordinate calculation for this planet p
*/
iflgret = swe_calc_ut(tjd_ut, p, iflag, x2, serr);
/* if there is a problem, a negative value is returned and an
* error message is given in serr.
*/
if (iflgret < 0)
printf("error: %s\n", serr);
/*
* get the name of the planet p
*/
swe_get_planet_name(p, snam);
/*
* print the coordinates
*/
printf("%10s\t%11.7f\t%10.7f\t%10.7f\t%10.7f\n",
snam, x2[0], x2[1], x2[2], x2[3]);
}
}
return OK;
}

C 2 The ephemeris files and file-related functions

C 2.1 The ephemeris files

The current version 3 (SE 3) has a built-in ephemeris time range from 1200 CE to 2400 CE. If you want to go beyond this and use the complete time range of DE441 from 13000 BCE to 17000 CE, you need to install all ephemeris data files. Otherwise, you do not need them.

Each Swiss Ephemeris data file covers a period of 600 years and includes data for the planets, the Moon and the asteroids Ceres, Pallas, Juno, Vesta, Chiron, and Pholus; there are 51 such files for the whole time range of 30000 years.

The asteroids in these files have shorter time ranges: Ceres, Pallas, Juno and Vesta from 2 January 7801 BCE (astronomical year -7800) to 1 January 8400 CE, Chiron from 675 CE to 4650 CE, Pholus from 2959 BCE (astronomical year -2958) to 7309 CE. Outside these ranges swe_calc() returns an error.

The file names are as follows:

Planetary file Time range (approximate)

seplm132.se3 13000 BCE – 12600 BCE

seplm126.se3 12600 BCE – 12000 BCE

seplm120.se3 12000 BCE – 11400 BCE

seplm114.se3 11400 BCE – 10800 BCE

seplm108.se3 10800 BCE – 10200 BCE

seplm102.se3 10200 BCE – 9600 BCE

seplm96.se3 9600 BCE – 9000 BCE

seplm90.se3 9000 BCE – 8400 BCE

seplm84.se3 8400 BCE – 7800 BCE

seplm78.se3 7800 BCE – 7200 BCE

seplm72.se3 7200 BCE – 6600 BCE

seplm66.se3 6600 BCE – 6000 BCE

seplm60.se3 6000 BCE – 5400 BCE

seplm54.se3 5400 BCE – 4800 BCE

seplm48.se3 4800 BCE – 4200 BCE

seplm42.se3 4200 BCE – 3600 BCE

seplm36.se3 3600 BCE – 3000 BCE

seplm30.se3 3000 BCE – 2400 BCE

seplm24.se3 2400 BCE – 1800 BCE

seplm18.se3 1800 BCE – 1200 BCE

seplm12.se3 1200 BCE – 600 BCE

seplm06.se3 600 BCE – 0 BCE

sepl_00.se3 0 BCE – 600 CE

sepl_06.se3 600 CE – 1200 CE

sepl_12.se3 1200 CE – 1800 CE

sepl_18.se3 1800 CE – 2400 CE

sepl_24.se3 2400 CE – 3000 CE

sepl_30.se3 3000 CE – 3600 CE

sepl_36.se3 3600 CE – 4200 CE

sepl_42.se3 4200 CE – 4800 CE

sepl_48.se3 4800 CE – 5400 CE

sepl_54.se3 5400 CE – 6000 CE

sepl_60.se3 6000 CE – 6600 CE

sepl_66.se3 6600 CE – 7200 CE

sepl_72.se3 7200 CE – 7800 CE

sepl_78.se3 7800 CE – 8400 CE

sepl_84.se3 8400 CE – 9000 CE

sepl_90.se3 9000 CE – 9600 CE

sepl_96.se3 9600 CE – 10200 CE

sepl_102.se3 10200 CE – 10800 CE

sepl_108.se3 10800 CE – 11400 CE

sepl_114.se3 11400 CE – 12000 CE

sepl_120.se3 12000 CE – 12600 CE

sepl_126.se3 12600 CE – 13200 CE

sepl_132.se3 13200 CE – 13800 CE

sepl_138.se3 13800 CE – 14400 CE

sepl_144.se3 14400 CE – 15000 CE

sepl_150.se3 15000 CE – 15600 CE

sepl_156.se3 15600 CE – 16200 CE

sepl_162.se3 16200 CE – 16800 CE

These files all have the file suffix “.se3”. Only ephemeris files for single asteroids and planetary moons have the file suffix .se1. (See chapter 2.3 on asteroid ephemerids further below.)

If you do not need any calculations before 1200 CE and after 2400 CE, you need not install these files.

These compressed ephemerides reproduce JPL’s original ephemeris DE441 on average within 0.2 mas (= 0.0002 arcsec); the largest deviations are 1.2 mas for the Sun and the planets and 1.7 mas for the Moon (see the general documentation, “Precision of the compressed ephemeris”). All files together are 124 MB.

If you want the full accuracy of the JPL ephemeris, you need to download the 2.8 GB file de441.eph.

Earlier versions of the Swiss Ephemeris versus Swiss Ephemeris 3.

(1) Swiss Ephemeris 2 (up to 2.10.03) was based on the JPL Ephemeris DE431, and SE 1 (before 2014) was based on DE406.

SE 2.10.04 and SE 3 (2026) are based on the JPL Ephemeris DE441.

(2) SE 2 and SE 1 had separate ephemeris files for the planets (e.g., sepl_18.se1), for the Moon (e.g., semo_18.se1), and for the main asteroids (Ceres-Vesta, Chiron, Pholus, e.g., seas_18.se1). All of them had the file name extension “.se1”. SE3 has all these ephemerides in only one file (e.g. sepl_18.se3), with the extension “.se3”.

SE3 does no longer understand those old files (semo*, seas* and sepl*.se1), it requires the new ones, namely sepl*.se3. Thus, if you want to update your software to SE3, you have to get rid of the old files and install the new ones. Old and new asteroid files (e.g. se99999.se1) may be mixed.

(3) With SE 2, if you installed neither the *.se1 ephemeris files nor a JPL ephemeris file, then the software defaulted to a built-in ephemeris by Stephen Moshier, which was derived from JPL ephemeris DE406. It had an accuracy of a few arc seconds and had slow performance. This ephemeris was limited to the time range 3000 BCE to 3000 CE.

SE 3 does not include the Moshier ephemeris anymore. Instead, it has sepl_12.se3 and sepl_18.se3 as its built-in default ephemerides. If you need only the time range 1200 CE to 2400 CE, you need not install any ephemeris files.

C 2.2 swe_set_ephe_path()

This is the first function that should be called before any other function of the Swiss Ephemeris. Even if you don’t want to set an ephemeris path and use the built-in ephemeris, it is nevertheless recommended to call swe_set_ephe_path(NULL), because this function makes important initializations. If you don’t do that, the Swiss Ephemeris may work, but the results may be not 100% consistent.

If the environment variable SE_EPHE_PATH exists in the environment where Swiss Ephemeris is used, its content is used to find the ephemeris files. The variable can contain a directory name, or a list of directory names separated by ; (semicolon) on Windows or : (colon) on Linux.

void swe_set_ephe_path(
      char *path);

Usually, an application will want to set its own ephemeris, e.g. as follows:

swe_set_ephe_path("/sweph/ephe");

or

swe_set_ephe_path("C:\\SWEPH\\EPHE"); // on a Windows system

The argument can be a single directory name or a list of directories, which are then searched in sequence. The argument of this call is ignored if the environment variable SE_EPHE_PATH exists and is not empty.
If you want to make sure that your program overrides any environment variable setting, you can use putenv() to set it to an empty string.

If the path is longer than 256 bytes, swe_set_ephe_path() sets the path \SWEPH\EPHE instead.

If no environment variable exists and swe_set_ephe_path() is never called, the built-in ephemeris path is used. On Windows it is “\sweph\ephe” relative to the current working drive, on Linux it is "/home/ephe".

Asteroid ephemerides are looked for in the subdirectories ast0, ast1, ast2 .. of the ephemeris directory and, if not found there, in the ephemeris directory itself. Asteroids with numbers 0 – 999 are expected in directory ast0, those with numbers 1000 – 1999 in directory ast1, etc.

The environment variable SE_EPHE_PATH is most convenient when a user has several applications installed which all use the Swiss Ephemeris but would normally expect the ephemeris files in different application-specific directories. The user can override this by setting the environment variable, which forces all the different applications to use the same ephemeris directory. A developer should accept this override feature and allow the sophisticated users to take advantage of it.

C 2.3 swe_close()

/* close Swiss Ephemeris */
void swe_close(void);

At the end of your computations you can release all resources (open files and allocated memory) used by the Swiss Ephemeris DLL.

After swe_close(), no Swiss Ephemeris functions should be used unless you call swe_set_ephe_path() again and, if required, swe_set_jpl_file().

C 2.4 swe_set_jpl_file()

/* set name of JPL ephemeris file */
void swe_set_jpl_file(char *fname);

If you work with the JPL ephemeris, SE uses the default file name which is defined in swephexp.h as SE_FNAME_DFT. In version 3 of the Swiss Ephemeris, it has the value “de441.eph”.

If a different JPL ephemeris file is required, call the function swe_set_jpl_file() to make the file name known to the software, e.g.

swe_set_jpl_file("de431.eph");

This file must reside in the ephemeris path you are using for all your ephemeris files.

If the file name is longer than 256 byte, swe_set_jpl_file() cuts the file name to a length of 256 bytes. The error will become visible after the first call of swe_calc(), when it will return error code -1, zero positions, and an error message.

C 2.5 swe_version()

/* find out version number of your Swiss Ephemeris version */
char *swe_version(
      char *svers);
/* svers is a string variable with sufficient space to contain the version number (255 char) */

The function returns a pointer to the string svers, i.e. to the version number of the Swiss Ephemeris that your software is using.

C 2.6 swe_get_library_path()

/* find out the library path of the DLL or executable */
char *swe_get_library_path(
      char *spath);
/* spath is a string variable with sufficient space to contain the library path (255 char) */

The function returns a pointer to the string spath, which contains the path in which the executable resides. If it is running with a DLL, then spath contains the path of the DLL.

C 2.7 swe_get_current_file_data()

This function can be used to find out the start and end date of an *.se3 or *.se1 ephemeris file after a call of swe_calc().
The function returns data from internal file structures sweph.fidat used in the *last call* to swe_calc() or swe_fixstar(). Data returned are (currently) 0 with JPL files and fixed star files. Thus, the function is only useful for ephemerides of planets or asteroids that are based on *.se3/*se1 files.
// ifno = 0 planet file sepl_xxx, or jpl file
// ifno = 1 unused in SE3, was moon file in SE2
// ifno = 2 unused in SE3, was seas_* file in SE2
// ifno = 3 other asteroid or planetary moon file, if such an object was computed
// ifno = 4 star file
// Return value: full file pathname, or NULL if no data
// tfstart = start date of file,
// tfend = end data of fila,
// denum = jpl ephemeris number 406 or 431 from which file was derived
// all three return values are zero for a jpl file or a star file.
const char *CALL_CONV swe_get_current_file_data(
      int ifno,
      double *tfstart,
      double *tfend,
      int *denum);

C 3 Planetary Positions: The functions swe_calc_ut(), swe_calc(), and swe_calc_pctr()

Before calling any of these functions or any other Swiss Ephemeris function, it is strongly recommended to call the function swe_set_ephe_path(). Even if you don’t want to set an ephemeris path and use the built-in ephemeris, it is recommended to call swe_set_ephe_path(NULL), because this function makes important initializations. If you don’t do that, the Swiss Ephemeris may work but the results may be not 100% consistent.

C 3.1 The call parameters

swe_calc_ut() was introduced with SE version 1.60 and makes planetary calculations easier. For the steps required, see the chapter The programming steps to get a planet’s position.

swe_calc_ut() and swe_calc() work exactly the same way except that swe_calc() requires Terrestrial Time (TT) (former Ephemeris Time (ET)) as a parameter whereas swe_calc_ut() expects Universal Time (UT). For common astrological calculations, you will only need swe_calc_ut() and will not have to think about the conversion between Universal Time and Terrestrial Time.

The functions swe_calc_ut() and swe_calc() compute positions of planets, asteroids, lunar nodes and apogees. The parameters of these functions are:

int32 swe_calc_ut(
      double tjd_ut,
      int32 ipl,
      int32 iflag,
      double* xx,
      char* serr);

where

and

int32 swe_calc(
      double tjd_et,
      int32 ipl,
      int32 iflag,
      double *xx,
      char *serr);

same but

tjd_et = tjd_ut + swe_deltat(tjd_ut)

A detailed description of these variables will be given in the following sections.

swe_calc_pctr() calculates planetocentric positions of planets, i. e. positions as observed from some different planet, e.g. Jupiter-centric ephemerides. The function can actually calculate any object as observed from any other object, e.g. also the position of some asteroid as observed from another asteroid or from a planetary moon. The function declaration is as follows:

int32 swe_calc_pctr(
      double tjd, // input time in TT
      int32 ipl, // target object
      int32 iplctr, // center object
      int32 iflag,
      double *xxret,
      char *serr);

C 3.2 Bodies (int ipl)

To tell swe_calc() which celestial body or factor should be computed, a fixed set of body numbers is used. The body numbers are defined in swephexp.h:

/* planet numbers for the ipl parameter in swe_calc() */
#define SE_ECL_NUT -1
#define SE_SUN 0
#define SE_MOON 1
#define SE_MERCURY 2
#define SE_VENUS 3
#define SE_MARS 4
#define SE_JUPITER 5
#define SE_SATURN 6
#define SE_URANUS 7
#define SE_NEPTUNE 8
#define SE_PLUTO 9
#define SE_MEAN_NODE 10
#define SE_TRUE_NODE 11
#define SE_MEAN_APOG 12
#define SE_OSCU_APOG 13
#define SE_EARTH 14
#define SE_CHIRON 15
#define SE_PHOLUS 16
#define SE_CERES 17
#define SE_PALLAS 18
#define SE_JUNO 19
#define SE_VESTA 20
#define SE_INTP_APOG 21
#define SE_INTP_PERG 22
#define SE_NPLANETS 23
#define SE_FICT_OFFSET 40 // offset for fictitious objects
#define SE_NFICT_ELEM 15
#define SE_PLMOON_OFFSET 9000 // offset for planetary moons
#define SE_AST_OFFSET 10000 // offset for asteroids

/* Hamburger or Uranian "planets" (fictitious bodies) */
#define SE_CUPIDO 40
#define SE_HADES 41
#define SE_ZEUS 42
#define SE_KRONOS 43
#define SE_APOLLON 44
#define SE_ADMETOS 45
#define SE_VULKANUS 46
#define SE_POSEIDON 47
/* other fictitious bodies */
#define SE_ISIS 48
#define SE_NIBIRU 49
#define SE_HARRINGTON 50
#define SE_NEPTUNE_LEVERRIER 51
#define SE_NEPTUNE_ADAMS 52
#define SE_PLUTO_LOWELL 53
#define SE_PLUTO_PICKERING 54

3.2.1 Additional Asteroids, Comets, Interstellar Objects

Body numbers of other asteroids are above SE_AST_OFFSET (= 10000) and have to be constructed as follows:

e.g. Eros : ipl = SE_AST_OFFSET + 433 (= 10433)

The names of the asteroids and their catalogue numbers can be found in seasnam.txt.

Some examples are:

5 Astraea

6 Hebe

7 Iris

8 Flora

9 Metis

10 Hygiea

30 Urania

42 Isis not identical with "Isis-Transpluto"

153 Hilda has an own asteroid belt at 4 AU

227 Philosophia

251 Sophia

259 Aletheia

275 Sapientia

279 Thule asteroid close to Jupiter

375 Ursula

433 Eros

763 Cupido different from Witte's Cupido

944 Hidalgo

1181 Lilith not identical with Dark Moon 'Lilith'

1221 Amor

1387 Kama

1388 Aphrodite

1862 Apollo different from Witte's Apollon

3553 Damocles highly eccentric orbit between Mars and Uranus

3753 Cruithne "second moon" of Earth

4341 Poseidon Greek Neptune - different from Witte's Poseidon

4464 Vulcano fire god - different from Witte's Vulkanus and intramercurian Vulcan

5731 Zeus Greek Jupiter - different from Witte's Zeus

7066 Nessus third named Centaur - between Saturn and Pluto

15760 Albion (1992 QB1) The first discovered TNO besides Pluto

20000 Varuna TNO

50000 Quaoar TNO

90377 Sedna TNO

136199 Eris TNO slightly smaller in size, but greater in mass than Pluto

136472 Makemake TNO

There are two ephemeris files for each named asteroid (except the main asteroids, which are in the files sepl*.se3), a long one and a short one:

se09999.se1 long-term ephemeris of asteroid number 9999, 3000 BCE – 3000 CE

se09999s.se1 short ephemeris of asteroid number 9999, 1500 – 2100 CE

s123456.se1 and s123456s.se1 are the files of asteroid number 123456.

Unnamed asteroids have a short file only. Files made from JPL Horizons data (about 2700 near-Earth asteroids and other special cases, also some named ones such as 1566 Icarus) are short files covering 1600 – 2100 CE. How the asteroid files are computed and how accurate they are is described in the chapter “Asteroids” of the general documentation (swisseph).

The larger file is about 10 times the size of the short file. swe_calc() tries the long one and on failure automatically takes the short one.

Asteroid ephemerides are looked for in the subdirectories ast0, ast1, ast2 .. ast9 etc. of the ephemeris directory and, if not found there, in the ephemeris directory itself. Asteroids with numbers 0 – 999 are expected in directory ast0, those with numbers 1000 – 1999 in directory ast1 etc.

Note that not all asteroids can be computed for the whole time range 3000 BCE to 3000 CE. The orbits of some of them are extremely sensitive to perturbations by major planets. E.g. Chiron, cannot be computed for the time before 675 CE and after 4650 CE because close encounters with Saturn make its orbit impredictable before or after. Outside this time range, Swiss Ephemeris returns the error code, an error message, and a position value 0. Note that the users will have to handle this case in their program. Computing Chiron transits for Jesus or Alexander the Great will not work.

The same is true for Pholus before 2959 BCE and after 7309 CE. There are similar restrictions with other planet-crossing asteroids, e.g. with the earth crossers 1862 Apollo, 99942 Apophis, 217628 Lugh, etc., which are available only for a few centuries or decades.

NOTE on asteroid names:

Asteroid names are listed in the file seasnam.txt. This file is in the ephemeris directory.

Comets and interstellar objects

The Swiss Ephemeris provides ephemerides of a few selected comets under the following pseudo-MPC numbers:

S99999032s.se1 99999032 Churyumov-Ger = Comet 67P/Churyumov-Gerasimenko

S99999043s.se1 99999043 Neowise = Comet C/2020 F3 (NEOWISE)

S99999044.se1 99999044 Halley = Comet 1P/Halley

S99999046.se1 99999046 Hale-Bopp = Comet Hale-Bopp (C/1995 O1)

S99999047.se1 99999047 West = Comet West (C/1975 V1-A)

S99999045.se1 99999045 Oumuamua = 1I/'Oumuamua (A/2017 U1)

3.2.2 Planetary moons and body centers

Ephemerides of planetary moons and centers of body (COB) were introduced with SE 2.10.

Their SE body numbers are between SE_PLMOON_OFFSET (= 9000) and SE_AST_OFFSET (= 10000) and are constructed as follows:

e.g., Jupiter moon Io: ipl = SE_PLMOON_OFFSET + SE_JUPITER (= 5) * 100 + 1 (= 9501).

Centers of body (COB) are calculated the same way, i.e. like a planetary moon but with the "moon number" 99;
e.g. Jupiter center of body: ipl = SE_PLMOON_OFFSET + SE_JUPITER * 100 + 99 (= 9599)
Moons of Mars: 9401 -- 9402
Moons of Jupiter: 9501 -- 95xx; Center of body: 9599
Moons of Saturn: 9601 -- 96xx; Center of body: 9699
Moons of Uranus: 9701 -- 97xx; Center of body: 9799
Moons of Neptune: 9801 -- 98xx; Center of body: 9899
Moons of Pluto: 9901 -- 99xx; Center of body: 9999

A full list of existing planetary moons is found here: https://en.wikipedia.org/wiki/List_of_natural_satellites (retrieved 6 april 2026).

The ephemeris files of the planetary moons and COB are in the subdirectory sat. Like the subdirectories of asteroids, the directory sat must be created in the path which is defined using the function swe_set_ephe_path().

The ephemeris files can be downloaded from here:

https://github.com/aloistr/swisseph/tree/master/ephe/sat

The list of objects available in the Swiss Ephemeris is:

9401 Phobos/Mars
9402 Deimos/Mars
9501 Io/Jupiter
9502 Europa/Jupiter
9503 Ganymede/Jupiter
9504 Callisto/Jupiter
9599 Jupiter/COB
9601 Mimas/Saturn
9602 Enceladus/Saturn
9603 Tethys/Saturn
9604 Dione/Saturn
9605 Rhea/Saturn
9606 Titan/Saturn
9607 Hyperion/Saturn
9608 Iapetus/Saturn
9699 Saturn/COB
9701 Ariel/Uranus
9702 Umbriel/Uranus
9703 Titania/Uranus
9704 Oberon/Uranus
9705 Miranda/Uranus
9799 Uranus/COB
9801 Triton/Neptune
9802 Triton/Nereid
9808 Proteus/Neptune
9899 Neptune/COB
9901 Charon/Pluto
9902 Nix/Pluto
9903 Hydra/Pluto
9904 Kerberos/Pluto
9905 Styx/Pluto
9999 Pluto/COB

The maximum differences between barycenter and center of body (COB) are:

Mars (0.2 m, irrelevant to us)
Jupiter 0.075 arcsec (jd 2468233.5)
Saturn 0.053 arcsec (jd 2463601.5)
Uranus 0.0032 arcsec (jd 2446650.5)
Neptune 0.0036 arcsec (jd 2449131.5)
Pluto 0.088 arcsec (jd 2437372.5)
(from one-day-step calculations over 150 years)

If you prefer using COB rather than barycenters, you should understand that:

3.2.3 Fictitious planets

Fictitious planets have numbers greater than or equal to 40. The users can define their own fictitious planets. The Keplerian orbital elements of these planets must be written into the file seorbel.txt. The function swe_calc_ut() (or swe_calc()) looks for the file seorbel.txt in the ephemeris path set by swe_set_ephe_path(). If no orbital elements file is found, swe_calc() uses the built-in orbital elements of the above mentioned Uranian planets and some other bodies. The planet number of a fictitious planet is defined as

e.g. for Kronos: ipl = 39 + 4 = 43.

The file seorbel.txt has the following structure:

# Orbital elements of fictitious planets
# 27 Jan. 2000
#
# This file is part of the Swiss Ephemeris, from Version 1.60 on.
#
# Warning! These planets do not exist!
#
# The user can add his or her own elements.
# 960 is the maximum number of fictitious planets.
#
# The elements order is as follows:
# 1. epoch of elements (Julian day)
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000" or "JDATE")
# 3. mean anomaly at epoch
# 4. semi-axis
# 5. eccentricity
# 6. argument of perihelion (ang. distance of perihelion from node)
# 7. ascending node
# 8. inclination
# 9. name of planet
#
# use '#' for comments
# to compute a body with swe_calc(), use planet number
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
# e.g. number of Kronos is ipl = 39 + 4 = 43
#
# Witte/Sieggruen planets, refined by James Neely
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
J1900, J1900, 169.0193, 64.81960, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
#
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
# Strubell does not give an equinox. 1945 is taken in order to
# reproduce the as best as ASTRON ephemeris. (This is a strange
# choice, though.)
# The epoch according to Strubell is 1772.76.
# 1772 is a leap year!
# The fraction is counted from 1 Jan. 1772
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
# Nibiru, elements from Christian Woeltge, Hannover
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
# Selena/White Moon
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17

All orbital elements except epoch and equinox may have T terms, where:

T = (tjd – epoch) / 36525.

(See, e.g., Vulcan, the second last elements set (not the “Uranian” Vulcanus but the intramercurian hypothetical planet Vulcan).) “T * T”, “T2”, “T3” are also allowed.

The equinox can either be entered as a Julian day or as “J1900” or “B1950” or “J2000” or, if the equinox of date is required, as “JDATE”. If you use T terms, note that precession has to be taken into account with JDATE, whereas it has to be neglected with fixed equinoxes.

No T term is required with the mean anomaly, i.e. for the speed of the body, because our software can compute it from the body’s semi-axis and gravity. However, a mean anomaly T term had to be added with Vulcan because its speed is not in agreement with the laws of physics. In such cases, the software takes the speed given in the elements and does not compute it internally.

The software also accepts orbital elements for fictitious bodies that move about the Earth. As an example, study the last elements set in the excerpt of seorbel.txt above. After the name of the body, “, geo” is added to indicate that it is a geocentric orbit (cf. Selena/White Moon above).

3.2.4 Obliquity and nutation

The body number SE_ECL_NUT can be used to compute the obliquity of the ecliptic and the nutation. Of course, nutation is automatically taken into account by swe_calc() with planetary positions. However, sometimes ecliptic obliquity and nutation will be needed as a separate values.

iflgret = swe_calc(tjd_et, SE_ECL_NUT, 0, x, serr);

x is an array of 6 doubles as usual. They will be filled as follows:

x[4] = x[5] = 0

The nutation is that of the model IAU 2000B, without its fixed offsets (see swisseph3.pdf, Appendix J).

C 3.3 Options chosen by flag bits (long iflag)

3.3.1 The use of flag bits

If no bits are set, i.e. if iflag == 0, swe_calc() computes what common astrological ephemerides (as available in book shops) show, i.e. an apparent body position in geocentric ecliptic polar coordinates (longitude, latitude, and distance) relative to the true equinox of the date.

If the speed of the body is required, set iflag = SEFLG_SPEED.

For mathematical points as the mean lunar node and the mean apogee, there is no apparent position. swe_calc() returns true positions for these points.

If you need another kind of computation, use the flags explained in the following paragraphs (c.f. swephexp.h). Their names begin with 'SEFLG_'. To combine them, you have to concatenate them (inclusive-or) as in the following example:

iflag = SEFLG_SPEED | SEFLG_TRUEPOS; (or: iflag = SEFLG_SPEED + SEFLG_TRUEPOS;) // C
iflag = SEFLG_SPEED or SEFLG_TRUEPOS;(or: iflag = SEFLG_SPEED + SEFLG_TRUEPOS;) // Pascal

With this value of iflag, swe_calc() will compute true positions (i.e. not accounted for light-time) with speed.

The flag bits, which are defined in swephexp.h, are:

#define SEFLG_JPLEPH 1L // use JPL ephemeris
#define SEFLG_SWIEPH 2L // use compressed SWISSEPH ephemeris, default
#define SEFLG_MOSEPH SEFLG_SWIEPH // Moshier ephemeris removed in SE3, defined for old programs
#define SEFLG_HELCTR 8L // return heliocentric position
#define SEFLG_TRUEPOS 16L // return true positions, not apparent
#define SEFLG_J2000 32L // no precession, i.e. give J2000 equinox
#define SEFLG_NONUT 64L // no nutation, i.e. mean equinox of date
#define SEFLG_SPEED3 128L // speed from 3 positions (do not use this, rather use SEFLG_SPEED, which is faster and more precise.)
#define SEFLG_SPEED 256L // high precision speed (analyt. comp.)
#define SEFLG_NOGDEFL 512L // ignore gravitational deflection
#define SEFLG_NOABERR 1024L // ignore 'annual' aberration of light
#define SEFLG_ASTROMETRIC (SEFLG_NOABERR|SEFLG_NOGDEFL) // astrometric positions
// i.e. with light-time, but without aberration and
// light deflection */
#define SEFLG_EQUATORIAL 2048L // equatorial positions
#define SEFLG_XYZ 4096L // cartesian, not polar, coordinates
#define SEFLG_RADIANS 8192L // coordinates in radians, not degrees
#define SEFLG_BARYCTR 16384L // barycentric positions
#define SEFLG_TOPOCTR (32*1024L) // topocentric positions
#define SEFLG_SIDEREAL (64*1024L) // sidereal positions
#define SEFLG_ICRS (128*1024L) // ICRS (reference frame of JPL ephemerides,
// "International Celestial Reference System")
#define SEFLG_DPSIDEPS_1980 (256*1024) /* reproduce JPL Horizons
* 1962 - today to 0.002 arcsec. */
#define SEFLG_JPLHOR SEFLG_DPSIDEPS_1980
#define SEFLG_JPLHOR_APPROX (512*1024) /* approximate JPL Horizons 1962 - today */
#define SEFLG_CENTER_BODY (1024*1024) /* calculate position of center of body (COB) of
planet, not barycenter of its system */
// Note, COB can be calculated either
// - ipl = SE_JUPITER with iflag |= SEFLG_CENTER_BODY or
// - ipl = 9599 (= 9000 + SE_JUPITER * 100 + 99) without any additional bit in iflag

3.3.2 Ephemeris flags

The flags to choose an ephemeris are: (s. swephexp.h)

SEFLG_JPLEPH /* use JPL ephemeris */
SEFLG_SWIEPH /* use Swiss Ephemeris */

The Moshier ephemeris (SEFLG_MOSEPH, value 4 in SE2 and SE1) has been removed in SE3. The flag is still defined, equal to SEFLG_SWIEPH, so that old programs still compile; they get the compressed Swiss Ephemeris.

If none of these flags is specified, swe_calc() tries to compute the default ephemeris. The default ephemeris is defined in swephexp.h:

#define SEFLG_DEFAULTEPH SEFLG_SWIEPH // the compressed ephemeris

If the data files of the compressed ephemeris are not found in the system, SE3 uses built-in data. The time range is limited to 1200 CE – 2400 CE.

(If the data files are missing, older versions SE2 or SE1 provide a position from the Moshier ephemeris for 3000 BCE to 3000 CE; however, accuracy is considerably reduced and performance is considerably slower.)

3.3.3 Speed flag

swe_calc() does not compute speed if you do not add the speed flag SEFLG_SPEED, e.g.

iflag |= SEFLG_SPEED;

The computation of speed is usually cheap, so you may set this bit by default even if you do not need the speed.

3.3.4 Coordinate systems, degrees and radians

SEFLG_EQUATORIAL returns equatorial positions: right ascension and declination.

SEFLG_XYZ returns x, y, z coordinates instead of longitude, latitude, and distance.

SEFLG_RADIANS returns position in radians rather than degrees.

E.g. to compute right ascension and declination, write:

iflag = SEFLG_SWIEPH | SEFLG_SPEED | SEFLG_EQUATORIAL;

NOTE concerning equatorial coordinates: With sidereal modes SE_SIDM_J2000, SE_SIDM_B1950, SE_SIDM_J1900, SE_SIDM_GALALIGN_MARDYKS or if the sidereal flag SE_SIDBIT_ECL_T0 is set, swe_calc() provides right ascension and declination relative to the mean equinox of the reference epoch (J2000, B1950, J1900, etc.).

With other sidereal modes or ayanamshas right ascension and declination are given relative to the mean equinox of date.

3.3.5 Specialties (going beyond common interest)

3.3.5.1 True or apparent positions

Common ephemerides provide apparent geocentric positions. Since the journey of the light from a planet to the Earth takes some time, the planets are never seen where they actually are, but where they were a few minutes or hours before. Astrology uses to work with the positions we see. (More precisely: with the positions we would see, if we stood at the center of the Earth and could see the sky. Actually, the geographical position of the observer could be of importance as well and topocentric positions could be computed, but this is usually not taken into account in astrology.).

The geocentric position for the Earth (SE_EARTH) is returned as zero.

To compute the true geometrical position of a planet, disregarding light-time, you have to add the flag SEFLG_TRUEPOS.

3.3.5.2 Topocentric positions

To compute topocentric positions, i.e. positions referred to the place of the observer (the birth place) rather than to the center of the Earth, do as follows:

3.3.5.3 Heliocentric positions

To compute a heliocentric position, add SEFLG_HELCTR to iflag.

A heliocentric position can be computed for all planets including the moon. For the sun, lunar nodes and lunar apogees the coordinates are returned as zero; no error message appears.

3.3.5.4 Barycentric positions

SEFLG_BARYCTR produces coordinates referred to the solar system barycenter.

A barycentric position can be computed for all planets including the sun and moon. For the lunar nodes and lunar apogees the coordinates are returned as zero; no error message appears.

The barycentric Sun of the compressed Swiss Ephemeris has “only” a precision of 0.1”. For more precise barycentric positions, the original JPL ephemeris should be used with the flag SEFLG_JPLEPH.

If you still use SE 1 or SE2, please note that the barycentric option does not work with the Moshier ephemeris.

3.3.5.5 Astrometric positions

For astrometric positions, which are sometimes given in the Astronomical Almanac, the light-time correction is computed, but annual aberration and the light-deflection by the sun are neglected. Such data can be reproduced using SEFLG_NOABERR | SEFLG_NOGDEFL. For positions related to the mean equinox of 2000, you must set SEFLG_J2000 | SEFLG_NONUT, as well.

3.3.5.6 True or mean equinox of date

swe_calc() usually computes the positions as referred to the true equinox of the date (i.e. with nutation). If you want the mean equinox, you can turn nutation off, using the flag bit SEFLG_NONUT.

3.3.5.7 J2000 positions, ICRS-positions and positions referred to other equinoxes

swe_calc() usually computes the positions as referred to the equinox of date. SEFLG_J2000 provides data referred to the equinox J2000. Usually, you may want to add SEFLG_NONUT, as well, for the mean equinox J2000.

For positions relative to the ICRS (Internation Celestial Reference System), also add the flag SEFLG_ICRS.

For positions referred to other equinoxes, SEFLG_SIDEREAL has to be set and the equinox specified by swe_set_sid_mode(). For more information, read the description of this function.

3.3.5.8 Sidereal positions

To compute sidereal positions, set bit SEFLG_SIDEREAL and use the function swe_set_sid_mode() in order to define the ayanamsha you want. For more information, read the description of this function.

3.3.5.9 JPL Horizons positions

For apparent positions of the planets, JPL Horizons follows an approach different from Astronomical Almanac. Its positions are not referred to the same reference frame. The difference in RA amounts to about 53 mas and is almost constant. For more details see the general documentation of the Swiss Ephemeris in swisseph3.pdf, Appendix C, “Swiss Ephemeris and JPL Horizons System of NASA”.

Apparent positions of JPL Horizons can be reproduced with about 0.001 arcsec precision using the flag SEFLG_JPLHOR. For best accuracy, files with the daily Earth orientation parameters (EOP) delta_psi and delta_eps relative to the IAU 1980 precession/nutation model must be downloaded and saved in the ephemeris path defined by swe_set_ephe_path(). The EOP files are found on the IERS website:

http://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html (retrieved 6 april 2026)

The following files are required:

1. EOP 08 C04 (IAU1980) - one file (1962-now)

Put this file into your ephemeris path and rename it as “eop_1962_today.txt”.

2. finals.data (IAU1980)

Put this file into your ephemeris path, too, and rename it as “eop_finals.txt”.

If the Swiss Ephemeris does not find these files, it defaults to SEFLG_JPLHORA, which is a very good approximation of Horizons, at least for 1962 to present.

SEFLG_JPLHORA can be used independently for the whole time range of the Swiss Ephemeris.

Note, the Horizons mode works only with planets and fixed stars. With lunar nodes and apsides, we use our standard methods.

C 3.4 Position and Speed (double xx[6])

swe_calc() returns the coordinates of position and velocity in the following order:

Ecliptic positionEquatorial position (SEFLG_EQUATORIAL)
longituderight ascension
latitudedeclination
distance in AUdistance in AU
speed in longitude (deg/day)speed in right ascension (deg/day)
speed in latitude (deg/day)speed in declination (deg/day)
speed in distance (AU/day)speed in distance (AU/day)

If you need rectangular coordinates (SEFLG_XYZ), swe_calc() returns x, y, z, dx, dy, dz in AU.

Once you have computed a planet, e.g., in ecliptic coordinates, its equatorial position or its rectangular coordinates are available, too. You can get them very cheaply (little CPU time used), calling again swe_calc() with the same parameters, but adding SEFLG_EQUATORIAL or SEFLG_XYZ to iflag, swe_calc() will not compute the body again, just return the data specified from internal storage.

C 3.5 Error handling and return values

swe_calc_ut(), swe_calc(), swe_fixstar2_ut(), and swe_fixstar2() (swe_fixstar_ut(), swe_fixstar()) return a 32-bit integer value. This value is >= 0, if the function call was successful, and < 0, if a fatal error has occurred. In addition, an error string or a warning can be returned in the string parameter serr.

A fatal error code (< 0) and an error string are returned in one of the following cases:

If any of these errors occurs:

error: SwissEph file 'sepl_06.se3' not found in PATH '...'

In this case, the ephemeris file “sepl_06.se3” is not available in its directory path.

On success, the return code contains flag bits that indicate what kind of computation has been done. This value will usually be equal to iflag, however sometimes may differ from it. If an option specified in iflag cannot be fulfilled or makes no sense, swe_calc() just does what can be done.

Some flags may be removed by swe_calc(), if they are incompatible with other flags, e.g.:

Some flags may be added automatically:

Positive values of return_code need not be checked, but maybe useful for debugging purposes or for understanding what exactly has been done by the function.

C 4 Functions to find crossings of planets over positions

These functions find the crossing of the Sun over a given ecliptic position:

double swe_solcross(
      double x2cross,
      double tjd_et,
      int32 iflag,
      char *serr);
double swe_solcross_ut(
      double x2cross,
      double tjd_ut,
      int32 iflag,
      char *serr);

Return value: double jx = time of next crossing, in Ephemeris Time or Universal Time.

In case of error, a value of jx < tjd is returned. Because the crossing search is always forward in time, returning an earlier time is an indication of error. In addition, string serr will contain error details.

The precision is 1 milliarcsecond, i.e. at the returned time the Sun is closer than 0.001 arcsec to x2cross.

These flag bits in iflag can be useful:

SEFLG_TRUEPOS

SEFLG_NONUT

SEFLG_EQUATORIAL (x2cross is a right ascension value, a point on the equator, and not on the ecliptic)

These functions find the crossing of the Moon over a given ecliptic position:

double swe_mooncross(
      double x2cross,
      double tjd_et,
      int32 iflag,
      char *serr);
double swe_mooncross_ut(
      double x2cross,
      double tjd_ut,
      int32 iflag,
      char *serr);

Return value: double jx = time of next crossing, in Ephemeris Time or Universal Time.

In case of error, a value of jx < tjd is returned. Because the crossing search is always forward in time, returning an earlier time is an indication of error. In addition, string serr will contain error details (unless it is a NULL pointer)

The precision is 1 milliarcsecond, i.e. at the returned time the Moon is closer than 0.001 arcsec to x2cross.

These flag bits in iflag can be useful:

SEFLG_TRUEPOS

SEFLG_NONUT

SEFLG_EQUATORIAL (x2cross is a right ascension value, a point on the equator, and not on the ecliptic)

These functions find the crossing of the Moon over its true node, i.e. crossing through the ecliptic:

double swe_mooncross_node(
      double tjd_et,
      int32 iflag,
      double *xlon,
      double *xlat,
      char *serr);
double swe_mooncross_node_ut(
      double tjd_ut,
      int32 iflag,
      double *xlon,
      double *xlat,
      char *serr);

Return value: double jx = time of next crossing, in Ephemeris Time or Universal Time.

In case of error, a value of jx < tjd is returned. Because the crossing search is always forward in time, returning an earlier time is an indication of error. In addition, string serr will contain error details (unless it is a NULL pointer)

The position of the Moon at the moment of crossing is returned in xlon and xlat, with xlat very close to zero.

There are currently no functions for geocentric crossings of other planets. Their movement is more complex because they can become stationary and retrograde and make multiple crossings in a short period of time.

There are however functions for heliocentric crossings over a position x2cross:

int32 swe_helio_cross(
      int32 ipl,
      double x2cross,
      double tjd_ut,
      int32 iflag,
      int32 dir,
      double *jx,
      char *serr);
int32 swe_helio_cross_ut(
      int32 ipl,
      double x2cross,
      double tjd_ut,
      int32 iflag,
      int32 dir,
      double *jx,
      char *serr);

ipl is the planet number. Only objects which have a heliocentric orbit are possible.

dir >= 0 indicates search forward in time, dir < 0 indicates search backward in time. It is recommended to use dir = 1 or dir = -1.

Return value < 0 indicates an error, with error details in string serr (unless serr is a NULL pointer).

The crossing time is returned via parameter jx.

C 5 The function swe_get_planet_name()

This function allows you to find a planetary or asteroid name, when the planet number is given. The function definition is:

char* swe_get_planet_name(
      int32 ipl,
      char *spname);

If an asteroid name is wanted, the function does the following:

The file seasnam.txt can be updated by the user. To do this, download the names list from the Minor Planet Center https://www.minorplanetcenter.net/iau/lists/MPNames.html (retrieved 25 october 2026), rename it as seasnam.txt, and move it into your ephemeris directory.

The file seasnam.txt need not be sorted in any way. There must be one asteroid per line, first its catalogue number, then its name. The asteroid number may or may not be in brackets.

Example:

(3192) A'Hearn
(3654) AAS
(8721) AMOS
(3568) ASCII
(2848) ASP
(677) Aaltje
...

C 6 Fixed stars functions

The following functions are used to calculate positions of fixed stars.

C 6.1 Different functions for calculating fixed star positions

The function swe_fixstar_ut() does exactly the same as swe_fixstar() except that it expects Universal Time rather than Terrestrial Time (Ephemeris Time) as an input value. (cf. swe_calc_ut() and swe_calc()) For more details, see under 6.2 swe_fixstar().

In the same way, the function swe_fixstar2_ut() does the same as swe_fixstar2() except that it expects Universal Time as input time.

The functions swe_fixstar2_ut() and swe_fixstar2() were introduced with SE 2.07. They do the same as swe_fixstar_ut() and swe_fixstar() except that they are a lot faster and have a slightly different behavior, explained below.

For new projects, we recommend using the new functions swe_fixstar2_ut() and swe_fixstar2(). Performance will be a lot better if a great number of fixed star calculations are done. If performance is a problem with your old projects, we recommend replacing the old functions by the new ones. However, the output should be checked carefully, because the behavior of the old and new functions is not exactly identical. (explained below)

C 6.2 swe_fixstar2_ut(), swe_fixstar2(), swe_fixstar_ut(), swe_fixstar()

int32 swe_fixstar2_ut(
      char* star,
      double tjd_ut,
      int32 iflag,
      double* xx,
      char* serr);
int32 swe_fixstar2(
      char *star,
      double tjd_et,
      int32 iflag,
      double* xx,
      char* serr);
int32 swe_fixstar_ut(
      char* star,
      double tjd_ut,
      int32 iflag,
      double* xx,
      char* serr);
int32 swe_fixstar(
      char *star,
      double tjd_et,
      int32 iflag,
      double* xx,
      char* serr);

where:

The fixed stars functions only work if the fixed stars data file sefstars.txt is found in the ephemeris path. If the file sefstars.txt is not found, the old file fixstars.cat is searched and used instead, if present. However, it is strongly recommended to *not* use the old file longer. The data in the file are outdated, and the algorithms are also not as accurate as those used with the file sefstars.txt.

The parameter star must provide for at least 41 characters for the returned star name. If a star is found, its name is returned in this field in the following format:
traditional_name, nomenclature_name e.g. "Aldebaran,alTau".

The nomenclature name is usually the so-called Bayer designation or the Flamsteed designation, in some cases also Henry Draper (HD) or other designations.

As for the explanation of the other parameters, see swe_calc().

Barycentric positions have not been implemented. The difference between geocentric and heliocentric fix star position is noticeable and arises from parallax and gravitational deflection.

The function has three modes to search for a star in the file sefstars.txt:

Behavior of the functions:

Changed behavior with swe_fixstar2() and swe_fixstar2_ut(): The search string must match the complete star name. If you want to use a partial string, you have to add the wildcard character ‘%’ to the search string, e.g. “aldeb%”. (The old functions treat each search string as ending with a wildcard.)

The ‘%’ can only be used at the end of the search string and only with the traditional star name, not with nomenclature names (i.e. not with Bayer or Flamsteed designations).

Note that the function overwrites the variable star. Both the full traditional name and the nomenclature name are copied into the variable, separated by a comma. E.g. if star is given the value “aldeb”, then swe_fixstar() overwrites this with “Aldebaran,alTau”. The new string can also be used with a new call of the same star.

Changed behavior: The numbering of stars follows a sorted list of nomenclature names. (With the old functions, the n-th star of the fixed star file is returned.) Here, too, star will be overwritten by the traditional name and the nomenclature name, separated by a comma, e.g. “Aldebaran,alTau”.

For correct spelling of nomenclature names, see file sefstars.txt. Nomenclature names are usually Bayer designations and are composed of a Greek letter and the name of a star constellation. The Greek letters were originally used to write numbers, therefore they actually number the stars of the constellation. The abbreviated nomenclature names we use in sefstars.txt are constructed from two lowercase letters for the Greek letter (e.g. “al” for “alpha”, except “omi” for “omicron” and “ome” for “omega”) and three letters for the constellation (e.g. “Tau” for “Tauri”).

The searching of stars by sequential number (instead of name or nomenclature name) is a practical feature if one wants to list all stars:

for i=1; i<10000; i++) { // choose any number greater than number of lines (stars) in file
sprintf(star, "%d", i);
returncode = swe_fixstar2(star, tjd, ...);
... whatever you want to do with the star positions ...
if (returncode == ERR)
break;
}

The function should survive damaged sefstars.txt files which contain illegal data and star names exceeding the accepted length. Such fields are cut to acceptable length.

There are a few special entries in the file sefstars.txt:

# Gal. Center (SgrA*) according to Simbad database,
# speed of SgrA* according to Reid (2004), "The Proper Motion of Sagittarius A*",
# p. 873: -3.151 +- 0.018 mas/yr, -5.547 +- 0.026 mas/yr. Component in RA must be
# multiplied with cos(decl).
Galactic Center,SgrA*,ICRS,17,45,40.03599,-29,00,28.1699,-2.755718425,-5.547, 0.0,0.125,999.99, 0, 0
# Great Attractor, near Galaxy Cluster ACO 3627, at gal. coordinates
# 325.3, -7.2, 4844 km s-1 according to Kraan-Korteweg et al. 1996,
# Woudt 1998
Great Attractor,GA,2000,16,15,02.836,-60,53,22.54,0.000,0.00,0.0,0.0000159,999.99, 0, 0
# Virgo Cluster, according to NED (Nasa Extragalactic Database)
Virgo Cluster,VC,2000,12,26,32.1,12,43,24,0.000, 0.00, 0.0,0.0000,999.99, 0, 0
# The solar apex, or the Apex of the Sun's Way, refers to the direction that the Sun travels
# with respect to the so-called Local Standard of Rest.
Apex ,Apex,1950,18,03,50.2, 30,00,16.8, 0.000, 0.00,-16.5,0.0000,999.99, 0, 0
# Galactic Pole acc. to Liu/Zhu/Zhang, „Reconsidering the galactic coordinate system",
# Astronomy & Astrophysics No. AA2010, Oct. 2010, p. 8.
# It is defined relative to a plane that contains the galactic center and the Sun and
# approximates the galactic plane.
Gal.Pole,GPol,ICRS,12,51,36.7151981,27,06,11.193172,0.0,0.0,0.0,0.0,0.0,0,0
# Old Galactic Pole IAU 1958 relative to ICRS according to the same publication p. 7
Gal.Pole IAU1958,GP1958,ICRS,12,51,26.27469,27,07,41.7087,0.0,0.0,0.0,0.0,0.0,0,0
# Old Galactic Pole relative to ICRS according to the same publication p. 7
Gal.Pole IAU1958,GP1958,ICRS,12,51,26.27469,27,07,41.7087,0.0,0.0,0.0,0.0,0.0,0,0
# Pole of true galactic plane, calculated by DK
Gal.Plane Pole,GPPlan,ICRS,12,51,5.731104,27,10,39.554849,0.0,0.0,0.0,0.0,0.0,0,0
# The following "object" played an important role in 2011 and 2017 dooms day predictions,
# as well as in some conspiration theories. It consists of the infrared objects
# IRAS 13458-0823 and IRAS 13459-0812. Central point measured by DK.
Infrared Dragon,IDrag, ICRS,13,48,0.0,-9,0,0.0,0,0,0,0,0.0, 19, 477

You may edit the star catalogue and move the stars you prefer to the top of the file. With older versions of the Swiss Ephemeris, this will increase the speed of computations. The search mode is linear through the whole star file for each call of swe_fixstar().

However, since SE 2.07 with the new functions swe_fixstar2() and swe_fixstar2_ut(), this won’t speed up calculations anymore, and the calculation speed will be the same for all stars.

Attention:

With older versions of the Swiss Ephemeris, swe_fixstar() does not compute speeds of the fixed stars. Also, distance is always returned as 1 for all stars. Since SE 2.07 distances and daily motions have been included in the return array.

Distances are given in AU. To convert them from AU to lightyears or parsec, please use the following defines, which are located in swephexp.h:

#define SE_AUNIT_TO_LIGHTYEAR (1.0/63241.077088071)
#define SE_AUNIT_TO_PARSEC (1.0/206264.8062471)

The daily motions of the fixed stars contain components of precession, nutation, aberration, parallax and the proper motions of the stars.

C 6.3 swe_fixstar2_mag(), swe_fixstar_mag()

int32 swe_fixstar_mag(
      char *star,
      double* mag,
      char* serr);
int32 swe_fixstar2_mag(
      char *star,
      double* mag,
      char* serr);

Function calculates the magnitude of a fixed star. The function returns OK or ERR. The magnitude value is returned in the parameter mag.

For the definition and use of the parameter star see function swe_fixstar(). The parameter serr and is, as usually, an error string pointer.

The new function swe_fixstar2_mag() (since SE 2.07) is more efficient if great numbers of fixed stars are calculated.

Strictly speaking, the magnitudes returned by this function are valid for the year 2000 only. Variations in brightness due to the star’s variability or due to the increase or decrease of the star’s distance cannot be taken into account. With stars of constant absolute magnitude, the change in brightness can be ignored for the historical period. E.g. the current magnitude of Sirius is -1.46. In 3000 BCE it was -1.44.

C 7 Apsides and nodes, Kepler elements and orbital periods

C 7.1 swe_nod_aps_ut() and swe_nod_aps()

The functions swe_nod_aps_ut() and swe_nod_aps() compute planetary nodes and apsides (perihelia, aphelia, second focal points of the orbital ellipses). Both functions do exactly the same except that they expect a different time parameter (cf. swe_calc_ut() and swe_calc()).

The definitions are:

int32 swe_nod_aps_ut(
      double tjd_ut, // Julian day number in UT
      int32 ipl, // planet number
      int32 iflag, // flag bits
      int32 method, // method, see explanations below
      double *xnasc, // array of 6 double for ascending node
      double *xndsc, // array of 6 double for descending node
      double *xperi, // array of 6 double for perihelion
      double *xaphe, // array of 6 double for aphelion
      char *serr); // character string to contain error messages, 256 chars
int32 swe_nod_aps(
      double tjd_et, // Julian day number in TT
      int32 ipl,
      int32 iflag,
      int32 method,
      double *xnasc,
      double *xndsc,
      double *xperi,
      double *xaphe,
      char *serr);

The parameter iflag allows the same specifications as with the function swe_calc_ut(). I.e., it contains the Ephemeris flag, the heliocentric, topocentric, speed, nutation flags etc. etc. With SEFLG_J2000 the nodes are those on the ecliptic of date, given in J2000 coordinates (their latitude is not 0). For the node on the J2000 ecliptic use swe_get_orbital_elements().

The parameter method tells the function what kind of nodes or apsides are required:

#define SE_NODBIT_MEAN 1

Mean nodes and apsides are calculated for the bodies that have them, i.e. for the Moon and the planets Mercury – Neptune, osculating ones for Pluto and the asteroids. This is the default method, also used if method=0.

#define SE_NODBIT_OSCU 2

Osculating nodes and apsides are calculated for all bodies.

#define SE_NODBIT_OSCU_BAR 4

Osculating nodes and apsides are calculated for all bodies. With planets beyond Jupiter, the nodes and apsides are calculated from barycentric positions and speed. Cf. the explanations in swisseph3.pdf.

If this bit is combined with SE_NODBIT_MEAN, mean values are given for the planets Mercury - Neptune.

#define SE_NODBIT_FOPOINT 256

The second focal point of the orbital ellipse is computed and returned in the array of the aphelion. This bit can be combined with any other bit.

C 7.2 swe_get_orbital_elements() (Kepler elements and orbital data)

This function calculates osculating elements (Kepler elements) and orbital periods for a planet, the Earth-Moon barycenter, or an asteroid. The elements are calculated relative to the mean ecliptic J2000.

The elements define the orbital ellipse under the premise that it is a two-body system and there are no perturbations from other celestial bodies. The resulting elements are particularly bad for the Moon, which is strongly perturbed by the Sun. It is not recommended to calculate ephemerides using Kepler elements.

Important: This function should not be used for ephemerides of the perihelion or aphelion of a planet. Note that when the position of a perihelion is calculated using swe_get_orbital_elements(), this position is not measured on the ecliptic, but on the orbit of the planet itself, thus it is not an ecliptic position. Also note that the positions of the nodes are always calculated relative to the mean equinox 2000 and never precessed to the ecliptic or equator of date. For ecliptic positions of a perihelion or aphelion or a node, you should use the function swe_nod_aps() or swe_nod_aps_ut().

int32 swe_get_orbital_elements(
      double tjd_et, // Terrestrial Time TT
      int32 ipl,
      int32 iflag,
      double *dret,
      char *serr);
/* Function calculates osculating orbital elements (Kepler elements) of a planet
* or asteroid or the EMB. The function returns error,
* if called for the Sun, the lunar nodes, or the apsides.
*
* Input parameters:
* tjd_et Julian day number, in TT (ET)
* ipl object number
* iflag can contain
* - ephemeris flag: SEFLG_JPLEPH, SEFLG_SWIEPH,
* - center:
* Sun: SEFLG_HELCTR (assumed as default) or
* SS Barycentre: SEFLG_BARYCTR (rel. to solar system barycentre)
* (only possible for planets beyond Jupiter)
* For elements of the Moon, the calculation is geocentric.
* - sum all masses inside the orbit to be computed (method
* of Astronomical Almanac):
* SEFLG_ORBEL_AA
* - reference ecliptic: SEFLG_J2000;
* if missing, mean ecliptic of date is chosen (still not implemented)
*
* output parameters:
* dret[] array of return values, declare as dret[50]
* dret[0] semimajor axis (a)
* dret[1] eccentricity (e)
* dret[2] inclination (in)
* dret[3] longitude of ascending node (upper case omega OM)
* dret[4] argument of periapsis (lower case omega om)
* dret[5] longitude of periapsis (peri)
* dret[6] mean anomaly at epoch (M0)
* dret[7] true anomaly at epoch (N0)
* dret[8] eccentric anomaly at epoch (E0)
* dret[9] mean longitude at epoch (LM)
* dret[10] sidereal orbital period in tropical years
* dret[11] mean daily motion
* dret[12] tropical period in years
* dret[13] synodic period in days,
* negative, if inner planet (Venus, Mercury, Aten asteroids) or Moon
* dret[14] time of perihelion passage
* dret[15] perihelion distance
* dret[16] aphelion distance
*/

C 7.3 swe_orbit_max_min_true_distance()

This function calculates the maximum possible distance, the minimum possible distance, and the current true distance of a planet, the EMB, or an asteroid. The calculation can be done either heliocentrically or geocentrically. With heliocentric calculations, it is based on the momentary Kepler ellipse of the planet. With geocentric calculations, it is based on the Kepler ellipses of the planet and the EMB. The geocentric calculation is rather expensive.

int32 swe_orbit_max_min_true_distance(
      double tjd_et,
      int32 ipl,
      int32 iflag,
      double *dmax,
      double *dmin,
      double *dtrue,
      char *serr);
/* Input:
* tjd_et epoch
* ipl planet number
* iflag ephemeris flag and optional heliocentric flag (SEFLG_HELCTR)
*
* output:
* dmax maximum distance (pointer to double)
* dmin minimum distance (pointer to double)
* dtrue true distance (pointer to double)
* serr error string
*/

C 8 Eclipses, risings, settings, meridian transits, planetary phenomena

There are the following functions for eclipse and occultation calculations.

Solar eclipses:

Occultations of planets by the moon:

These functions can also be used for solar eclipses. But they are slightly less efficient.

Lunar eclipses:

Risings, settings, and meridian transits of planets and stars:

Planetary phenomena:

C 8.1 Example of a typical eclipse calculation

Find the next total eclipse, calculate the geographical position where it is maximal and the four contacts for that position (for a detailed explanation of all eclipse functions see the next chapters):

double tret[10], attr[20], geopos[10];
char serr[255];
int32 whicheph = 0; /* default ephemeris */
double tjd_start = 2451545; /* Julian day number for 1 Jan 2000 */
int32 ifltype = SE_ECL_TOTAL | SE_ECL_CENTRAL | SE_ECL_NONCENTRAL;
/* find next eclipse anywhere on Earth */
eclflag = swe_sol_eclipse_when_glob(tjd_start, whicheph, ifltype, tret, 0, serr);
if (eclflag == ERR)
return ERR;
/* the time of the greatest eclipse has been returned in tret[0];
* now we can find geographical position of the eclipse maximum */
tjd_start = tret[0];
eclflag = swe_sol_eclipse_where(tjd_start, whicheph, geopos, attr, serr);
if (eclflag == ERR)
return ERR;
/* the geographical position of the eclipse maximum is in geopos[0] and geopos[1];
* now we can calculate the four contacts for this place. The start time is chosen
* a day before the maximum eclipse: */
tjd_start = tret[0] - 1;
eclflag = swe_sol_eclipse_when_loc(tjd_start, whicheph, geopos, tret, attr, 0, serr);
if (eclflag == ERR)
return ERR;
/* now tret[] contains the following values:
* tret[0] = time of greatest eclipse (Julian day number)
* tret[1] = first contact
* tret[2] = second contact
* tret[3] = third contact
* tret[4] = fourth contact */

C 8.2 swe_sol_eclipse_when_loc()

To find the next eclipse for a given geographic position, use swe_sol_eclipse_when_loc().

int32 swe_sol_eclipse_when_loc(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* 3 doubles for geographic lon, lat, height.
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *tret, /* return array, 10 doubles, see below */
      double *attr, /* return array, 20 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

The function returns:

/* retflag -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
SE_ECL_TOTAL or SE_ECL_ANNULAR or SE_ECL_PARTIAL
SE_ECL_VISIBLE,
SE_ECL_MAX_VISIBLE,
SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
SE_ECL_3ST_VISIBLE, SE_ECL_4ND_VISIBLE
tret[0] time of maximum eclipse
tret[1] time of first contact
tret[2] time of second contact
tret[3] time of third contact
tret[4] time of forth contact
tret[5] time of sunrise between first and forth contact
tret[6] time of sunset between first and forth contact
attr[0] fraction of solar diameter covered by moon;
with total/annular eclipses, it results in magnitude acc. to IMCCE.
attr[1] ratio of lunar diameter to solar one (lunar radius of the umbra)
attr[2] fraction of solar disc covered by moon (obscuration);
        with total eclipses the ratio of the disc areas (more than 1)
attr[3] diameter of core shadow in km
attr[4] azimuth of sun at tjd
attr[5] true altitude of sun above horizon at tjd
attr[6] apparent altitude of sun above horizon at tjd
attr[7] elongation of moon in degrees
attr[8] magnitude acc. to NASA, as in its catalogs:
        = attr[1] for annular and total eclipses, if central;
        else the fraction of solar diameter covered (about attr[0])
attr[9] saros series number (if available; otherwise -99999999)
attr[10] saros series member number (if available; otherwise -99999999)
*/

Lunar radius. As in NASA’s eclipse catalogs (Espenak, Meeus: k = 0.2725076 and 0.2722810), the umbral quantities of solar eclipses use 0.99916 times the lunar radius of 1738.15 km: the type (total, annular, hybrid; central or not), attr[1], the core shadow attr[3], the times of totality, and the 2nd and 3rd contacts. The penumbral ones use the full radius: attr[0], attr[2], and the 1st and 4th contacts. attr[8] is NASA’s magnitude: for a central total or annular eclipse the ratio attr[1], else the fraction of the solar diameter covered, computed with both radii (Besselian elements). The types of all 687 solar eclipses 1901 - 2200 agree with NASA’s catalogs, and attr[8] agrees with NASA’s magnitudes within 0.00012. Occultations use the same radii (total phase, attr[1], attr[3], 2nd and 3rd contacts with the smaller one). (SE2: only the 2nd and 3rd contacts use the smaller radius; attr[8] is attr[0] or attr[1].)

C 8.3 swe_sol_eclipse_when_glob()

To find the next eclipse globally:

int32 swe_sol_eclipse_when_glob(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      int32 ifltype, /* eclipse type wanted: SE_ECL_TOTAL etc. or 0, if any eclipse type */
      double *tret, /* return array, 10 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

This function requires the time parameter tjd_start in Universal Time and also yields the return values (tret[]) in UT. For conversions between TT and UT, use the function swe_deltat().

Note: An implementation of this function with parameters in Terrestrial Time (TT/ET) would have been possible. The question when the next solar eclipse will happen anywhere on Earth is independent of the rotational position of the Earth and therefore independent of Delta T. However, the function is often used in combination with other eclipse functions (see example below), for which input and output in TT makes no sense, because they concern local circumstances of an eclipse and therefore are dependent on the rotational position of the Earth. For this reason, UT has been chosen for the time parameters of all eclipse functions.

ifltype specifies the eclipse type wanted. It can be a combination of the following bits (see swephexp.h):

#define SE_ECL_CENTRAL 1
#define SE_ECL_NONCENTRAL 2
#define SE_ECL_TOTAL 4
#define SE_ECL_ANNULAR 8
#define SE_ECL_PARTIAL 16
#define SE_ECL_ANNULAR_TOTAL 32

Recommended values for ifltype:

/* search for any eclipse, no matter which type */
ifltype = 0;
/* search a total eclipse; note: non-central total eclipses are very rare */
ifltype = SE_ECL_TOTAL | SE_ECL_CENTRAL | SE_ECL_NONCENTRAL;
/* search an annular eclipse */
ifltype = SE_ECL_ANNULAR | SE_ECL_CENTRAL | SE_ECL_NONCENTRAL;
/* search an annular-total (hybrid) eclipse */
ifltype_ = SE_ECL_ANNULAR_TOTAL | SE_ECL_CENTRAL | SE_ECL_NONCENTRAL;
/* search a partial eclipse */
ifltype = SE_ECL_PARTIAL;

If your code does not work, please study the sample code in swetest.c.

The function returns:

/* retflag -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
Otherwise SE_ECL_TOTAL or SE_ECL_ANNULAR or SE_ECL_PARTIAL or SE_ECL_ANNULAR_TOTAL
SE_ECL_CENTRAL
SE_ECL_NONCENTRAL
tret[0] time of maximum eclipse
tret[1] time, when eclipse takes place at local apparent noon
tret[2] time of eclipse begin
tret[3] time of eclipse end
tret[4] time of totality begin
tret[5] time of totality end
tret[6] time of center line begin
tret[7] time of center line end
tret[8] time when annular-total eclipse becomes total, not implemented so far
tret[9] time when annular-total eclipse becomes annular again, not implemented so far

declare as tret[10] at least!

*/

C 8.4 swe_sol_eclipse_how ()

To calculate the attributes of an eclipse for a given geographic position and time:

int32 swe_sol_eclipse_how(
      double tjd_ut, /* time, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos /* geogr. longitude, latitude, height above sea.
  * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */
/* retflag -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
SE_ECL_TOTAL or SE_ECL_ANNULAR or SE_ECL_PARTIAL
0, if no eclipse is visible at geogr. position.
attr[0] fraction of solar diameter covered by moon;
with total/annular eclipses, it results in magnitude acc. to IMCCE.
attr[1] ratio of lunar diameter to solar one (lunar radius of the umbra, see 8.2)
attr[2] fraction of solar disc covered by moon (obscuration);
        with total eclipses the ratio of the disc areas (more than 1)
attr[3] diameter of core shadow in km
attr[4] azimuth of sun at tjd
attr[5] true altitude of sun above horizon at tjd
attr[6] apparent altitude of sun above horizon at tjd
attr[7] elongation of moon in degrees
attr[8] magnitude acc. to NASA, as in its catalogs (see 8.2):
        = attr[1] for annular and total eclipses, if central;
        else the fraction of solar diameter covered (about attr[0])
attr[9] saros series number (if available; otherwise -99999999)
attr[10] saros series member number (if available; otherwise -99999999) */

C 8.5 swe_sol_eclipse_where ()

This function can be used to find out the geographic position, where, for a given time, a central eclipse is central or where a non-central eclipse is maximal.

If you want to draw the eclipse path of a total or annular eclipse on a map, first compute the start and end time of the total or annular phase with swe_sol_eclipse_when_glob(), then call swe_sol_eclipse_how() for several time intervals to get geographic positions on the central path. The northern and southern limits of the umbra and penumbra are not implemented yet.

int32 swe_sol_eclipse_where(
      double tjd_ut, /* time, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* return array, 2 doubles, geo. long. and lat.
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

The function returns:

/* -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
0 if there is no solar eclipse at tjd
SE_ECL_TOTAL
SE_ECL_ANNULAR
SE_ECL_TOTAL | SE_ECL_CENTRAL
SE_ECL_TOTAL | SE_ECL_NONCENTRAL
SE_ECL_ANNULAR | SE_ECL_CENTRAL
SE_ECL_ANNULAR | SE_ECL_NONCENTRAL
SE_ECL_PARTIAL
geopos[0]: geographic longitude of central line
geopos[1]: geographic latitude of central line
  not implemented so far:
geopos[2]: geographic longitude of northern limit of umbra
geopos[3]: geographic latitude of northern limit of umbra
geopos[4]: geographic longitude of southern limit of umbra
geopos[5]: geographic latitude of southern limit of umbra
geopos[6]: geographic longitude of northern limit of penumbra
geopos[7]: geographic latitude of northern limit of penumbra
geopos[8]: geographic longitude of southern limit of penumbra
geopos[9]: geographic latitude of southern limit of penumbra
  eastern longitudes are positive,
      western longitudes are negative,
      northern latitudes are positive,
      southern latitudes are negative
attr[0] fraction of solar diameter covered by the moon
attr[1] ratio of lunar diameter to solar one (lunar radius of the umbra, see 8.2)
attr[2] fraction of solar disc covered by moon (obscuration);
        with total eclipses the ratio of the disc areas (more than 1)
attr[3] diameter of core shadow in km
attr[4] azimuth of sun at tjd
attr[5] true altitude of sun above horizon at tjd
attr[6] apparent altitude of sun above horizon at tjd
attr[7] angular distance of moon from sun in degrees
attr[8] magnitude acc. to NASA, as in its catalogs (see 8.2)
attr[9] saros series number (if available; otherwise -99999999)
attr[10] saros series member number (if available; otherwise -99999999)

declare as attr[20]!

*/

C 8.6 swe_lun_occult_when_loc()

To find the next occultation of a planet or star by the moon for a given location, use swe_lun_occult_when_loc().

The same function can also be used for local solar eclipses instead of swe_sol_eclipse_when_loc(), but is less efficient.

/* Same declaration as swe_sol_eclipse_when_loc().
* In addition:
* int32 ipl planet number of occulted body
* char* starname name of occulted star. Must be NULL or "", if a planetary
* occultation is to be calculated. For use of this field, see swe_fixstar().
* int32 ifl ephemeris flag. If you want to have only one conjunction
* of the moon with the body tested, add the following flag:
* backward |= SE_ECL_ONE_TRY. If this flag is not set,
* the function will search for an occultation until it
* finds one. For bodies with ecliptical latitudes > 5,
* the function may search unsuccessfully until it reaches
* the end of the ephemeris.
*/
int32 swe_lun_occult_when_loc(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ipl, /* planet number */
      char* starname, /* star name, must be NULL or "" if not a star */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* 3 doubles for geogr. longitude, latitude, height above sea.
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *tret, /* return array, 10 doubles, see below */
      double *attr, /* return array, 20 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

Occultations of some stars may be very rare or do not occur at all. Usually the function searches an event until it finds one or reaches the end of the ephemeris. In order to avoid endless loops, the function can be called using the flag ifl |= SE_ECL_ONE_TRY. If called with this flag, the function searches the next date when the Moon is in conjunction with the object and finds out whether it is an occultation. The function does not check any other conjunctions in the future or past.

In order to find events in a particular time range (tjd_start < tjd < tjd_stop), you can write a loop and call the function as long as date tjd < tjd_stop. After each call, increase the tjd = tret[0] + 2.

If you have a set of stars or planets for which you want to find occultations for the same time range, you have to run the same loop for each of these object. If the events have to be listed in chronological order, you have to sort them before output.

The function returns:

/* retflag
-1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
0 (if no occultation/no eclipse found)
SE_ECL_TOTAL or SE_ECL_ANNULAR or SE_ECL_PARTIAL
SE_ECL_VISIBLE,
SE_ECL_MAX_VISIBLE,
SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
SE_ECL_3ST_VISIBLE, SE_ECL_4ND_VISIBLE
These return values (except the SE_ECL_ANNULAR) also appear with occultations.
tret[0] time of maximum eclipse
tret[1] time of first contact
tret[2] time of second contact
tret[3] time of third contact
tret[4] time of forth contact
tret[5] time of sunrise between first and forth contact (not implemented so far)
tret[6] time of sunset between first and forth contact (not implemented so far)
attr[0] fraction of solar diameter covered by moon (magnitude)
attr[1] ratio of lunar diameter to solar one
attr[2] fraction of solar disc covered by moon (obscuration);
        with total eclipses the ratio of the disc areas (more than 1)
attr[3] diameter of core shadow in km
attr[4] azimuth of sun at tjd
attr[5] true altitude of sun above horizon at tjd
attr[6] apparent altitude of sun above horizon at tjd
attr[7] elongation of moon in degrees
*/

C 8.7 swe_lun_occult_when_glob()

To find the next occultation of a planet or star by the moon globally (not for a particular geographic location), use swe_lun_occult_when_glob().

The same function can also be used for global solar eclipses instead of swe_sol_eclipse_when_glob(), but is less efficient.

/* Same declaration as swe_sol_eclipse_when_glob().
* In addition:
* int32 ipl planet number of occulted body
* char* starname name of occulted star. Must be NULL or "", if a planetary
* occultation is to be calculated. For use of this field,
* see swe_fixstar().
* int32 ifl ephemeris flag. If you want to have only one conjunction
* of the moon with the body tested, add the following flag:
* backward |= SE_ECL_ONE_TRY. If this flag is not set,
* the function will search for an occultation until it
* finds one. For bodies with ecliptical latitudes > 5,
* the function may search successlessly until it reaches
* the end of the ephemeris.
*/
int32 swe_lun_occult_when_glob(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ipl, /* planet number */
      char* starname, /* star name, must be NULL or "" if not a star */
      int32 ifl, /* ephemeris flag */
      int32 ifltype, /* eclipse type wanted */
      double *tret, /* return array, 10 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

An explanation of the ifl |= SE_ECL_ONE_TRY is given above in paragraph about the function swe_lun_occult_when_loc().

The function returns:

/* retflag
-1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
0 (if no occultation / eclipse has been found)
SE_ECL_TOTAL or SE_ECL_ANNULAR or SE_ECL_PARTIAL or SE_ECL_ANNULAR_TOTAL
SE_ECL_CENTRAL
SE_ECL_NONCENTRAL
tret[0] time of maximum eclipse
tret[1] time, when eclipse takes place at local apparent noon
tret[2] time of eclipse begin
tret[3] time of eclipse end
tret[4] time of totality begin
tret[5] time of totality end
tret[6] time of center line begin
tret[7] time of center line end
tret[8] time when annular-total eclipse becomes total not implemented so far
tret[9] time when annular-total eclipse becomes annular again not implemented so far

declare as tret[10] at least!

*/

C 8.8 swe_lun_occult_where ()

Similar to swe_sol_eclipse_where(), this function can be used to find out the geographic position, where, for a given time, a central eclipse is central or where a non-central eclipse is maximal. With occultations, it tells us, at which geographic location the occulted body is in the middle of the lunar disc or closest to it. Because occultations are always visible from a very large area, this is not very interesting information. However, it may become more interesting as soon as the limits of the umbra (and penumbra) will be implemented.

int32 swe_lun_occult_where(
      double tjd_ut, /* time, Jul. day UT */
      int32 ipl, /* planet number */
      char* starname, /* star name, must be NULL or "" if not a star */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* return array, 2 doubles, geo. long. and lat.
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

The function returns:

/* -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
0 if there is no solar eclipse (occultation) at tjd
SE_ECL_TOTAL
SE_ECL_ANNULAR
SE_ECL_TOTAL | SE_ECL_CENTRAL
SE_ECL_TOTAL | SE_ECL_NONCENTRAL
SE_ECL_ANNULAR | SE_ECL_CENTRAL
SE_ECL_ANNULAR | SE_ECL_NONCENTRAL
SE_ECL_PARTIAL
geopos[0]: geographic longitude of central line
geopos[1]: geographic latitude of central line
not implemented so far:
geopos[2]: geographic longitude of northern limit of umbra
geopos[3]: geographic latitude of northern limit of umbra
geopos[4]: geographic longitude of southern limit of umbra
geopos[5]: geographic latitude of southern limit of umbra
geopos[6]: geographic longitude of northern limit of penumbra
geopos[7]: geographic latitude of northern limit of penumbra
geopos[8]: geographic longitude of southern limit of penumbra
geopos[9]: geographic latitude of southern limit of penumbra
eastern longitudes are positive,
western longitudes are negative,
northern latitudes are positive,
southern latitudes are negative
attr[0] fraction of object's diameter covered by moon (magnitude)
attr[1] ratio of lunar diameter to object's diameter
attr[2] fraction of object's disc covered by moon (obscuration);
        with total occultations the ratio of the disc areas (more than 1)
attr[3] diameter of core shadow in km
attr[4] azimuth of object at tjd
attr[5] true altitude of object above horizon at tjd
attr[6] apparent altitude of object above horizon at tjd
attr[7] angular distance of moon from object in degrees

declare as attr[20]!

*/

C 8.9 swe_lun_eclipse_when_loc ()

To find the next lunar eclipse observable from a given geographic position:

int32 swe_lun_eclipse_when_loc(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* 3 doubles for geogr. longitude, latitude, height above sea.
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *tret, /* return array, 10 doubles, see below */
      double *attr, /* return array, 20 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

If your code does not work, please study the sample code in swetest.c.

The function returns:

/* retflag SE_ECL_TOTAL or SE_ECL_PENUMBRAL or SE_ECL_PARTIAL
*
* tret[0] time of maximum eclipse
* tret[1] -
* tret[2] time of partial phase begin (indices consistent with solar eclipses)
* tret[3] time of partial phase end
* tret[4] time of totality begin
* tret[5] time of totality end
* tret[6] time of penumbral phase begin
* tret[7] time of penumbral phase end
* tret[8] time of moonrise, if it occurs during the eclipse
* tret[9] time of moonset, if it occurs during the eclipse
*
* attr[0] umbral magnitude at tjd
* attr[1] penumbral magnitude
* attr[4] azimuth of moon at tjd
* attr[5] true altitude of moon above horizon at tjd
* attr[6] apparent altitude of moon above horizon at tjd
* attr[7] distance of moon from opposition in degrees
* attr[8] umbral magnitude at tjd (= attr[0])
* attr[9] saros series number (if available; otherwise -99999999)
* attr[10] saros series member number (if available; otherwise -99999999) */

C 8.10 swe_lun_eclipse_when ()

To find the next lunar eclipse globally:

int32 swe_lun_eclipse_when(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      int32 ifltype, /* eclipse type wanted: SE_ECL_TOTAL etc. or 0, if any eclipse type */
      double *tret, /* return array, 10 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

Recommended values for ifltype:

/* search for any lunar eclipse, no matter which type */
ifltype = 0;
/* search a total lunar eclipse */
ifltype = SE_ECL_TOTAL;
/* search a partial lunar eclipse */
ifltype = SE_ECL_PARTIAL;
/* search a penumbral lunar eclipse */
ifltype = SE_ECL_PENUMBRAL;

If your code does not work, please study the sample code in swetest.c.

The function returns:

/* retflag -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
SE_ECL_TOTAL or SE_ECL_PENUMBRAL or SE_ECL_PARTIAL
tret[0] time of maximum eclipse
tret[1] -
tret[2] time of partial phase begin (indices consistent with solar eclipses)
tret[3] time of partial phase end
tret[4] time of totality begin
tret[5] time of totality end
tret[6] time of penumbral phase begin
tret[7] time of penumbral phase end
*/

C 8.11 swe_lun_eclipse_how ()

This function computes the attributes of a lunar eclipse at a given time:

int32 swe_lun_eclipse_how(
      double tjd_ut, /* time, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* input array, geopos, geolon, geoheight
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

The function returns:

/* retflag -1 (ERR) on error (e.g. if swe_calc() for sun or moon fails)
SE_ECL_TOTAL or SE_ECL_PENUMBRAL or SE_ECL_PARTIAL
0 if there is no eclipse
attr[0] umbral magnitude at tjd
attr[1] penumbral magnitude
attr[4] azimuth of moon at tjd. Not implemented so far
attr[5] true altitude of moon above horizon at tjd. Not implemented so far
attr[6] apparent altitude of moon above horizon at tjd. Not implemented so far
attr[7] distance of moon from opposition in degrees
attr[8] eclipse magnitude (= attr[0])
attr[9] saros series number (if available; otherwise -99999999)
attr[10] saros series member number (if available; otherwise -99999999)

declare as attr[20] at least!

*/

C 8.12 swe_rise_trans() and swe_rise_trans_true_hor() (risings, settings, meridian transits)

The function swe_rise_trans() computes the times of rising, setting and meridian transits for all planets, asteroids, the moon, and the fixed stars. The function swe_rise_trans_true_hor() does the same for a local horizon that has an altitude != 0.

The function returns a rising time of an object:

And it returns a setting time of an object,

Note, “culmination” does not mean meridian transit, especially not with the Sun, Moon, and planets. The culmination of a moving body with changing declination does not take place exactly on the meridian but shortly before or after the meridian transit. In polar regions, it even happens that the moon "rises" shortly after the culmination, on the west side of the meridian. I. e., the upper limb of its disk will become visible for a short time. The function swe_rise_trans() should catch these cases.

Function definitions are as follows:

int32 swe_rise_trans(
      double tjd_ut, /* search after this time (UT) */
      int32 ipl, /* planet number, if planet or moon */
      char *starname, /* star name, if star; must be NULL or empty, if ipl is used */
      int32 epheflag, /* ephemeris flag */
      int32 rsmi, /* integer specifying that rise, set, or one of the two meridian transits is wanted. see definition below */
      double *geopos, /* array of three doubles containing
      * geograph. long., lat., height of observer */
  double atpress /* atmospheric pressure in mbar/hPa */
  double attemp, /* atmospheric temperature in deg. C */
      double *tret, /* return address (double) for rise time etc. */
      char *serr); /* return address for error message */
int32 swe_rise_trans_true_hor(
      double tjd_ut, /* search after this time (UT) */
      int32 ipl, /* planet number, if planet or moon */
      char *starname, /* star name, if star; must be NULL or empty, if ipl is used */
      int32 epheflag, /* ephemeris flag */
      int32 rsmi, /* integer specifying that rise, set, or one of the two meridian transits is wanted. see definition below */
      double *geopos, /* array of three doubles containing
      * geograph. long., lat., height of observer */
  double atpress, /* atmospheric pressure in mbar/hPa */
      double attemp, /* atmospheric temperature in deg. C */
      double horhgt, /* height of local horizon in deg at the point where the body rises or sets */
      double *tret, /* return address (double) for rise time etc. */
      char *serr); /* return address for error message */

The second function has one additional parameter horhgt for the height of the local horizon at the point where the body rises or sets.

The variable rsmi can have the following values:

/* for swe_rise_trans() and swe_rise_trans_true_hor() */
#define SE_CALC_RISE 1
#define SE_CALC_SET 2
#define SE_CALC_MTRANSIT 4 /* upper meridian transit (southern for northern geo. latitudes) */
#define SE_CALC_ITRANSIT 8 /* lower meridian transit (northern, below the horizon) */
/* the following bits can be added (or'ed) to SE_CALC_RISE or SE_CALC_SET */
#define SE_BIT_DISC_CENTER 256 /* for rising or setting of disc center */
#define SE_BIT_DISC_BOTTOM 8192 /* for rising or setting of lower limb of disc */
#define SE_BIT_GEOCTR_NO_ECL_LAT 128 /* use geocentric (rather than topocentric) position of object and ignore its ecliptic latitude */
#define SE_BIT_NO_REFRACTION 512 /* if refraction is not to be considered */
#define SE_BIT_CIVIL_TWILIGHT 1024 /* in order to calculate civil twilight */
#define SE_BIT_NAUTIC_TWILIGHT 2048 /* in order to calculate nautical twilight */
#define SE_BIT_ASTRO_TWILIGHT 4096 /* in order to calculate astronomical twilight */
#define SE_BIT_FIXED_DISC_SIZE (16*1024) /* neglect the effect of distance on disc size */
#define SE_BIT_ASTROLOGICAL_RISING (SE_BIT_DISC_CENTER | SE_BIT_NO_REFRACTION)
#define SE_BIT_HINDU_RISING (SE_BIT_DISC_CENTER|SE_BIT_NO_REFRACTION|SE_BIT_GEOCTR_NO_ECL_LAT)
/* risings according to Hindu astrology */

The rising times depend on the atmospheric pressure and temperature. atpress expects the atmospheric pressure in millibar (hectopascal); attemp the temperature in degrees Celsius.

If atpress is given the value 0, the function estimates the pressure from the geographical altitude given in geopos[2] and attemp. If geopos[2] (altitude) is 0, atpress will be estimated for sea level.

Function return values are:

8.12.1 Sunrise in Astronomy and in Hindu Astrology

The astronomical sunrise is defined as the time when the upper limb of the solar disk is seen appearing at the horizon. The astronomical sunset is defined as the moment the upper limb of the solar disk disappears below the horizon.

The function swe_rise_trans() by default follows this definition of astronomical sunrises and sunsets. Also, astronomical almanacs and newspapers publish astronomical sunrises and sunset according to this definition.

Hindu astrology and Hindu calendars use a different definition of sunrise and sunset. They consider the Sun as rising or setting, when the center of the solar disk is exactly at the horizon. In addition, the Hindu method ignores atmospheric refraction. Moreover, the geocentric rather than topocentric position is used and the small ecliptic latitude of the Sun is ignored.

In order to calculate correct Hindu rising and setting times, the flags SE_BIT_NO_REFRACTION and SE_BIT_DISC_CENTER must be added (or'ed) to the parameter rsmi. From Swiss Ephemeris version 2.06 on, a flag SE_BIT_HINDU_RISING is supported. It includes the flags SE_BIT_NO_REFRACTION, SE_BIT_DISC_CENTER and SE_BIT_GEOCTR_NO_ECL_LAT.

In order to calculate the sunrise of a given date and geographic location, one can proceed as in the following program (tested code!):

int main()
{
char serr[AS_MAXCH];
double epheflag = SEFLG_SWIEPH;
int gregflag = SE_GREG_CAL;
int year = 2017;
int month = 4;
int day = 12;
int geo_longitude = 76.5; // positive for east, negative for west of Greenwich
int geo_latitude = 30.0;
int geo_altitude = 0.0;
double hour;
// array for atmospheric conditions
double datm[2];
datm[0] = 1013.25; // atmospheric pressure;
// irrelevant with Hindu method, can be set to 0
datm[1] = 15; // atmospheric temperature;
// irrelevant with Hindu method, can be set to 0
// array for geographic position
double geopos[3];
geopos[0] = geo_longitude;
geopos[1] = geo_latitude;
geopos[2] = geo_altitude; // height above sea level in meters;
// irrelevant with Hindu method, can be set to 0
swe_set_topo(geopos[0], geopos[1], geopos[2]);
int ipl = SE_SUN; // object whose rising is wanted
char starname[255]; // name of star, if a star's rising is wanted
// is "" or NULL, if Sun, Moon, or planet is calculated
double trise; // for rising time
double tset; // for setting time
// calculate the Julian day number of the date at 0:00 UT:
double tjd = swe_julday(year,month,day,0,gregflag);
// convert geographic longitude to time (day fraction) and subtract it from tjd
// this method should be good for all geographic latitudes except near in
// polar regions
double dt = geo_longitude / 360.0;
tjd = tjd - dt;
// calculation flag for Hindu risings/settings
int rsmi = SE_CALC_RISE | SE_BIT_HINDU_RISING;
// or SE_CALC_RISE + SE_BIT_HINDU_RISING;
// or SE_CALC_RISE | SE_BIT_DISC_CENTER | SE_BIT_NO_REFRACTION | SE_BIT_GEOCTR_NO_ECL_LAT;
int return_code = swe_rise_trans(tjd, ipl, starname, epheflag, rsmi, geopos, datm[0], datm[1], &trise, serr);
if (return_code == ERR) {
// error action
printf("%s\n", serr);
}
// conversion to local civil time zone must be made by the user. The Swiss Ephemeris
// does not have a function for that.
// After that, the Julian day number of the rising time can be converted into
// date and time:
swe_revjul(trise, gregflag, &year, &month, &day, &hour);
printf("sunrise: date=%d/%d/%d, hour=%.6f UT\n", year, month, day, hour);
// To calculate the time of the sunset, you can either use the same
// tjd increased or trise as start date for the search.
rsmi = SE_CALC_SET | SE_BIT_DISC_CENTER | SE_BIT_NO_REFRACTION;
return_code = swe_rise_trans(tjd, ipl, starname, epheflag, rsmi, geopos, datm[0], datm[1], &tset, serr);
if (return_code == ERR) {
// error action
printf("%s\n", serr);
}
printf("sunset : date=%d/%d/%d, hour=%.6f UT\n", year, month, day, hour);
}

C 8.13 swe_pheno_ut() and swe_pheno(), planetary phenomena

These functions compute phase, phase angle, elongation, apparent diameter, apparent magnitude for the Sun, the Moon, all planets and asteroids. The two functions do exactly the same but expect a different time parameter.

int32 swe_pheno_ut(
      double tjd_ut, /* time Jul. Day UT */
      int32 ipl, /* planet number */
      int32 iflag, /* ephemeris flag */
      double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

int32 swe_pheno(
      double tjd_et, /* time Jul. Day TT (ET) */
      int32 ipl, /* planet number */
      int32 iflag, /* ephemeris flag */
      double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

The function returns:

/*
attr[0] = phase angle (Earth-planet-sun)
attr[1] = phase (illumined fraction of disc)
attr[2] = elongation of planet
attr[3] = apparent diameter of disc
attr[4] = apparent magnitude

declare as attr[20] at least!

NOTE: the lunar magnitude is quite a complicated thing,
whereas our algorithm is very simple.
The phase of the moon, its distance from the Earth and
the sun is considered, but no other factors.
iflag also allows SEFLG_TRUEPOS, SEFLG_HELCTR
*/

C 8.14 swe_azalt(), horizontal coordinates, azimuth, altitude

swe_azalt() computes the horizontal coordinates (azimuth and altitude) of a planet or a star from either ecliptical or equatorial coordinates.

void swe_azalt(
      double tjd_ut, // UT
      int32 calc_flag, // SE_ECL2HOR or SE_EQU2HOR
      double *geopos, // array of 3 doubles: geograph. long., lat., height
      double atpress, // atmospheric pressure in mbar (hPa)
      double attemp, // atmospheric temperature in degrees Celsius
      double *xin, // array of 3 doubles: position of body in either ecliptical or equatorial coordinates, depending on calc_flag
      double *xaz); // return array of 3 doubles, containing azimuth, true altitude, apparent altitude

If calc_flag = SE_ECL2HOR, set xin[0] = ecl. long., xin[1] = ecl. lat., (xin[2] = distance (not required));

else

if calc_flag = SE_EQU2HOR, set xin[0] = right ascension, xin[1] = declination, (xin[2] = distance (not required));

#define SE_ECL2HOR 0
#define SE_EQU2HOR 1

The return values are:

The apparent altitude of a body depends on the atmospheric pressure and temperature. If only the true altitude is required, these parameters can be neglected.

If atpress is given the value 0, the function estimates the pressure from the geographical altitude given in geopos[2] and attemp. If geopos[2] (altitude) is 0, atpress will be estimated for sea level.

The refraction for xaz[2] uses the temperature lapse rate dT/dh = 0.0065 K/m. swe_set_lapse_rate() changes it for the calling thread; it is used only by swe_azalt() (swe_refrac_extended() takes the lapse rate as a parameter):

void swe_set_lapse_rate(double lapse_rate); // dT/dh in K/m, default 0.0065

C 8.15 swe_azalt_rev()

The function swe_azalt_rev() is not precisely the reverse of swe_azalt(). It computes either ecliptical or equatorial coordinates from azimuth and true altitude. If only an apparent altitude is given, the true altitude has to be computed first with the function swe_refrac() (see below).

The function is defined as follows:

void swe_azalt_rev(
      double tjd_ut,
      int32 calc_flag, /* either SE_HOR2ECL or SE_HOR2EQU */
      double *geopos, /* array of 3 doubles for geograph. pos. of observer */
      double *xin, /* array of 2 doubles for azimuth and true altitude of planet */
      double *xout); // return array of 2 doubles for either ecliptic or
  // equatorial coordinates, depending on calc_flag

For the definition of the azimuth and true altitude, see chapter 8.14 on swe_azalt().

#define SE_HOR2ECL 0
#define SE_HOR2EQU 1

C 8.16 swe_refrac(), swe_refrac_extended(), refraction

The refraction function swe_refrac() calculates either the true altitude from the apparent altitude or the apparent altitude from the apparent altitude. Its definition is:

double swe_refrac(
      double inalt,
      double atpress, /* atmospheric pressure in mbar (hPa) */
      double attemp, /* atmospheric temperature in degrees Celsius */
      int32 calc_flag); /* either SE_TRUE_TO_APP or SE_APP_TO_TRUE */

where:

#define SE_TRUE_TO_APP 0
#define SE_APP_TO_TRUE 1

The refraction depends on the atmospheric pressure and temperature at the location of the observer.

There is also a more sophisticated function swe_refrac_extended(). It allows correct calculation of refraction for altitudes above sea > 0, where the ideal horizon and planets that are visible may have a negative height. (for swe_refrac(), negative apparent heights do not exist!)

double swe_refrac_extended(
      double inalt, /* altitude of object above geometric horizon in degrees, where geometric horizon = plane perpendicular to gravity */
      double geoalt, /* altitude of observer above sea level in meters */
      double atpress, /* atmospheric pressure in mbar (hPa) */
      double attemp, /* atmospheric temperature in degrees Celsius */
      double lapse_rate, /* (dattemp/dgeoalt) = [°K/m] */
      int32 calc_flag,
      double *dret); /* array of 4 doubles; declare 20 ! */
  * - dret[0] true altitude, if possible; otherwise input value
  * - dret[1] apparent altitude, if possible; otherwise input value
  * - dret[2] refraction
  * - dret[3] dip of the horizon
  /* either SE_TRUE_TO_APP or SE_APP_TO_TRUE */

Function returns:

The body is above the horizon if the dret[0] != dret[1].

C 8.17 Heliacal risings etc.: swe_heliacal_ut()

The function swe_heliacal_ut() calculates the Julian day of the next heliacal phenomenon after a given start date. It works between geographic latitudes 60s – 60n.

int32 swe_heliacal_ut(
      double tjdstart, /* Julian day number of start date for the search of the heliacal event */
      double *dgeo /* geographic position (details below) */
  double *datm, /* atmospheric conditions (details below) */
      double *dobs, /* observer description (details below) */
      char *objectname, /* name string of fixed star or planet */
      int32 event_type, /* event type (details below) */
      int32 helflag, /* calculation flag, bitmap (details below) */
      double *dret, /* result: array of at least 50 doubles, of which 3 are used at the moment */
      char * serr); /* error string */
The function returns OK or ERR.

Details for dgeo[] (array of doubles):

Details for datm[] (array of doubles):

Default values:

If this is too much for you, set all these values to 0. The software will then set the following defaults:

Pressure 1013.25, temperature 15, relative humidity 40. The values will be modified depending on the altitude of the observer above sea level.

If the extinction coefficient (meteorological range) datm[3] is 0, the software will calculate its value from datm[0..2].

Details for dobs[] (array of six doubles):

The following parameters are only relevant if the flag SE_HELFLAG_OPTICAL_PARAMS is set:

Details for event_type:

Details for helflag:

helflag contains ephemeris flag, like iflag in swe_calc() etc. In addition it can contain the following bits:

SE_HELFLAG_OPTICAL_PARAMS (512): Use this with calculations for optical instruments.

Unless this bit is set, the values of dobs[2-5] are ignored.

SE_HELFLAG_NO_DETAILS (1024): provide the date, but not details like visibility start, optimum, and end. This bit makes the program a bit faster.

SE_HELFLAG_VISLIM_DARK (4096): function behaves as if the Sun were at the nadir.

SE_HELFLAG_VISLIM_NOMOON (8192): function behaves as if the Moon were at the nadir, i. e. the Moon as a factor disturbing the observation is excluded. This flag is useful if one is not really interested in the heliacal date of that particular year, but in general in the heliacal date of that epoch.

Some other SE_HELFLAG_ bits found in swephexp.h were made for mere test purposes and may change in future releases. Please do not use them and do not request any support or information related to them.

Details for return array dret[] (array of doubles):

Strange phenomena:

swetest -hev1 -p3 -b1.1.2008 -geopos8,47,900 -at1000,10,20,0.15 -obs21,1 -n1 -lmt

Venus heliacal rising : 2009/03/23 05:30:12.4 LMT (2454913.729310), visible for: 4.9 min

swetest -hev2 -p3 -b1.1.2008 -geopos8,47,900 -at1000,10,20,0.15 -obs21,1 -n1 -lmt

Venus heliacal setting: 2009/03/25 18:37:41.6 LMT (2454916.276175), visible for: 15.1 min

swetest -hev3 -p1 -b1.4.2008 -geopos8,47,900 -at1000,10,40,0.15 -obs21,1.5 -n1 -lmt

Moon evening first : 2008/04/06 10:33:44.3 LMT (2454562.940096), visible for: 530.6 min

The user must be aware that strange phenomena occur especially for high geographic latitudes and circumpolar objects and that the function swe_heliacal_ut() may not always be able to handle them correctly. Special cases can best be researched using the function swe_vis_limit_mag().

C 8.18 Magnitude limit for visibility: swe_vis_limit_mag()

The function swe_vis_limit_mag() determines the limiting visual magnitude in dark skies. If the visual magnitude mag of an object is known for a given date (e. g. from a call of function swe_pheno_ut()), and if mag is smaller than the value returned by swe_vis_limit_mag(), then it is visible.

double swe_vis_limit_mag(
      double tjdut, /* Julian day number */
      double *dgeo /* geographic position (details under swe_heliacal_ut() */
  double *datm, /* atmospheric conditions (details under swe_heliacal_ut()) */
      double *dobs, /* observer description (details under swe_heliacal_ut()) */
      char *objectname, /* name string of fixed star or planet */
      int32 helflag, /* calculation flag, bitmap (details under swe_heliacal_ut()) */
      double *dret, /* result: magnitude required of the object to be visible */
      char * serr); /* error string */

The function returns:

Details for arrays dgeo[], datm[], dobs[] and the other parameters are given under “8.17. Heliacal risings etc.: swe_heliacal_ut()”.

Details for return array dret[] (array of doubles):

C 8.19 Heliacal details: swe_heliacal_pheno_ut()

The function swe_heliacal_pheno_ut() provides data that are relevant for the calculation of heliacal risings and settings. This function does not provide data of heliacal risings and settings, just some additional data mostly used for test purposes. To calculate heliacal risings and settings, please use the function swe_heliacal_ut() documented further above.

double swe_heliacal_pheno_ut(
      double tjd_ut, /* Julian day number of hel. event as calculated by swe_heliacal_ut() */
      double *dgeo, /* geographic position (details under swe_heliacal_ut() */
      double *datm, /* atmospheric conditions (details under swe_heliacal_ut()) */
      double *dobs, /* observer description (details under swe_heliacal_ut()) */
      char *objectname, /* name string of fixed star or planet */
      int32 event_type, /* event type (details under function swe_heliacal_ut()) */
      int32 helflag, /* calculation flag, bitmap (details under swe_heliacal_ut()) */
      double *darr, /* return array, declare array of 50 doubles */
      char *serr); /* error string */

The return array has the following data:

'0=AltO [deg] topocentric altitude of object (unrefracted)
'1=AppAltO [deg] apparent altitude of object (refracted)
'2=GeoAltO [deg] geocentric altitude of object
'3=AziO [deg] azimuth of object
'4=AltS [deg] topocentric altitude of Sun
'5=AziS [deg] azimuth of Sun
'6=TAVact [deg] actual topocentric arcus visionis
'7=ARCVact [deg] actual (geocentric) arcus visionis
'8=DAZact [deg] actual difference between object's and sun's azimuth
'9=ARCLact [deg] actual longitude difference between object and sun
'10=kact [-] extinction coefficient
'11=minTAV [deg] smallest topocentric arcus visionis
'12=TfistVR [JDN] first time object is visible, according to VR
'13=TbVR [JDN optimum time the object is visible, according to VR
'14=TlastVR [JDN] last time object is visible, according to VR
'15=TbYallop [JDN] best time the object is visible, according to Yallop
'16=WMoon [deg] crescent width of Moon
'17=qYal [-] q-test value of Yallop
'18=qCrit [-] q-test criterion of Yallop
'19=ParO [deg] parallax of object
'20 Magn [-] magnitude of object
'21=RiseO [JDN] rise/set time of object
'22=RiseS [JDN] rise/set time of Sun
'23=Lag [JDN] rise/set time of object minus rise/set time of Sun
'24=TvisVR [JDN] visibility duration
'25=LMoon [deg] crescent length of Moon
'26=CVAact [deg]
'27=Illum [%] new
'28=CVAact [deg] new
'29=MSk [-]

C 9 Date and time conversion functions

C 9.1 Calendar date and Julian day: swe_julday(), swe_date_conversion(), /swe_revjul()

These functions are needed to convert calendar dates to the astronomical time scale which measures time in Julian days. The Julian day number has nothing to do with Julius Cesar, who introduced the Julian calendar, but was invented by the monk Julianus. The Julian day number tells for a given date the number of days that have passed since the creation of the world which was then considered to have happened on 1 Jan - 4712 at noon. E.g. the 1.1.1900 corresponds to the Julian day number 2415020.5.

Midnight has always a JD with fraction 0.5 because traditionally the astronomical day started at noon. This was practical because then there was no change of date during a night at the telescope. This also explains why noon ephemerides were used before midnight ephemerides were introduced early in the 20th century.

To calculate a planetary position from a date, you first convert the date into a Julian daynumber:

double tjd_ut = swe_julday(jyear, jmon, jday, jut, SE_GREG_CAL);

Then calculate the planetary position using that Julian daynumber:

iflgret = swe_calc_ut(tjd_ut, SE_VENUS, iflag, x, serr);

The functions for date conversion to and from a Julian daynumber are defined as follows:

double swe_julday(
      int year,
      int month,
      int day,
      double hour,
      int gregflag);

int swe_date_conversion(
      int y, int m, int d, /* year, month, day */
      double hour, /* hours (decimal, with fraction) */
      char c, /* calendar 'g'[regorian]|'j'[ulian] */
      double *tjd); /* return value for Julian day */

void swe_revjul(
      double tjd, /* Julian day number */
      int gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      int *year, /* target addresses for year, etc. */
      int *month, int *day, double *hour);

swe_julday() and swe_date_conversion() compute a Julian day number from year, month, day, and hour. swe_date_conversion() checks in addition whether the date is legal. It returns OK or ERR.

swe_revjul() is the reverse function of swe_julday(). It computes year, month, day and hour from a Julian day number.

With swe_julday() and swe_date_conversion(), variable gregflag tells the function whether the input date is Julian calendar (gregflag = SE_JUL_CAL) or Gregorian calendar (gregflag = SE_GREG_CAL).

With swe_revjul(), gregflag tells the function whether the output date should be given in the Julian or the Gregorian calendar.

Usually, you will set gregflag = SE_GREG_CAL.

C 9.2 UTC and Julian day: swe_utc_time_zone(), swe_utc_to_jd(), swe_jdet_to_utc(), swe_jdut1_to_utc()

Clock time is UTC plus the time zone offset. Planets and fixed stars need Terrestrial Time (TT); houses and sidereal time need UT1, the time of the Earth’s rotation. swe_julday() does not convert between time scales: with a UTC date and time as input, it returns a Julian day number in UTC, which is neither TT nor UT1. swe_utc_to_jd() returns both:

TT  = UTC + 32.184 s + (TAI - UTC)   (from 1972; since 1 January 2017: TT = UTC + 69.184 s)
UT1 = TT - Delta T

The difference DUT1 = UT1 - UTC = 69.184 s - Delta T was kept below 0.9 s by leap seconds; the last one was inserted on 31 December 2016. In 2026, the General Conference on Weights and Measures (CGPM) decided that there will be no more leap seconds. DUT1 now changes with Delta T, and nobody knows how fast: Delta T has even decreased slightly in recent years. With the Delta T values of the Swiss Ephemeris, DUT1 exceeds 1 s in absolute value from about 2031 and is about -6 s in 2050.

An application that takes swe_julday() of the clock time as tjd_ut computes the whole chart for the moment when UT1 equals the clock reading, i.e. off by DUT1. Example: for 15 June 2050, 12:30 UTC, in Zurich (DUT1 = -6.1 s), the Moon is off by 3.5 arcsec, the Ascendant by 68 arcsec and the MC by 85 arcsec. Therefore:

These functions exist since Swiss Ephemeris version 1.76. The past leap seconds are built into the Swiss Ephemeris.

Note that the Swiss Ephemeris does not have any information about time zones. You have to find out the time zone offset you need from other sources, e.g. from the tz database (https://en.wikipedia.org/wiki/Tz_database, retrieved 26 oct 2026).

NOTE: At a past leap second, the input or output time may be 60.9999 seconds. Input or output forms in your application have to allow for this.

/* swe_utc_time_zone():
* transform local civil time to UTC or UTC to local civil time
*
* input:
* iyear ... dsec date and time
* d_timezone timezone offset of location (to be found in tz database)
* output:
* iyear_out ... dsec_out
*
* For time zones east of Greenwich, d_timezone is positive.
* For time zones west of Greenwich, d_timezone is negative.
*
* For conversion from local civil time to utc, use +d_timezone.
* For conversion from utc to local civil time, use -d_timezone.
*/
void swe_utc_time_zone(
      /* input date */
  int32 iyear, int32 imonth, int32 iday,
      int32 ihour, int32 imin, double dsec,
      double d_timezone, /* timezone offset of location (to be found in tz database) */
      /* output date */
  int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
      int32 *ihour_out, int32 *imin_out, double *dsec_out);
/* swe_utc_to_jd():
* input: date and time (UTC), calendar flag.
* output: an array of doubles with Julian Day number in TT (ET) and UT (UT1)
* an error message (on error)
* The function returns OK or ERR.
*/
int32 swe_utc_to_jd(
      int32 iyear, int32 imonth, int32 iday,
      int32 ihour, int32 imin, double dsec, /* NOTE: second is a decimal */
      int32 gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      double *dret, /* return array, two doubles:
      * dret[0] = Julian day in TT (ET)
  * dret[1] = Julian day in UT (UT1) */
  char *serr); /* error string */
/* swe_jdet_to_utc():
* input: Julian day number in TT (ET), calendar flag
* output: year, month, day, hour, min, sec in UTC */
void swe_jdet_to_utc(
      double tjd_et, /* Julian day number in TT (ET) */
      int32 gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      int32 *iyear, int32 *imonth, int32 *iday,
      int32 *ihour, int32 *imin, double *dsec); /* NOTE: second is a decimal */
/* swe_jdut1_to_utc():
* input: Julian day number in UT (UT1), calendar flag
* output: year, month, day, hour, min, sec in UTC */
void swe_jdut1_to_utc(
      double tjd_ut, /* Julian day number in UT (UT1) */
      int32 gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      int32 *iyear, int32 *imonth, int32 *iday,
      int32 *ihour, int32 *imin, double *dsec); /* NOTE: second is a decimal */

From a clock date and time to planets and houses, and a time back to clock time (tested with SE 3.00.00):

#include <stdio.h>
#include "swephexp.h"
int main(void)
{
  /* clock time as entered: 15 June 2050, 14:30 summer time in Zurich (UTC + 2 h) */
  int32 iyear = 2050, imonth = 6, iday = 15, ihour = 14, imin = 30;
  double dsec = 0;
  double d_timezone = 2.0; /* east of Greenwich is positive */
  int32 gregflag = SE_GREG_CAL;
  double geolat = 47.37, geolon = 8.55;
  int32 iy, im, id, ih, imn;
  double ds, dret[2], tjd_ut, xx[6], cusps[13], ascmc[10];
  char serr[AS_MAXCH];
  /* local civil time to UTC */
  swe_utc_time_zone(iyear, imonth, iday, ihour, imin, dsec, d_timezone,
    &iy, &im, &id, &ih, &imn, &ds);
  /* UTC to Julian day numbers in TT and UT1 */
  if (swe_utc_to_jd(iy, im, id, ih, imn, ds, gregflag, dret, serr) == ERR) {
    fprintf(stderr, "%s\n", serr);
    return 1;
  }
  tjd_ut = dret[1]; /* UT1; dret[0] is TT */
  /* planets: swe_calc_ut() with tjd_ut, or swe_calc() with dret[0] (same result) */
  if (swe_calc_ut(tjd_ut, SE_MOON, SEFLG_SPEED, xx, serr) == ERR) {
    fprintf(stderr, "%s\n", serr);
    return 1;
  }
  /* houses always with tjd_ut */
  swe_houses(tjd_ut, geolat, geolon, 'P', cusps, ascmc);
  printf("Moon %.6f  Asc %.6f  MC %.6f\n", xx[0], ascmc[SE_ASC], ascmc[SE_MC]);
  /* a time in UT1 (e.g. from swe_rise_trans()) back to local civil time */
  swe_jdut1_to_utc(tjd_ut, gregflag, &iy, &im, &id, &ih, &imn, &ds);
  swe_utc_time_zone(iy, im, id, ih, imn, ds, -d_timezone,
    &iy, &im, &id, &ih, &imn, &ds);
  printf("%d-%02d-%02d %02d:%02d:%06.3f\n", iy, im, id, ih, imn, ds);
  return 0;
}

C 9.3 Handling of future leap seconds and the file seleapsec.txt

This chapter and the file seleapsec.txt are obsolete. In 2026, the General Conference on Weights and Measures (abbreviated CGPM) decided that there won’t be any more leap seconds in the future. Only in the very far future, maybe in 1000 years, when the difference between UT1 and UTC will amount to an hour, a leap hour will be inserted.

C 9.4 Mean solar time versus True solar time: swe_time_equ(), swe_lmt_to_lat(), swe_lat_to_lmt()

Universal Time (UT or UTC) is based on Mean Solar Time, AKA Local Mean Time, which is a uniform measure of time. A day has always the same length, independent of the time of the year.

In the centuries before mechanical clocks where used, when the reckoning of time was mostly based on sun dials, the True Solar Time was used, also called Local Apparent Time.

The difference between Local Mean Time and Local Apparent Time is called the equation of time. This difference can become as large as 20 minutes.

If a historical date was noted in Local Apparent Time, it must first be converted to Local Mean Time by applying the equation of time, before it can be used to compute Universal Time (for the houses) and finally Ephemeris Time (for the planets).

This conversion can be done using the function swe_lat_to_lmt(). The reverse function is swe_lmt_to_lat(). If required, the equation of time itself, i. e. the value e = LAT - LMT, can be calculated using the function swe_time_equ():

/* Equation of Time
* The function returns the difference between local apparent and local mean time in days.
* E = LAT - LMT
* Input variable tjd is UT.
*/
int swe_time_equ(
      double tjd,
      double* e,
      char* serr);

For conversions between Local Apparent Time and Local Mean Time, it is recommended to use the following functions:

/* converts Local Mean Time (LMT) to Local Apparent Time (LAT) */
/* tjd_lmt and tjd_lat are a Julian day number
* geolon is geographic longitude, where eastern longitudes are positive,
* western ones negative */
int32 swe_lmt_to_lat(
      double tjd_lmt,
      double geolon,
      double *tjd_lat,
      char *serr);
/* converts Local Apparent Time (LAT) to Local Mean Time (LMT) */
int32 swe_lat_to_lmt(
      double tjd_lat,
      double geolon,
      double *tjd_lmt,
      char *serr);

C 9.5 A note on year numbering

There are two numbering systems for years before the year 1 CE. The historical numbering system (indicated with BCE) has no year zero. Year 1 BCE is followed directly by year 1 CE.

The astronomical year numbering system does have a year zero; years before the common era are indicated by negative year numbers. The sequence is year -1, year 0, year 1 CE.

The historical year 1 BCE corresponds to astronomical year 0,

the historical year 2 BCE corresponds to astronomical year -1, etc.

Our date and time conversion functions use the astronomical year numbering both in input and output.

C 10 Delta T-related functions

Sidereal time and the astrological houses are computed with a Julian day number in Universal Time (UT1; from a clock time, get it with swe_utc_to_jd(), see 9.2). However, planetary or fixed star positions need to be calculated using Terrestrial Time (TT) (former Ephemeris time (ET)). The difference between UT and TT is defined as follows:

tjd_tt = tjd_ut + swe_deltat_ex(tjd_ut, ephe_flag, serr);

On the other hand, to calculate UT from TT, you need an iteration

double tjd_ut = tjd_tt;
for (int i = 0; i < 3; i++) {
tjd_ut = tjd_tt - swe_deltat_ex(tjd_ut, ephe_flag, serr);
}

You can avoid this complication by using functions such as swe_calc_ut() or swe_fixstar2_ut(), which have a “_ut” in their names. These functions call swe_deltat_ex() themselves internally.

However, if for any reasons you need calculations in Terrestrial Time (TT) and use functions such as swe_calc() or swe_fixstar2(), you may have to convert UT into TT or TT into UT. To do this, you will need the function swe_deltat_ex() or the older swe_deltat().

The calculation of Delta T depends on the tidal acceleration of the Moon, which depends on the ephemeris chosen. The function swe_deltat_ex() can provide ephemeris-dependent values of Delta T. The old function swe_deltat(), on the other hand, makes an unsafe guess of what ephemeris is being used. It is therefore safer to use the function swe_deltat_ex().

In case you need to control the tidal acceleration of the Moon, you can use the functions swe_get_tid_acc() and swe_set_tid_acc();

C 10.1 swe_deltat_ex()

Please read the explanations given above in chapter 10.

This function provides Delta T for a given Julian daynumber.

/* delta t from Julian day number */
double swe_deltat_ex(
      double tjd,
      int32 ephe_flag,
      char *serr);

where

If the function is called with SEFLG_SWIEPH before calling swe_set_ephe_path(), or with or SEFLG_JPLEPH before calling swe_set_jpl_file(), then it returns a warning.

C 10.2 swe_deltat()

This is SE’s older Delta T function.

For correct values of Delta T, it is better to use the newer function swe_deltat_ex() (see 10.1 above).

/* delta t from Julian day number */
double swe_deltat(
      double tjd);

where

This function is safe only:

C 10.3 swe_set_tid_acc(), swe_get_tid_acc()

To find out the value of the tidal acceleration currently used, call the function

/* get tidal acceleration used in swe_deltat() */
double swe_get_tid_acc(void);

In order to set a tidal acceleration to be used, call the function

/* set tidal acceleration to be used in swe_deltat() */
void swe_set_tid_acc(double t_acc);

With Swiss Ephemeris versions until 1.80, this function had always to be used, if a nonstandard ephemeris like DE200 or DE421 was used.

Since Swiss Ephemeris version 2.00, this function is usually not needed, because the value is automatically set according to the ephemeris files selected or available. However, under certain circumstances, users may want to control the tidal acceleration themselves.

Thus, in order to get the currently used value, call:

acceleration = swe_get_tid_acc();

In order to set a different value, call:

swe_set_tid_acc(acceleration);

The values that acceleration can have are listed in swephexp.h. (e.g. SE_TIDAL_200, etc.)

Once the function swe_set_tid_acc() has been used, the automatic setting of tidal acceleration is blocked. In order to unblock it again, call

swe_set_tid_acc(SE_TIDAL_AUTOMATIC);

C 10.4 swe_set_delta_t_userdef()

/* set fixed Delta T value to be returned by swe_deltat() */
void swe_set_delta_t_userdef(
      double t_acc);

This function allows the user to set a fixed Delta T value that will be returned by swe_deltat() or swe_deltat_ex().

The same Delta T value will then be used by swe_calc_ut(), eclipse functions, heliacal functions, and all functions that require UT as input time.

In order to return to automatic Delta T, call this function with the following value:

swe_set_delta_t_userdef(SE_DELTAT_AUTOMATIC);

C 10.5 Future updates of Delta T and the file swe_deltat.txt

Delta T values for future years can only be estimated. The Swiss Ephemeris has a built-in table with one value of Delta T per year, for 1 January: observed values up to the current year and a prediction from IERS Bulletin A for the following year. After the end of the table, a polynomial (Stephenson, Morrison and Hohenkerk 2016) takes over, with a transition within 100 years. The table is updated every year in January, after the observed value for 1 January has been published.

Users who do not update the Swiss Ephemeris can add or override values in the file swe_deltat.txt (or sedeltat.txt) in the ephemeris path. Each line holds a year and Delta T in seconds for 1 January of that year; lines starting with # are comments. The years must follow each other without gaps. The file is read once, at the first computation of Delta T. A program that sets the ephemeris path with swe_set_ephe_path() must do so before; otherwise the file is searched in the default path (or in SE_EPHE_PATH from the environment).

# Delta T in seconds for 1 January of the year
2026 69.1099
2027 69.3067

C 11 The function swe_set_topo() for topocentric planet positions

void swe_set_topo( /* 3 doubles for geogr. longitude, latitude, height above sea.
double geolon, * eastern longitude is positive,
double geolat, * western longitude is negative,
double altitude); * northern latitude is positive,
* southern latitude is negative */

This function must be called before topocentric planet positions for a certain birth place can be computed. It tells the Swiss Ephemeris what geographic position is to be used. Geographic longitude geolon and latitude geolat must be in degrees, the altitude above sea must be in meters. Longitude and latitude refer to the WGS84 ellipsoid (a = 6378137 m, 1/f = 298.257223563), as GPS coordinates do. Polar motion is not applied: the observer’s place can be off by some meters (1 January 2025: 3 m in latitude, 7 m in longitude at 47 N), the topocentric Moon by a few mas (compared with JPL Horizons up to 4.2 mas; with polar motion 0.7 mas). Neglecting the altitude can result in an error of about 2 arc seconds with the Moon at an altitude 3000 m. After calling swe_set_topo(), add SEFLG_TOPOCTR to iflag and call swe_calc() in the same way as with an ordinary computation. E.g.:

swe_set_topo(geo_lon, geo_lat, altitude_above_sea);
iflag |= SEFLG_TOPOCTR;
for (i = 0; i < NPLANETS; i++) {
iflgret = swe_calc(tjd, ipl, iflag, xp, serr);
printf("%f\n", xp[0]);
}

The parameters set by swe_set_topo() survive swe_close().

Functions that change the geographic position. The following functions call swe_set_topo() themselves with the place given to them and do not restore the previous one: swe_sol_eclipse_when_loc(), swe_sol_eclipse_how(), swe_lun_occult_when_loc(), swe_lun_eclipse_when_loc(), swe_lun_eclipse_how() (if geopos is not NULL), swe_rise_trans() and swe_rise_trans_true_hor() (except with SE_BIT_GEOCTR_NO_ECL_LAT), swe_gauquelin_sector() with methods 2 - 5, swe_heliacal_ut(), swe_heliacal_pheno_ut() and swe_vis_limit_mag(). swe_sol_eclipse_where(), swe_lun_occult_where() and swe_sol_eclipse_when_glob() set the place where the eclipse or occultation is greatest at the time they compute. After such a call, topocentric positions refer to that place. If it is not your place, call swe_set_topo() again.

C 12 Sidereal mode functions

C 12.1 swe_set_sid_mode()

void swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);

This function can be used to specify the mode for sidereal computations.

swe_calc_ut() or swe_fixstar_ut() has then to be called using the bit SEFLG_SIDEREAL.

If swe_set_sid_mode() is not called, the default ayanamsha according to Fagan/Bradley is used.

If a predefined mode is wanted, the variable sid_mode has to be set, while t0 and ayan_t0 are not considered, i.e. they can be 0. The predefined sidereal modes are:

#define SE_SIDM_FAGAN_BRADLEY 0
#define SE_SIDM_LAHIRI 1
#define SE_SIDM_DELUCE 2
#define SE_SIDM_RAMAN 3
#define SE_SIDM_USHASHASHI 4
#define SE_SIDM_KRISHNAMURTI 5
#define SE_SIDM_DJWHAL_KHUL 6
#define SE_SIDM_YUKTESHWAR 7
#define SE_SIDM_JN_BHASIN 8
#define SE_SIDM_BABYL_KUGLER1 9
#define SE_SIDM_BABYL_KUGLER2 10
#define SE_SIDM_BABYL_KUGLER3 11
#define SE_SIDM_BABYL_HUBER 12
#define SE_SIDM_BABYL_ETPSC 13
#define SE_SIDM_ALDEBARAN_15TAU 14
#define SE_SIDM_HIPPARCHOS 15
#define SE_SIDM_SASSANIAN 16
#define SE_SIDM_GALCENT_0SAG 17
#define SE_SIDM_J2000 18
#define SE_SIDM_J1900 19
#define SE_SIDM_B1950 20
#define SE_SIDM_SURYASIDDHANTA 21
#define SE_SIDM_SURYASIDDHANTA_MSUN 22
#define SE_SIDM_ARYABHATA 23
#define SE_SIDM_ARYABHATA_MSUN 24
#define SE_SIDM_SS_REVATI 25
#define SE_SIDM_SS_CITRA 26
#define SE_SIDM_TRUE_CITRA 27
#define SE_SIDM_TRUE_REVATI 28
#define SE_SIDM_TRUE_PUSHYA 29
#define SE_SIDM_GALCENT_RGBRAND 30
#define SE_SIDM_GALEQU_IAU1958 31
#define SE_SIDM_GALEQU_TRUE 32
#define SE_SIDM_GALEQU_MULA 33
#define SE_SIDM_GALALIGN_MARDYKS 34
#define SE_SIDM_TRUE_MULA 35
#define SE_SIDM_GALCENT_MULA_WILHELM 36
#define SE_SIDM_ARYABHATA_522 37
#define SE_SIDM_BABYL_BRITTON 38
#define SE_SIDM_TRUE_SHEORAN 39
#define SE_SIDM_GALCENT_COCHRANE 40
#define SE_SIDM_GALEQU_FIORENZA 41
#define SE_SIDM_VALENS_MOON 42
#define SE_SIDM_LAHIRI_1940 43
#define SE_SIDM_LAHIRI_VP285 44
#define SE_SIDM_KRISHNAMURTI_VP291 45
#define SE_SIDM_LAHIRI_ICRC 46
#define SE_SIDM_USER 255

The function swe_get_ayanamsa_name() returns the name of the ayanamsha.

const char *swe_get_ayanamsa_name(int32 isidmode)

namely:

"Fagan/Bradley", 0 SE_SIDM_FAGAN_BRADLEY
"Lahiri", 1 SE_SIDM_LAHIRI
"De Luce", 2 SE_SIDM_DELUCE
"Raman", 3 SE_SIDM_RAMAN
"Usha/Shashi", 4 SE_SIDM_USHASHASHI
"Krishnamurti", 5 SE_SIDM_KRISHNAMURTI
"Djwhal Khul", 6 SE_SIDM_DJWHAL_KHUL
"Yukteshwar", 7 SE_SIDM_YUKTESHWAR
"J.N. Bhasin", 8 SE_SIDM_JN_BHASIN
"Babylonian/Kugler 1", 9 SE_SIDM_BABYL_KUGLER1
"Babylonian/Kugler 2", 10 SE_SIDM_BABYL_KUGLER2
"Babylonian/Kugler 3", 11 SE_SIDM_BABYL_KUGLER3
"Babylonian/Huber", 12 SE_SIDM_BABYL_HUBER
"Babylonian/Eta Piscium", 13 SE_SIDM_BABYL_ETPSC
"Babylonian/Aldebaran = 15 Tau", 14 SE_SIDM_ALDEBARAN_15TAU
"Hipparchos", 15 SE_SIDM_HIPPARCHOS
"Sassanian", 16 SE_SIDM_SASSANIAN
"Galact. Center = 0 Sag", 17 SE_SIDM_GALCENT_0SAG
"J2000", 18 SE_SIDM_J2000
"J1900", 19 SE_SIDM_J1900
"B1950", 20 SE_SIDM_B1950
"Suryasiddhanta", 21 SE_SIDM_SURYASIDDHANTA
"Suryasiddhanta, mean Sun", 22 SE_SIDM_SURYASIDDHANTA_MSUN
"Aryabhata", 23 SE_SIDM_ARYABHATA
"Aryabhata, mean Sun", 24 SE_SIDM_ARYABHATA_MSUN
"SS Revati", 25 SE_SIDM_SS_REVATI
"SS Citra", 26 SE_SIDM_SS_CITRA
"True Citra", 27 SE_SIDM_TRUE_CITRA
"True Revati", 28 SE_SIDM_TRUE_REVATI
"True Pushya (PVRN Rao) ", 29 SE_SIDM_TRUE_PUSHYA
"Galactic Center (Gil Brand) ", 30 SE_SIDM_GALCENT_RGBRAND
"Galactic Equator (IAU1958) ", 31 SE_SIDM_GALEQU_IAU1958
"Galactic Equator", 32 SE_SIDM_GALEQU_TRUE
"Galactic Equator mid-Mula", 33 SE_SIDM_GALEQU_MULA
"Skydram (Mardyks) ", 34 SE_SIDM_GALALIGN_MARDYKS
"True Mula (Chandra Hari) ", 35 SE_SIDM_TRUE_MULA
"Dhruva/Gal.Center/Mula (Wilhelm) ", 36 SE_SIDM_GALCENT_MULA_WILHELM
"Aryabhata 522", 37 SE_SIDM_ARYABHATA_522
"Babylonian/Britton", 38 SE_SIDM_BABYL_BRITTON
"\"Vedic\"/Sheoran 39 SE_SIDM_TRUE_SHEORAN
"Cochrane (Gal.Center = 0 Cap)" 40 SE_SIDM_GALCENT_COCHRANE
"Galactic Equator (Fiorenza)", 41 SE_SIDM_GALEQU_FIORENZA
"Vettius Valens", 42 SE_SIDM_VALENS_MOON
"Lahiri 1940", 43 SE_SIDM_LAHIRI_1940
"Lahiri VP285", 44 SE_SIDM_LAHIRI_VP285
"Krishnamurti-Senthilathiban", 45 SE_SIDM_KRISHNAMURTI_VP291
"Lahiri ICRC", 46 SE_SIDM_LAHIRI_ICRC

For information about the sidereal modes, please read the chapter on sidereal calculations in https://www.astro.com/swisseph/swisseph.htm (retrieved 25 october 2026).

Thus, in order to calculate planetary positions using the Lahiri ayanamsha, write:

swe_set_sid_mode(SE_SIDM_ LAHIRI, 0, 0);

iflag |= SEFLG_SIDEREAL;
for (i = 0; i < NPLANETS; i++) {
iflgret = swe_calc(tjd, ipl, iflag, xp, serr);
printf("%f\n", xp[0]);
}

Defining your own ayanamsha

To define your own ayanamsha, use SE_SIDM_USER (=255) and set the reference date (t0) and the initial value of the ayanamsha (ayan_t0), where

ayan_t0 = tropical_position_t0 -- sidereal_position_t0.

Thus, you can do it as follows:

swe_set_sid_mode(SE_SIDM_USER, 1720935.589444445, 0); /* ayanamsha 0 on 1 Sept. 1 BCE */

Or:

swe_set_sid_mode(SE_SIDM_USER, 2415020.5, 22.46); /* ayanamsha 22.46 on 1 Jan. 1900 */
iflag |= SEFLG_SIDEREAL;
for (i = 0; i < NPLANETS; i++) {
iflgret = swe_calc(tjd, ipl, iflag, xp, serr);
printf("%f\n", xp[0]);
}

If a user-defined ayanamsha is set using SE_SIDM_USER, then the t0 is usually considered to be TT (ET). However, t0 can be provided as UT if SE_SIDM_USER is combined with SE_SIDBIT_USER_UT.

/* with user-defined ayanamsha, t0 is UT */
#define SE_SIDBIT_USER_UT 1024

E.g.:

swe_set_sid_mode(SE_SIDM_USER + SE_SIDBIT_USER_UT, 1720935.589444445, 0);
iflag |= SEFLG_SIDEREAL;
for (i = 0; i < NPLANETS; i++) {
iflgret = swe_calc(tjd, ipl, iflag, xp, serr);
printf("%f\n", xp[0]);
}

Special uses of the sidereal functions

Without additional specifications, the traditional method for sidereal ephemerides is used, i.e. the ayanamsha measured on the ecliptic of t0 is subtracted from tropical positions referred to the ecliptic of date.

NOTE: this method will not provide accurate results if you want coordinates referred to the ecliptic of one of the following equinoxes:

#define SE_SIDM_J2000 18
#define SE_SIDM_J1900 19
#define SE_SIDM_B1950 20

Instead, you have to use a correct coordinate transformation as described below:

a) Sidereal positions relative to the ecliptic of t0

To understand this and the following options, please study them in the General Documentation of the Swiss Ephemeris (https://www.astro.com/swisseph/swisseph.htm, retrieved 25 october 2026).

If a transformation to the ecliptic of t0 is required, the following bit can be added (‘ored’) to the value of the variable sid_mode:

/* for projection onto ecliptic of t0 */
#define SE_SIDBIT_ECL_T0 256

E.g.:

swe_set_sid_mode(SE_SIDM_J2000 + SE_SIDBIT_ECL_T0, 0, 0);
iflag |= SEFLG_SIDEREAL;
for (i = 0; i < NPLANETS; i++) {
iflgret = swe_calc(tjd, ipl, iflag, xp, serr);
printf("%f\n", xp[0]);
}

This procedure is mandatory for the following sidereal modes, i.e. for transformation to the ecliptic of one of the standard equinoxes:

#define SE_SIDM_J2000 18
#define SE_SIDM_J1900 19
#define SE_SIDM_B1950 20

b) Sidereal positions relative to the ecliptic of date

If a transformation to the ecliptic of date is required the following bit can be added (‘ored’) to the value of the variable sid_mode:

/* for projection onto ecliptic of t0 */
#define SE_SIDBIT_ECL_DATE 2048

E.g.:

swe_set_sid_mode(SE_SIDM_J2000 + SE_SIDBIT_ECL_DATE, 0, 0);
iflag |= SEFLG_SIDEREAL;
for (i = 0; i < NPLANETS; i++) {
iflgret = swe_calc(tjd, ipl, iflag, xp, serr);
printf("%f\n", xp[0]);
}

c) calculating precession-corrected transits

The function swe_set_sid_mode() can also be used for calculating “precession-corrected transits”. There are two methods, of which you have to choose the one that is more appropriate for you:

  1. If you already have tropical positions of a natal chart, you can proceed as follows:
iflgret = swe_calc(tjd_et_natal, SE_ECL_NUT, 0, x, serr);
nut_long_natal = x[2];
swe_set_sid_mode(SE_SIDBIT_USER + SE_SIDBIT_ECL_T0, tjd_et, nut_long_natal);

where tjd_et_natal is the Julian day of the natal chart (Terrestrial Time).

After this, calculate the transits, using the function swe_calc() with the sidereal bit:

iflag |= SEFLG_SIDEREAL;
iflgret = swe_calc(tjd_et_transit, ipl_transit, iflag, xpt, serr);
  1. If you do not have tropical natal positions yet, if you do not need them and are just interested in transit times, you can have it simpler:
swe_set_sid_mode(SE_SIDBIT_USER + SE_SIDBIT_ECL_T0, tjd_et, 0);
iflag |= SEFLG_SIDEREAL;
iflgret = swe_calc(tjd_et_natal, ipl_natal, iflag, xp, serr);
iflgret = swe_calc(tjd_et_transit, ipl_transit, iflag, xpt, serr);

In this case, the natal positions will be tropical but without nutation. Note that you should not use them for other purposes.

d) solar system rotation plane.

For sidereal positions referred to the solar system rotation plane, use the flag:

/* for projection onto solar system rotation plane */
#define SE_SIDBIT_SSY_PLANE 512

NOTE: the parameters set by swe_set_sid_mode() survive calls of the function swe_close().

C 12.2 swe_get_ayanamsa_ex_ut(), swe_get_ayanamsa_ex(), swe_get_ayanamsa_ut() and swe_get_ayanamsa()

These functions compute the ayanamsha, i.e. the distance of the tropical vernal point from the sidereal zero point of the zodiac:

ayanamsha = pos_trop -- pos_sid
/* input variables:
* tjd_ut = Julian day number in UT
* (tjd_et = Julian day number in ET/TT)
* iflag = ephemeris flag (one of SEFLG_SWIEPH, SEFLG_JPLEPH)
* plus some other optional SEFLG_...
* output values
* daya = ayanamsha value (pointer to double)
* serr = error message or warning (pointer to string)
* The function returns either the ephemeris flag used or ERR (-1)
*/
int32 swe_get_ayanamsa_ex_ut(
      double tjd_ut,
      int32 iflag,
      double *daya,
      char *serr);
int32 swe_get_ayanamsa_ex(
      double tjd_et,
      int32 iflag,
      double *daya,
      char *serr);
double swe_get_ayanamsa_ut(
      double tjd_ut); /* input: Julian day number in UT */
double swe_get_ayanamsa(
      double tjd_et); /* input: Julian day number in ET/TT */

Note:

It is not recommended to use the ayanamsha functions for calculating sidereal planetary positions from tropical positions, since this could lead to complicated confusions. For sidereal planets, please use swe_calc_ut() or swe_calc() with the flag SEFLG_SIDEREAL. Use the ayanamsha function only if you need to know its value, e.g. if you want to indicate the value of the ayanamsha on a horoscope chart. In this case, it is recommended to indicate the ayanamsha including nutation. Ayanamsha without nutation may be useful in historical research, where the focus usually is on the mere precessional component of the ayanamsha.

With “true” ayanamshas such as “True Chitrapaksha” etc. the flags SEFLG_TRUEPOS, SEFLG_NOABERR and SEFLG_NOGDEFL can be used. However, users should not do that unless they really understand what they are doing. It means that the same flags are internally used for the calculation of the reference star (e.g. Citra/Spica). Slightly different ayanamsha values will result depending on these flags.

Before calling one of these functions, you have to set the sidereal mode with swe_set_sid_mode(), unless you want the default sidereal mode, which is the Fagan/Bradley ayanamsha.

The functions swe_get_ayanamsa_ex_ut() and swe_get_ayanamsa_ex() were introduced with Swiss Ephemeris version 2.02, the former expecting input time as UT, the latter as TT/ET.

These functions are better than the older functions swe_get_ayanamsa_ut() and swe_get_ayanamsa(). The function swe_get_ayanamsa_ex_ut() uses a Delta T consistent with the ephe_flag specified.

The function swe_get_ayanamsa_ex() does not depend on Delta T; however, with fixed-star-based ayanamshas like True Chitrapaksha or True Revati, the fixed star position also depends on the solar ephemeris (annual aberration of the star), which can be calculated with any of the three ephemeris flags.

The differences between the values provided by the new and old functions are very small and possibly only relevant for precision fanatics.

The function swe_get_ayanamsa_ut() was introduced with Swisseph Version 1.60 and expects Universal Time instead of Terrestrial Time. (cf. swe_calc_ut() and swe_calc())

C 13 The Ephemeris file related functions (moved to 2.)

Information concerning the functions swe_set_ephe_path(), swe_close(), swe_set_jpl_file(), and swe_version() has been moved to chapter 2.

C 14 The sign of geographical longitudes in SE functions

There is a disagreement between American and European programmers whether eastern or western geographical longitudes ought to be considered positive. Americans prefer to have West longitudes positive; Europeans prefer the older tradition that considers East longitudes as positive and West longitudes as negative.

The Astronomical Almanac still follows the European method. It gives the geographical coordinates of observatories in "East longitude".

The Swiss Ephemeris also follows the European style. All Swiss Ephemeris functions that use geographical coordinates consider positive geographical longitudes as East and negative ones as West.

E.g. 87w39 = -87.65° (Chicago IL/USA) and 8e33 = +8.55° (Zurich, Switzerland).

There is no such controversy about northern and southern geographical latitudes. North is always positive and south is negative.

C 14.1 Geographic versus geocentric latitude

There is some confusion among astrologers whether they should use geographic latitude (also called geodetic latitude) or geocentric latitude for house calculations, topocentric positions of planets, eclipses, etc.

Where latitude is an input parameter (or output parameter) in Swiss Ephemeris functions, it is always geographic latitude. This is the latitude found in Atlases and Google Earth.

If internally in a function a conversion to geocentric latitude is required (because the 3-d point on the oblate Earth is needed), this is done automatically.

For such conversions, the Swiss Ephemeris uses an ellipsoid for the form of the Earth. It does not use the irregular geoid. This can result in an altitude error of up to 500 meters, or error of the topocentric Moon of up to 0.3 arc seconds.

Astrologers who claim that for computing the ascendant or houses one needs geocentric latitude are mistaken. The flattening of the Earth does not play a part in house calculations. Geographic latitude should always be used with house calculations.

C 15 House cusp calculation

C 15.1 swe_house_name()

/* returns the name of the house method, maximum 40 chars */
char *swe_house_name(
      int hsys); /* house method, ascii code of one of the letters PKORCAEVXHTBG */

C 15.2 swe_houses()

/* house cusps, ascendant and MC */
int swe_houses(
      double tjd_ut, /* Julian day number, UT */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  int hsys, /* house method, ascii code of one of the letters documented below */
      double *cusps, /* array for 13 (or 37 for hsys G) doubles, explained further below */
      double *ascmc); /* array for 10 doubles, explained further below */

C 15.3 swe_houses_armc() and swe_houses_armc_ex2()

int swe_houses_armc(
      double armc, /* ARMC */
      double geolat, /* geographic latitude, in degrees */
      double eps, /* ecliptic obliquity, in degrees */
      int hsys, /* house method, ascii code of one of the letters documented below */
      double *cusps, /* array for 13 (or 37 for hsys G) doubles, explained further below */
      double *ascmc); /* array for 10 doubles, explained further below */
int swe_houses_armc_ex2(
      double armc, /* ARMC */
      double geolat, /* geographic latitude, in degrees */
      double eps, /* ecliptic obliquity, in degrees */
      int hsys, /* house method, ascii code of one of the letters documented below */
      double *cusps, /* array for 13 (or 37 for hsys G) doubles, explained further below */
      double *ascmc, /* array for 10 doubles, explained further below */
      double *cusp_speed,
      double *ascmc_speed,
      char *serr):

C 15.4 swe_houses_ex() and swe_houses_ex2()

/* extended function; to compute tropical or sidereal positions of house cusps */
int swe_houses_ex(
      double tjd_ut, /* Julian day number, UT */
      int32 iflag, /* 0 or SEFLG_SIDEREAL or SEFLG_RADIANS or SEFLG_NONUT */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  int hsys, /* house method, one-letter case sensitive code (list, see further below) */
      double *cusps, /* array for 13 (or 37 for hsys G) doubles, explained further below */
      double *ascmc); /* array for 10 doubles, explained further below */
/* extended function swe_houses_ex2():
* This function has the advantage that it also returns the speeds
* (daily motions) of the ascendant, midheaven and house cusps.
* In addition, it can return an error message or warning.
*/
int swe_houses_ex2(
      double tjd_ut, /* Julian day number, UT */
      int32 iflag, /* 0 or SEFLG_SIDEREAL or SEFLG_RADIANS or SEFLG_NONUT */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  int hsys, /* house method, one-letter case sensitive code (list, see further below) */
      double *cusps, /* array for 13 (or 37 for hsys G) doubles, explained further below */
      double *ascmc, /* array for 10 doubles, explained further below */
      double *cusp_speed, /* like cusps */
      double *ascmc_speed, /* like ascmc */
      char *serr);

Note that in all these functions tjd_ut must be Universal Time.

Also note that the array cusps must provide space for 13 doubles (declare as cusp[13]), otherwise you risk a program crash.

With house system ‘G’ (Gauquelin sector cusps), declare it as cusp[37]. With house system ‘G’, the cusp numbering is in clockwise direction.

Output and input parameters:

The first array element cusps[0] is always 0, the twelve houses follow in cusps[1] .. [12], the reason being that arrays in C begin with the index 0. The indices are therefore:

cusps[0] = 0

etc.

In the array ascmc, the function returns the following values:

ascmc[0] = Ascendant

The following defines can be used to find these values:

  #define SE_ASC 0
  #define SE_MC 1
  #define SE_ARMC 2
  #define SE_VERTEX 3
  #define SE_EQUASC 4 /* "equatorial ascendant" */
  #define SE_COASC1 5 /* "co-ascendant" (W. Koch) */
  #define SE_COASC2 6 /* "co-ascendant" (M. Munkasey) */
  #define SE_POLASC 7 /* "polar ascendant" (M. Munkasey) */
  #define SE_NASCMC 8

ascmc must be an array of 10 doubles. ascmc[8... 9] are 0 and may be used for additional points in future releases.

The codes hsys of the most important house methods are:

hsys = 'P' Placidus
'K' Koch
'O' Porphyrius
'R' Regiomontanus
'C' Campanus
'A' or 'E' Equal (cusp 1 is Ascendant)
'W' Whole sign

The complete list of house methods in alphabetical order is:

hsys = 'B' Alcabitus
'Y' APC houses
'X' Axial rotation system / Meridian system / Zariel
'H' Azimuthal or horizontal system
'C' Campanus
'F' Carter "Poli-Equatorial"
'A' or 'E' Equal (cusp 1 is Ascendant)
'D' Equal MC (cusp 10 is MC)
'N' Equal/1=Aries
'G' Gauquelin sector
Goelzer -> Krusinski
Horizontal system -> Azimuthal system
'I' Sunshine (Makransky, solution Treindl)
'i' Sunshine (Makransky, solution Makransky)
'K' Koch
'U' Krusinski-Pisa-Goelzer
Meridian system -> axial rotation
'M' Morinus
Neo-Porphyry -> Pullen SD
Pisa -> Krusinski
'P' Placidus
Poli-Equatorial -> Carter
'T' Polich/Page ("topocentric" system)
'O' Porphyrius
'L' Pullen SD (sinusoidal delta) -- ex Neo-Porphyry
'Q' Pullen SR (sinusoidal ratio)
'R' Regiomontanus
'S' Sripati
"Topocentric" system -> Polich/Page
'V' Vehlow equal (Asc. in middle of house 1)
'W' Whole sign
Zariel -> Axial rotation system

A letter that is not in this list gives Placidus houses: the functions return OK (0) without an error message, and swe_house_name() returns “Placidus”.

The extended house functions swe_houses_ex() and swe_houses_ex2() do exactly the same calculations as swe_houses(). The difference is that the extended functions have a parameter iflag, which can be set to SEFLG_SIDEREAL, if sidereal house positions are wanted. The house function returns data based on the true equator and equinox of date. If the flag SEFLG_NONUT is set, then the house cusps will be based on the mean equator and equinox of date. However, we recommend to use the true equator and equinox. The function swe_houses_ex2() also provides the speeds (“daily motions”) of the house cusps and additional points. They are the motions caused by the rotation of the Earth (of the ARMC), with the obliquity and, for the Sunshine houses (I, i), the declination of the Sun held fixed; the true daily motion of the Sunshine cusps differs from them by up to 0.7 degree per day at latitude 60 (0.2 at latitude 50).

Before calling swe_houses_ex() or swe_houses_ex() for sidereal house positions, the sidereal mode can be set by calling the function swe_set_sid_mode(). If this is not done, the default sidereal mode, i.e. the Fagan/Bradley ayanamsha, will be used.

The function swe_houses(), swe_houses_ex(), and swe_houses_ex2() are most comfortable, as long as houses are to be calculated for a given date and geographic position. Sometimes, however, one will need to compute houses from a given ARMC, e.g. with the composite horoscope, which has no date, only a composite ARMC which is computed from two natal ARMCs. In this case, the function swe_houses_armc() or swe_houses_armc_ex2() can be used. Since these functions require the ecliptic obliquity eps, you will probably want to calculate a composite value for this parameter also. To do this, one has to call swe_calc() with ipl = SE_ECL_NUT for both birth dates and then calculate the average of both eps.

“Sunshine” or Makransky houses require a special handling with the function swe_houses_armc() or swe_houses_armc_ex2(). The house system requires as a parameter the declination of the Sun. The user has to calculate the declination of the Sun and save it in the variable ascmc[9]. For house cusps of a composite chart, one has to calculate the composite declination of the Sun (= average of the declinations of the natal Suns).

There is no extended function for swe_houses_armc(). Therefore, if one wants to compute such exotic things as the house cusps of a sidereal composite chart, the procedure will be more complicated:

/* sidereal composite house computation; with true epsilon, but without nutation in longitude */
swe_calc_ut(tjd_ut1, SE_ECL_NUT, 0, x1, serr);
swe_calc_ut(tjd_ut2, SE_ECL_NUT, 0, x2, serr);
armc1 = swe_sidtime(tjd_ut1) * 15;
armc2 = swe_sidtime(tjd_ut2) * 15;
armc_comp = composite(armc1, armc2); /* this is a function created by the user */
eps_comp = (x1[0] + x2[0]) / 2;
// ayanamsha for the middle of the two birth days.
// alternatively, one could take the mean ayanamsha of the two birth dates.
// the difference will be microscopic.
tjd_comp = (tjd_ut1 + tjd_ut2) / 2;
retval = swe_get_ayanamsa_ex_ut(tjd_comp, iflag, &aya, serr);
swe_houses_armc(armc_comp, geolat, eps_comp, hsys, cusps, ascmc);
for (i = 1; i <= 12; i++)
cusp[i] = swe_degnorm(cusp[i] -- aya);
for (i = 0; i < 10; i++)
ascmc[i] = swe_degnorm(asc_mc[i] -- aya);

Or if you want to calculate sidereal progressions, do as follows:

Placidus and Koch house cusps as well as Gauquelin sectors cannot be computed beyond the polar circle. In such cases, swe_houses() switches to Porphyry houses (each quadrant is divided into three equal parts) and returns the error code ERR. In addition, Sunshine houses may fail, e.g. when required for a date which is outside the time range of our solar ephemeris. Here, also, Porphyry houses will be provided.

The house method codes are actually case sensitive. At the moment, there still are no lowercase house method codes, and if a lowercase code is given to the function, it will be converted to uppercase. However, in future releases, lower case codes may be used for new house methods. In such cases, lower and uppercase won’t be equivalent anymore.

The Vertex is the point on the ecliptic that is located in precise western direction. The opposition of the Vertex is the Antivertex, the ecliptic east point.

C 16 House position of a planet: swe_house_pos()

To compute the house position of a given body for a given ARMC, you may use:

double swe_house_pos(
      double armc, /* ARMC */
      double geolat, /* geographic latitude, in degrees */
      double eps, /* ecliptic obliquity, in degrees */
      int hsys, /* house method, one of the letters PKRCAV */
      double *xpin, /* array of 2 doubles: ecl. longitude and latitude of the planet */
      char *serr); /* return area for error or warning message */

The variables armc, geolat, eps, and xpin[0] and xpin[1] (ecliptic longitude and latitude of the planet) must be in degrees. serr must, as usually, point to a character array of 256 byte.

The function returns a value between 1.0 and 12.999999, indicating in which house a planet is and how far from its cusp it is.

With house system ‘G’ (Gauquelin sectors), a value between 1.0 and 36.9999999 is returned. Note that, while all other house systems number house cusps in counterclockwise direction, Gauquelin sectors are numbered in clockwise direction.

With Koch houses, the function sometimes returns 0, if the computation was not possible. This happens most often in polar regions, but it can happen at latitudes below 66°33’ as well, e.g. if a body has a high declination and falls within the circumpolar sky. With circumpolar fixed stars (or asteroids) a Koch house position may be impossible at any geographic location except on the equator.

The user must decide how to deal with this situation.

You can use the house positions returned by this function for house horoscopes (or “mundane” positions). For this, you have to transform it into a value between 0 and 360 degrees. Subtract 1 from the house number and multiply it with 30, or mund_pos = (hpos – 1) * 30.

You will realize that house positions computed like this, e.g. for the Koch houses, will not agree exactly with the ones that you get applying the Huber "hand calculation" method. If you want a better agreement, set the ecliptic latitude xpin[1] = 0. Remaining differences result from the fact that Huber’s hand calculation is a simplification, whereas our computation is geometrically accurate.

Currently, geometrically correct house positions are provided for the following house methods:

P Placidus, K Koch, C Campanus, R Regiomontanus, U Krusinski,
A/E Equal, V Vehlow, W Whole Signs, D Equal/MC, N Equal/Zodiac,
O Porphyry, B Alcabitius, X Meridian, F Carter, M Morinus,
T Polich/Page, H Horizon, G Gauquelin.

A simplified house position (distance_from_cusp / house_size) is currently provided for the following house methods:

Y APC houses, L Pullen SD, Q Pullen SR, I Sunshine, S Sripati.

This function requires TROPICAL positions in xpin. SIDEREAL house positions are identical to tropical ones in the following cases:

C 16.1 Calculating the Gauquelin sector position of a planet with swe_house_pos() or swe_gauquelin_sector()

For general information on Gauquelin sectors, read the sections “Gauquelin sectors” and “Gauquelin sector position of a planet” in the documentation file swisseph3.pdf.

There are two functions that can be used to calculate Gauquelin sectors:

int32 swe_gauquelin_sector(
      double tjd_ut, /* input time (UT) */
      int32 ipl, /* planet number, if planet, or moon
      * ipl is ignored if the following parameter (starname) is set */
  char *starname, /* star name, if star */
      int32 iflag, /* flag for ephemeris and SEFLG_TOPOCTR */
      int32 imeth, /* method: 0 = with lat., 1 = without lat.,
      * 2 = from rise/set, 3 = from rise/set with refraction */
  double *geopos, /* array of three doubles containing
      * geograph. long., lat., height of observer */
  double atpress, /* atmospheric pressure, only useful with imeth = 3;
      * if 0, default = 1013.25 mbar is used*/
  double attemp, /* atmospheric temperature in degrees Celsius, only useful with imeth = 3 */
      double *dgsect, /* return address for Gauquelin sector position */
      char *serr); /* return address for error message */

This function returns OK or ERR (-1). It returns an error in a number of cases, for example circumpolar bodies with imeth=2. As with other SE functions, if there is an error, an error message is written to serr. dgsect is used to obtain the Gauquelin sector position as a value between 1.0 and 36.9999999. Gauquelin sectors are numbered in clockwise direction.

There are six methods of computing the Gauquelin sector position of a planet:

  1. Sector positions from ecliptical longitude AND latitude:

There are two ways of doing this:

  1. Sector positions computed from ecliptical longitudes without ecliptical latitudes:

There are two ways of doing this:

  1. Sector positions of a planet from rising and setting times of planets.

The rising and setting of the disk center is used:

  1. Sector positions of a planet from rising and setting times of planets, taking into account atmospheric refraction.

The rising and setting of the disk center is used:

  1. Sector positions of a planet from rising and setting times of planets.

The rising and setting of the disk edge is used:

  1. Sector positions of a planet from rising and setting times of planets, taking into account atmospheric refraction.

The rising and setting of the disk edge is used:

C 17 Sidereal time with swe_sidtime() and swe_sidtime0()

The sidereal time is computed inside the houses() function and returned via the variable armc. It is measured in degrees. To get sidereal time in hours, divide armc by 15.

If sidereal time is required separately from house calculation, two functions are available. The second version requires obliquity and nutation to be given in the function call; the first function computes them internally. Both return sidereal time at the Greenwich Meridian, measured in hours.

double swe_sidtime(
      double tjd_ut); /* Julian day number, UT */

double swe_sidtime0(
      double tjd_ut, /* Julian day number, UT */
      double eps, /* obliquity of ecliptic, in degrees */
      double nut); /* nutation in longitude, in degrees */

C 18 Summary of SWISSEPH functions

C 18.1 Calculation of planets and stars

18.1.1 Planets, moon, asteroids, lunar nodes, apogees, fictitious bodies

// planetary positions from UT
int32 swe_calc_ut(
      double tjd_ut, /* Julian day number, Universal Time */
      int32 ipl, /* planet number */
      int32 iflag, /* flag bits */
      double *xx, /* target address for 6 position values: longitude, latitude, distance, * long. speed, lat. speed, dist. speed */
      char *serr); /* 256 bytes for error string */
// planetary positions from TT
int32 swe_calc(
      double tjd_et, /* Julian day number, Ephemeris Time */
      int32 ipl, /* planet number */
      int32 iflag, /* flag bits */
      double *xx, /* target address for 6 position values: longitude, latitude, distance, *long. speed, lat. speed, dist. speed */
      char *serr); /* 256 bytes for error string */
// planetary positions, planetocentric, from TT
int32 swe_calc_pctr(
      double tjd, // input julian day number in TT
      int32 ipl, // target object
      int32 iplctr, // center object
      int32 iflag, /* flag bits, as with swe_calc() */
      double *xxret,
      char *serr);
// positions of planetary nodes and aspides from UT
int32 swe_nod_aps_ut(
      double tjd_ut, /* Julian day number, Universal Time */
      int32 ipl, /* planet number */
      int32 iflag, /* flag bits */
      int32 method, /* method SE_NODBIT_... (see docu above) */
      double *xnasc, /* target address for 6 position values for ascending node (cf. swe_calc()*/
      double *xndsc, /* target address for 6 position values for descending node (cf. swe_calc()*/
      double *xperi, /* target address for 6 position values for perihelion (cf. swe_calc()*/
      double *xaphe, /* target address for 6 position values for aphelion (cf. swe_calc()*/
      char *serr);
// positions of planetary nodes and aspides from TT
int32 swe_nod_aps(
      double tjd_et, /* Julian day number, Ephemeris Time */
      int32 ipl, /* planet number */
      int32 iflag, /* flag bits */
      int32 method, /* method SE_NODBIT_... (see docu above) */
      double *xnasc, /* target address for 6 position values for ascending node (cf. swe_calc()*/
      double *xndsc, /* target address for 6 position values for descending node (cf. swe_calc()*/
      double *xperi, /* target address for 6 position values for perihelion (cf. swe_calc()*/
      double *xaphe, /* target address for 6 position values for aphelion (cf. swe_calc()*/
      char *serr);

18.1.2 Fixed stars

// positions of fixed stars from UT, faster function if many stars are calculated
int32 swe_fixstar2_ut(
      char *star, /* star name, returned star name 40 bytes */
      double tjd_ut, /* Julian day number, Universal Time */
      int32 iflag, /* flag bits */
      double *xx, /* target address for 6 position values: longitude, latitude, distance, *long. speed, lat. speed, dist. speed */
      char *serr); /* 256 bytes for error string */
// positions of fixed stars from TT, faster function if many stars are calculated
int32 swe_fixstar2(
      char *star, /* star name, returned star name 40 bytes */
      double tjd_et, /* Julian day number, Ephemeris Time */
      int32 iflag, /* flag bits */
      double *xx, /* target address for 6 position values: longitude, latitude, distance, *long. speed, lat. speed, dist. speed */
      char *serr); /* 256 bytes for error string */
// positions of fixed stars from UT, faster function if single stars are calculated
int32 swe_fixstar_ut(
      char *star, /* star name, returned star name 40 bytes */
      double tjd_ut, /* Julian day number, Universal Time */
      int32 iflag, /* flag bits */
      double *xx, /* target address for 6 position values: longitude, latitude, distance, *long. speed, lat. speed, dist. speed */
      char *serr); /* 256 bytes for error string */
// positions of fixed stars from TT, faster function if single stars are calculated
int32 swe_fixstar(
      char *star, /* star name, returned star name 40 bytes */
      double tjd_et, /* Julian day number, Ephemeris Time */
      int32 iflag, /* flag bits */
      double *xx, /* target address for 6 position values: longitude, latitude, distance, *long. speed, lat. speed, dist. speed */
      char *serr); /* 256 bytes for error string */
// get the magnitude of a fixed star
int32 swe_fixstar2_mag(
      char *star,
      double* mag,
      char* serr);
int32 swe_fixstar_mag(
      char *star,
      double* mag,
      char* serr);

18.1.3 Set the geographic location for topocentric planet computation

void swe_set_topo(
      double geolon, /* geographic longitude */
      double geolat, /* geographic latitude
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double altitude); /* altitude above sea */

18.1.4 Set the sidereal mode and get ayanamsha values

void swe_set_sid_mode(
      int32 sid_mode,
      double t0, /* reference epoch */
      double ayan_t0); /* initial ayanamsha at t0 */
/* The function calculates ayanamsha for a given date in UT.
* The return value is either the ephemeris flag used or ERR (-1) */
int32 swe_get_ayanamsa_ex_ut(
      double tjd_ut, /* Julian day number in UT */
      int32 ephe_flag, /* ephemeris flag, one of SEFLG_SWIEPH, SEFLG_JPLEPH */
      double *daya, /* output: ayanamsha value (pointer to double) */
      char *serr); /* output: error message or warning (pointer to string) */
/* The function calculates ayanamsha for a given date in ET/TT.
* The return value is either the ephemeris flag used or ERR (-1) */
int32 swe_get_ayanamsa_ex(
      double tjd_ut, /* Julian day number in ET/TT */
      int32 ephe_flag, /* ephemeris flag, one of SEFLG_SWIEPH, SEFLG_JPLEPH */
      double *daya, /* output: ayanamsha value (pointer to double) */
      char *serr); /* output: error message or warning (pointer to string) */
/* to get the ayanamsha for a date in UT, old function, better use swe_get_ayanamsa_ex_ut() */
double swe_get_ayanamsa_ut(double tjd_ut);
/* to get the ayanamsha for a date in ET/TT, old function, better use swe_get_ayanamsa_ex() */
double swe_get_ayanamsa(double tjd_et);
// find the name of an ayanamsha
const char *swe_get_ayanamsa_name(int32 isidmode)

C 18.2 Eclipses and planetary phenomena

18.2.1 Find the next eclipse for a given geographic position

int32 swe_sol_eclipse_when_loc(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* 3 doubles for geo. lon, lat, height */
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *tret, /* return array, 10 doubles, see below */
      double *attr, /* return array, 20 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

18.2.2 Find the next eclipse globally

int32 swe_sol_eclipse_when_glob(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      int32 ifltype, /* eclipse type wanted: SE_ECL_TOTAL etc. */
      double *tret, /* return array, 10 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

18.2.3 Compute the attributes of a solar eclipse for a given tjd, geographic long., latit. and height

int32 swe_sol_eclipse_how(
      double tjd_ut, /* time, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* geogr. longitude, latitude, height */
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

18.2.4 Find out the geographic position where a central eclipse is central or a non-central one maximal

int32 swe_sol_eclipse_where(
      double tjd_ut, /* time, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* return array, 2 doubles, geo. long. and lat. */
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

or

int32 swe_lun_occult_where(
      double tjd_ut, /* time, Jul. day UT */
      int32 ipl, /* planet number */
      char* starname, /* star name, must be NULL or "" if not a star */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* return array, 2 doubles, geo. long. and lat.
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

18.2.5 Find the next occultation of a body by the moon for a given geographic position

(can also be used for solar eclipses)

int32 swe_lun_occult_when_loc(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ipl, /* planet number */
      char* starname, /* star name, must be NULL or "" if not a star */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* 3 doubles for geo. lon, lat, height
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *tret, /* return array, 10 doubles, see below */
      double *attr, /* return array, 20 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

18.2.6 Find the next occultation globally

(can also be used for solar eclipses)

int32 swe_lun_occult_when_glob(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ipl, /* planet number */
      char* starname, /* star name, must be NULL or "" if not a star */
      int32 ifl, /* ephemeris flag */
      int32 ifltype, /* eclipse type wanted */
      double *tret, /* return array, 10 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

18.2.7 Find the next lunar eclipse observable from a geographic location

int32 swe_lun_eclipse_when_loc(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* 3 doubles for geo. lon, lat, height
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *tret, /* return array, 10 doubles, see below */
      double *attr, /* return array, 20 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

18.2.8 Find the next lunar eclipse, global function

int32 swe_lun_eclipse_when(
      double tjd_start, /* start date for search, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      int32 ifltype, /* eclipse type wanted: SE_ECL_TOTAL etc. */
      double *tret, /* return array, 10 doubles, see below */
      AS_BOOL backward, /* TRUE, if backward search */
      char *serr); /* return error string */

18.2.9 Compute the attributes of a lunar eclipse at a given time

int32 swe_lun_eclipse_how(
      double tjd_ut, /* time, Jul. day UT */
      int32 ifl, /* ephemeris flag */
      double *geopos, /* input array, geopos, geolon, geoheight */
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

18.2.10 Compute risings, settings and meridian transits of a body

int32 swe_rise_trans(
      double tjd_ut, /* search after this time (UT) */
      int32 ipl, /* planet number, if planet or moon */
      char *starname, /* star name, if star */
      int32 epheflag, /* ephemeris flag */
      int32 rsmi, /* integer specifying that rise, set, or one of the two meridian transits is wanted. see definition below */
      double *geopos, /* array of three doubles containing geograph. long., lat., height of observer */
      double atpress, /* atmospheric pressure in mbar/hPa */
      double attemp, /* atmospheric temperature in deg. C */
      double *tret, /* return address (double) for rise time etc. */
      char *serr); /* return address for error message */
int32 swe_rise_trans_true_hor(
      double tjd_ut, /* search after this time (UT) */
      int32 ipl, /* planet number, if planet or moon */
      char *starname, /* star name, if star */
      int32 epheflag, /* ephemeris flag */
      int32 rsmi, /* integer specifying that rise, set, or one of the two meridian transits is wanted. see definition below */
      double *geopos, /* array of three doubles containing
      * geograph. long., lat., height of observer */
  double atpress, /* atmospheric pressure in mbar/hPa */
      double attemp, /* atmospheric temperature in deg. C */
      double horhgt, /* height of local horizon in deg at the point where the body rises or sets*/
      double *tret, /* return address (double) for rise time etc. */
      char *serr); /* return address for error message */
int32 swe_heliacal_ut(
      double tjdstart, /* Julian day number of start date for the search of the heliacal event */
      double *dgeo /* geographic position (details below) */
  double *datm, /* atmospheric conditions (details below) */
      double *dobs, /* observer description (details below) */
      char *objectname, /* name string of fixed star or planet */
      int32 event_type, /* event type (details below) */
      int32 helflag, /* calculation flag, bitmap (details below) */
      double *dret, /* result: array of at least 50 doubles, of which 3 are used at the moment */
      char * serr); /* error string */
// details of heliacal risings/settings
double swe_heliacal_pheno_ut(
      double tjd_ut, /* Julian day number */
      double *dgeo, /* geographic position (details under swe_heliacal_ut() */
      double *datm, /* atmospheric conditions (details under swe_heliacal_ut()) */
      double *dobs, /* observer description (details under swe_heliacal_ut()) */
      char *objectname, /* name string of fixed star or planet */
      int32 event_type, /* event type (details under function swe_heliacal_ut()) */
      int32 helflag, /* calculation flag, bitmap (details under swe_heliacal_ut()) */
      double *darr, /* return array, declare array of 50 doubles */
      char *serr); /* error string */
// magnitude limit for visibility
double swe_vis_limit_mag(
      double tjdut, /* Julian day number */
      double *dgeo /* geographic position (details under swe_heliacal_ut() */
  double *datm, /* atmospheric conditions (details under swe_heliacal_ut()) */
      double *dobs, /* observer description (details under swe_heliacal_ut()) */
      char *objectname, /* name string of fixed star or planet */
      int32 helflag, /* calculation flag, bitmap (details under swe_heliacal_ut()) */
      double *dret, /* result: magnitude required of the object to be visible */
      char * serr); /* error string */
double swe_heliacal_pheno_ut(
      double tjd_ut, /* Julian day number */
      double *dgeo, /* geographic position (details under swe_heliacal_ut() */
      double *datm, /* atmospheric conditions (details under swe_heliacal_ut()) */
      double *dobs, /* observer description (details under swe_heliacal_ut()) */
      char *objectname, /* name string of fixed star or planet */
      int32 event_type, /* event type (details under function swe_heliacal_ut()) */
      int32 helflag, /* calculation flag, bitmap (details under swe_heliacal_ut()) */
      double *darr, /* return array, declare array of 50 doubles */
      char *serr); /* error string */

18.2.12 Compute planetary phenomena

int32 swe_pheno_ut(
      double tjd_ut, /* time Jul. Day UT */
      int32 ipl, /* planet number */
      int32 iflag, /* ephemeris flag */
      double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */
int32 swe_pheno(
      double tjd_et, /* time Jul. Day ET */
      int32 ipl, /* planet number */
      int32 iflag, /* ephemeris flag */
      double *attr, /* return array, 20 doubles, see below */
      char *serr); /* return error string */

18.2.13 Compute azimuth/altitude from ecliptic or equator

void swe_azalt(
      double tjd_ut, /* UT */
      int32 calc_flag, /* SE_ECL2HOR or SE_EQU2HOR */
      double *geopos, /* array of 3 doubles: geogr. long., lat., height */
      double atpress, /* atmospheric pressure in mbar (hPa) */
      double attemp, /* atmospheric temperature in degrees Celsius */
      double *xin, /* array of 3 doubles: position of body in either ecliptical or equatorial coordinates, depending on calc_flag */
      double *xaz); /* return array of 3 doubles, containing azimuth, true altitude, apparent altitude */

18.2.14 Compute ecliptic or equatorial positions from azimuth/altitude

void swe_azalt_rev(
      double tjd_ut,
      int32 calc_flag, /* either SE_HOR2ECL or SE_HOR2EQU */
      double *geopos, /* array of 3 doubles for geograph. pos. of observer */
      double *xin, /* array of 2 doubles for azimuth and true altitude of planet */
      double *xout); /* return array of 2 doubles for either ecliptic or equatorial coordinates, depending on calc_flag */

18.2.15 Compute refracted altitude from true altitude or reverse

double swe_refrac(
      double inalt,
      double atpress, /* atmospheric pressure in mbar (hPa) */
      double attemp, /* atmospheric temperature in degrees Celsius */
      int32 calc_flag); /* either SE_TRUE_TO_APP or SE_APP_TO_TRUE */
double swe_refrac_extended(
      double inalt, /* altitude of object above geometric horizon in degrees, where geometric horizon = plane perpendicular to gravity */
      double geoalt, /* altitude of observer above sea level in meters */
      double atpress, /* atmospheric pressure in mbar (hPa) */
      double attemp, /* atmospheric temperature in degrees Celsius */
      double lapse_rate, /* (dattemp/dgeoalt) = [°K/m] */
      int32 calc_flag, /* either SE_TRUE_TO_APP or SE_APP_TO_TRUE */
      double *dret); /* array of 4 doubles; declare 20 ! */
  * - dret[0] true altitude, if possible; otherwise input value
  * - dret[1] apparent altitude, if possible; otherwise input value
  * - dret[2] refraction
  * - dret[3] dip of the horizon
  /* either SE_TRUE_TO_APP or SE_APP_TO_TRUE */

18.2.16 Compute Kepler orbital elements of a planet or asteroid

int32 swe_get_orbital_elements(
      double tjd_et, // input date in TT (Julian day number)
      int32 ipl, // planet number
      int32 iflag, // flag bits, see detailed docu
      double *dret, // return values, see detailed docu
      char *serr);

18.2.17 Compute maximum/minimum/current distance of a planet or asteroid

int32 swe_orbit_max_min_true_distance(
      double tjd_et, // input date in TT (Julian day number)
      int32 ipl, // planet number
      int32 iflag, // flag bits, see detailed docu
      double *dmax, // return value: maximum distance based on osculating elements
      double *dmin, // return value: minimum distance based on osculating elements
      double *dtrue, // return value: current distance
      char *serr);

C 18.3 Date and time conversion

18.3.1 Delta T from Julian day number

/* Ephemeris time (ET) = Universal time (UT) + swe_deltat_ex(UT) */
double swe_deltat_ex(
      double tjd, /* Julian day number in ET/TT */
      int32 ephe_flag, /* ephemeris flag (one of SEFLG_SWIEPH, SEFLG_JPLEPH) */
      char *serr); /* error message or warning */
/* older function: */
/* Ephemeris time (ET) = Universal time (UT) + swe_deltat(UT) */
double swe_deltat(
      double tjd);
/* Return value: OK or ERR */
int swe_date_conversion(
      int y, int m, int d, /* year, month, day */
      double hour, /* hours (decimal, with fraction) */
      char c, /* calendar 'g'[regorian] | 'j'[ulian] */
      double *tjd); /* target address for Julian day */

18.3.3 Julian day number from year, month, day, hour

double swe_julday(
      int year,
      int month,
      int day,
      double hour,
      int gregflag); /* Gregorian calendar: 1, Julian calendar: 0 */

18.3.4 Year, month, day, hour from Julian day number

void swe_revjul(
      double tjd, /* Julian day number */
      int gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      int *year, /* target addresses for year, etc. */
      int *month,
      int *day,
      double *hour);

18.3.5 Local civil time to UTC and UTC to local civil time

/* transform local civil time to UTC or UTC to local civil time
* input:
* iyear ... dsec date and time
* d_timezone timezone offset
* output:
* iyear_out ... dsec_out
*
* For time zones east of Greenwich, d_timezone is positive.
* For time zones west of Greenwich, d_timezone is negative.
*
* For conversion from local civil time to utc, use +d_timezone.
* For conversion from utc to local civil time, use -d_timezone.
*/
void swe_utc_time_zone(
      int32 iyear, int32 imonth, int32 iday,
      int32 ihour, int32 imin, double dsec,
      double d_timezone,
      int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
      int32 *ihour_out, int32 *imin_out, double *dsec_out);

18.3.6 UTC to jd (TT and UT1)

/* input: date and time (UTC), calendar flag.
* output: an array of doubles with Julian Day number in ET (TT) and UT (UT1)
* an error message (on error)
* The function returns OK or ERR.
*/
int32 swe_utc_to_jd(
      int32 iyear, int32 imonth, int32 iday,
      int32 ihour, int32 imin, double dsec, /* NOTE: second is a decimal */
      int32 gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      double *dret, /* return array, two doubles:
      * dret[0] = Julian day in ET (TT)
  * dret[1] = Julian day in UT (UT1) */
  char *serr); /* error string */

18.3.7 TT (ET) to UTC

/* input: Julian day number in ET (TT), calendar flag
* output: year, month, day, hour, min, sec in UTC */
void swe_jdet_to_utc(
      double tjd_et, /* Julian day number in ET (TT) */
      int32 gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      int32 *iyear, int32 *imonth, int32 *iday,
      int32 *ihour, int32 *imin, double *dsec); /* NOTE: second is a decimal */

18.3.8 UT1 to UTC

/* input: Julian day number in UT (UT1), calendar flag
* output: year, month, day, hour, min, sec in UTC */
void swe_jdut1_to_utc(
      double tjd_ut, /* Julian day number in UT */
      int32 gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
      int32 *iyear, int32 *imonth, int32 *iday,
      int32 *ihour, int32 *imin, double *dsec); /* NOTE: second is a decimal */

18.3.9 Get tidal acceleration used in swe_deltat()

double swe_get_tid_acc(void);

18.3.10 Set tidal acceleration to be used in swe_deltat()

void swe_set_tid_acc(double t_acc);

18.3.11 Equation of time

/* function returns the difference between local apparent and local mean time.
e = LAT -- LMT. tjd_et is ephemeris time */
int swe_time_equ(
      double tjd_et,
      double *e,
      char *serr);
/* converts Local Mean Time (LMT) to Local Apparent Time (LAT) */
/* tjd_lmt and tjd_lat are a Julian day number
* geolon is geographic longitude, where eastern
* longitudes are positive, western ones negative */
int32 swe_lmt_to_lat(
      double tjd_lmt,
      double geolon,
      double *tjd_lat,
      char *serr);
/* converts Local Apparent Time (LAT) to Local Mean Time (LMT) */
int32 swe_lat_to_lmt(
      double tjd_lat,
      double geolon,
      double *tjd_lmt,
      char *serr);

C 18.4 Initialization, setup, and closing functions

18.4.1 Set directory path of ephemeris files

void swe_set_ephe_path(char *path);
/* set name of JPL ephemeris file */
void swe_set_jpl_file(char *fname);
/* close Swiss Ephemeris */
void swe_close(void);
/* find out version number of your Swiss Ephemeris version */
char *swe_version(char *svers);
/* svers is a string variable with sufficient space to contain the version number (255 char) */
/* find out the library path of the DLL or executable */
char *swe_get_library_path(char *spath);
/* spath is a string variable with sufficient space to contain the library path (255 char) */
/* find out start and end date of *se1 ephemeris file after a call of swe_calc() */
const char *CALL_CONV swe_get_current_file_data(
      int ifno,
      double *tfstart,
      double *tfend,
      int *denum);

C 18.5 House calculation

18.5.1 Sidereal time

double swe_sidtime(double tjd_ut); /* Julian day number, UT */
double swe_sidtime0(
      double tjd_ut, /* Julian day number, UT */
      double eps, /* obliquity of ecliptic, in degrees */
      double nut); /* nutation, in degrees */

18.5.2 Name of a house method

char * swe_house_name(
      int hsys); /* house method, ascii code of one of the letters PKORCAEVXHTBG */

18.5.3 House cusps, ascendant and MC

int swe_houses(
      double tjd_ut, /* Julian day number, UT */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees,
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  int hsys, /* house method, one of the letters PKRCAV */
      double* cusps, /* array for 13 doubles */
      double* ascmc); /* array for 10 doubles */

18.5.4 Extended house function; to compute tropical or sidereal positions

int swe_houses_ex(
      double tjd_ut, /* Julian day number, UT */
      int32 iflag, /* 0 or SEFLG_SIDEREAL or SEFLG_RADIANS */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  int hsys, /* house method, one of the letters PKRCAV */
      double* cusps, /* array for 13 doubles */
      double* ascmc); /* array for 10 doubles */
int swe_houses_ex2(
      double tjd_ut, /* Julian day number, UT */
      int32 iflag, /* 0 or SEFLG_SIDEREAL or SEFLG_RADIANS or SEFLG_NONUT */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  int hsys, /* house method, one-letter case sensitive code (list, see further below) */
      double *cusps, /* array for 13 (or 37 for system G) doubles, explained further below */
      double *ascmc, /* array for 10 doubles, explained further below */
      double *cusp_speed, /* like cusps */
      double *ascmc_speed, /* like ascmc */
      char *serr);
int swe_houses_armc(
      double armc, /* ARMC */
      double geolat, /* geographic latitude, in degrees */
      double eps, /* ecliptic obliquity, in degrees */
      int hsys, /* house method, one of the letters PKRCAV */
      double *cusps, /* array for 13 doubles */
      double *ascmc); /* array for 10 doubles */
int swe_houses_armc_ex2(
      double armc, /* ARMC */
      double geolat, /* geographic latitude, in degrees */
      double eps, /* ecliptic obliquity, in degrees */
      int hsys, /* house method, ascii code of one of the letters documented below */
      double *cusps, /* array for 13 (or 37 for system G) doubles, explained further below */
      double *ascmc, /* array for 10 doubles, explained further below */
      double *cusp_speed,
      double *ascmc_speed,
      char *serr):

18.5.5 Get the house position of a celestial point

double swe_house_pos(
      double armc, /* ARMC */
      double geolat, /* geographic latitude, in degrees
      * eastern longitude is positive,
      * western longitude is negative,
      * northern latitude is positive,
      * southern latitude is negative */
  double eps, /* ecliptic obliquity, in degrees */
      int hsys, /* house method, one of the letters PKRCAV */
      double *xpin, /* array of 2 doubles: ecl. longitude and latitude of the planet */
      char *serr); /* return area for error or warning message */

18.5.6 Get the Gauquelin sector position for a body

double swe_gauquelin_sector(
      double tjd_ut, /* search after this time (UT) */
      int32 ipl, /* planet number, if planet, or moon */
      char *starname, /* star name, if star */
      int32 iflag, /* flag for ephemeris and SEFLG_TOPOCTR */
      int32 imeth, /* method: 0 = with lat., 1 = without lat.,
      /* 2 = from rise/set, 3 = from rise/set with refraction */
  double *geopos, /* array of three doubles containing
      * geograph. long., lat., height of observer */
  double atpress, /* atmospheric pressure, only useful with imeth = 3;
      * if 0, default = 1013.25 mbar is used*/
  double attemp, /* atmospheric temperature in degrees Celsius, only useful with imeth = 3 */
      double *dgsect, /* return address for Gauquelin sector position */
      char *serr); /* return address for error message */

C 18.6 Auxiliary functions

18.6.1 swe_cotrans(): coordinate transformation, from ecliptic to equator or vice-versa

/* equator -> ecliptic : eps must be positive
* ecliptic -> equator : eps must be negative
* eps, longitude and latitude are in positive degrees! */
void swe_cotrans(
      double *xpo, /* 3 doubles: long., lat., dist. to be converted; distance remains unchanged, can be set to 1.00 */
      double *xpn, /* 3 doubles: long., lat., dist. Result of the conversion */
      double eps); /* obliquity of ecliptic, in degrees. */

18.6.2 swe_cotrans_sp(): coordinate transformation of position and speed, from ecliptic to equator or vice-versa

/ * equator -> ecliptic : eps must be positive
* ecliptic -> equator : eps must be negative
* eps, long., lat., and speeds in long. and lat. are in degrees! */
void swe_cotrans_sp(
      double *xpo, /* 6 doubles, input: long., lat., dist. and speeds in long., lat and dist. */
      double *xpn, /* 6 doubles, position and speed in new coordinate system */
      double eps); /* obliquity of ecliptic, in degrees. */

18.6.3 swe_get_planet_name(): get the name of a planet

char* swe_get_planet_name(
      int ipl, /* planet number */
      char* plan_name); /* address for planet name, at least 20 char */

18.6.4 swe_degnorm(): normalize degrees to the range 0 ... 360

double swe_degnorm(double x);

18.6.5 swe_radnorm(): normalize radians to the range 0 ... 2 PI

double swe_radnorm(double x);

18.6.6 swe_deg_midp(), swe_rad_midp(): midpoint of two angles

The midpoint of the shorter arc between x0 and x1, in degrees normalized to 0 ... 360, or in radians normalized to 0 ... 2 PI. For opposite points the result is x0 - 90 degrees.

double swe_deg_midp(double x1, double x0);
double swe_rad_midp(double x1, double x0);

18.6.7 swe_difrad2n(): distance in radians

p1 - p2 in radians, normalized to -PI ... PI (-PI included, PI excluded); the radian version of swe_difdeg2n().

double swe_difrad2n(double p1, double p2);

18.6.8 swe_split_deg(): split degrees to sign/nakshatra, degrees, minutes, seconds of arc

This function takes a decimal degree number as input and provides sign or nakshatra, degree, minutes, seconds and fraction of second. It can also round to seconds, minutes, degrees. For more details see the specifications below.

double swe_split_deg(
      double ddeg,
      int32 roundflag,
      int32 *ideg,
      int32 *imin,
      int32 *isec,
      double *dsecfr,
      int32 *isgn);
/* splitting decimal degrees into (zod. sign,) deg, min, sec. *
* input:
* ddeg decimal degrees, ecliptic longitude
* roundflag by default there is no rounding. if rounding is
* required, the following bits can be set:
# define SE_SPLIT_DEG_ROUND_SEC 1
# define SE_SPLIT_DEG_ROUND_MIN 2
# define SE_SPLIT_DEG_ROUND_DEG 4
# define SE_SPLIT_DEG_ZODIACAL 8 * split into zodiac signs
# define SE_SPLIT_DEG_NAKSHATRA 1024 * split into nakshatras *
# define SE_SPLIT_DEG_KEEP_SIGN 16 * don't round to next zodiac sign/nakshatra,
* e.g. 29.9999998 will be rounded
* to 29°59'59" (or 29°59' or 29°)
* or next nakshatra:
* e.g. 13.3333332 will be rounded
* to 13°19'59" (or 13°19' or 13°)
# define SE_SPLIT_DEG_KEEP_DEG 32 * don't round to next degree
* e.g. 10.9999999 will be rounded
* to 10d59'59" (or 10d59' or 10d)
* output:
* ideg degrees,
* imin minutes,
* isec seconds,
* dsecfr fraction of seconds
* isgn zodiac sign number;
* or +/- sign

C 18.7 Other functions that may be useful

Functions for calculations in centiseconds are no longer used in the Swiss Ephemeris, but still available. A centisecond is 100th of an arc second. The C type CSEC or centisec is a 32-bit integer.

18.7.1 Normalize argument into interval [0..DEG360]

centisec swe_csnorm(centisec p);

18.7.2 Distance in centisecs p1 - p2 normalized to [0..360]

centisec swe_difcsn(centisec p1, centisec p2);

18.7.3 Distance in degrees

double swe_difdegn(double p1, double p2);

18.7.4 Distance in centisecs p1 - p2 normalized to [-180..180]

centisec swe_difcs2n(centisec p1, centisec p2);

18.7.5 Distance in degrees

double swe_difdeg2n(double p1, double p2);

18.7.6 Round second, but at 29.5959 always down

centisec swe_csroundsec(centisec x);

18.7.7 Double to long with rounding, no overflow check

long swe_d2l(double x);

18.7.8 Day of week

/* Monday = 0, ... Sunday = 6, former function name: day_of_week() */
int swe_day_of_week(double jd);

18.7.9 Centiseconds -> time string

/* former function name: TimeString() */
char * swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);

18.7.10 Centiseconds -> longitude or latitude string

/* former function name: LonLatString() */
char * swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);

18.7.11 Centiseconds -> degrees string

/* former function name: DegreeString() */
char * swe_cs2degstr(CSEC t, char *a);

C 19 The SWISSEPH DLLs

The folder windows of the SE 3 repository https://github.com/aloistr/swisseph3/tree/main/windows contains the DLLs swedll32.dll (32 bit) and swedll64.dll (64 bit) with their import libraries swedll32.lib and swedll64.lib, and in folder vb the declarations of the DLL functions for Visual Basic and VBA. The DLLs have the same names and export the same functions as the DLLs of SE 2.10.04. The functions use the calling convention __stdcall; the 32-bit DLL exports decorated names (e.g. _swe_calc@24), as required by VBA. The ephemeris for 1200 CE to 2400 CE is built into the DLLs. Like the DLLs of release 2.10.04, they are built with clang-cl (the clang compiler with the command-line options of Microsoft’s compiler) and lld-link (the LLVM linker); see windows/readme.md.

C 20 Using the DLL with Visual Basic 5.0 (chapter removed)

(chapter has been removed)

C 21 Using the DLL with Borland Delphi and C++ Builder (chapter removed)

(chapter has been removed)

C 22 Using the Swiss Ephemeris with Perl

The Swiss Ephemeris can be run from Perl using the Perl module SwissEph.pm. The module SwissEph.pm uses XSUB (“eXternal SUBroutine”), which calls the Swiss Ephemeris functions either from a C library or a DLL.

In order to run the Swiss Ephemeris from Perl, you have to:

Install the Swiss Ephemeris. Either you download the Swiss Ephemeris DLL from http://www.astro.com/swisseph or you download the Swiss Ephemeris C source code and compile a static or dynamic shared library. We built the package on a Linux system and use a shared library of the Swiss Ephemeris functions.

Install the XS library:

C 23 The C sample program for Windows (chapter removed)

See chapter 19 “The SWISSEPH DLLs”.

C 24 The source code distribution

The Swiss Ephemeris source code, documentation and the compressed ephemeris files are maintained in the public GitHub repositories https://github.com/aloistr/swisseph (Swiss Ephemeris version 2) and https://github.com/aloistr/swisseph3 (Swiss Ephemeris version 3).

The readme file in the repository is the authoritative and most up-to-date description of what can be downloaded and from where. This chapter only gives an overview.

Contents of the source distribution

The core of the library consists of

sweph.c, swephlib.c, swemplan.c, swemmoon.c, swejpl.c, swedate.c, swehouse.c, swecl.c, swehel.c, sepl_12.c and sepl_18.c (the latter two with SE 3 only),

with their header files.

The public interface is declared in swephexp.h; include only this file in your own programs.

The programs swetest.c and swemini.c examples and test tools and are not part of the library.

The program swetest.c is the Swiss Ephemeris command-line test and demonstration program, and it is also widely used as a practical tool. From the command line it computes planetary, lunar, asteroid and fixed-star positions, house cusps, and sidereal time for given dates, in many coordinate systems and with many options. It can also find solar and lunar eclipses, occultations, planetary crossings and heliacal events, and print the results as tables. Developers use it to check their own programs’ output against the library, and as a source of examples of how the swe_* functions are called.

The program swemini.c is a minimal C program that exemplifies how to calculate planetary positions.

The program swevents.c finds astronomical events for the planets over a date range, e.g., conjunctions and oppositions with the Sun, retrograde and direct stations, sign ingresses, perihelion and aphelion, and node crossings.

A makefile for Unix-like systems is included. The folder doc contains this documentation, setest contains test suites, bin contains swetest for Linux, and windows contains the files for Windows. Third-party code that uses the Swiss Ephemeris is in the folder contrib of the SE 2 repository (https://github.com/aloistr/swisseph/tree/master/contrib).

Windows

The folder windows contains the DLLs (see chapter 19), the programs swetest.exe and swevents.exe (64 bit), the sample program swewin32.exe (32 bit) with its source code, and declarations of the DLL functions for Visual Basic and VBA.

Ephemeris data files

The compressed planet, moon and main-asteroid files (files sepl*.se1, semo*.se1, seas*.se1 with SE 2; unified files sepl*.se3 with SE version 3) are in the repository folder ephe.

Since SE versions 2.10.04 and 3.00.00, these files have been generated from JPL DE441; they can also be used with older versions of SE 2.

Files for individual numbered asteroids are organized in folders ast0, ast1, ... astN ..., where N is the asteroid number divided by 1000; short files (*s.se1) cover 1500 to 2100 CE, long files (*.se1, only for named asteroids) cover 3000 BCE to 3000 CE.

License

The Swiss Ephemeris is dual-licensed (AGPL or Swiss Ephemeris Professional License). See LICENSE.TXT and https://www.astro.com/swisseph.

Other languages

Ports and wrappers (Java, Python, PHP, Perl) are listed in the readme. They are not maintained by Astrodienst.

C 25 The PLACALC compatibility API (chapter removed)

(Chapter has been removed.)

C 26 Documentation files

All documentation is in the Github repository

C 27 Swisseph with different hardware and compilers (chapter removed)

(Chapter has been removed.)

C 28 Debugging and Tracing Swisseph

SE 3 does not support the tracing functionality any longer.

C 29 Updates

C 29.1 Updates of documentation

UpdatedByChange
30-sep-1997Aloisadded chapter 10 (sample programs)
7-oct-1997Dieterinserted chapter 7 (house calculation)
8-oct-1997Dieterappendix “Changes from version 1.00 to 1.01”
12-oct-1997Aloisadded new chapter 10 Using the DLL with Visual Basic
26-oct-1997Aloisimproved implementation and documentation of swe_fixstar()
28-oct-1997Dieterchanges from Version 1.02 to 1.03
29-oct-1997Aloisadded VB sample extension, fixed VB declaration errors
9-nov-1997Aloisadded Delphi declaration sample
8-dec-1997Dieterremarks concerning computation of asteroids, changes to version 1.04
8-jan-1998Dieterchanges from version 1.04 to 1.10.
12-jan-1998Dieterchanges from version 1.10 to 1.11.
21-jan-1998Dietercalculation of topocentric planets and house positions (1.20)
28-jan-1998DieterDelphi 1.0 sample and declarations for 16- and 32-bit Delphi (1.21)
11-feb-1998Dieterversion 1.23
7-mar-1998Aloisversion 1.24 support for Borland C++ Builder added
4-jun-1998Aloisversion 1.25 sample for Borland Delphi-2 added
29-nov-1998Aloisversion 1.26 source code information added §16, Placalc API added
1-dec-1998Dieterchapter 19 and some additions in beginning of Appendix.
2-dec-1998Aloisequation of time explained (in §4), changes version 1.27 explained
3-dec-1998Dieternote on ephemerides of 1992 QB1 and 1996 TL66
17-dec-1998Aloisnote on extended time range of 10'800 years
22-dec-1998Aloisappendix A
12-jan-1999Dietereclipse functions added, version 1.31
19-apr-1999Dieterversion 1.4
8-jun-1999Dieterchapter 21 on tracing an debugging Swisseph
27-jul-1999Dieterinfo about sidereal calculations
16-aug-1999Dieterversion 1.51, minor bug fixes
15-feb-2000Dietermany things for version 1.60
19-mar-2000Vic Ogiswephprg.doc re-edited
17-apr-2002Dieterdocumentation for version 1.64
26-jun-2002Dieterversion 1.64.01
31-dec-2002Aloisedited doc to remove references to 16-bit version
12-jun-2003Alois/Dieterdocumentation for version 1.65
10-jul-2003Dieterdocumentation for version 1.66
25-may-2004Dieterdocumentation of eclipse functions updated
31-mar-2005Dieterdocumentation for version 1.67
3-may-2005Dieterdocumentation for version 1.67.01
22-feb-2006Dieterdocumentation for version 1.70.00
2-may-2006Dieterdocumentation for version 1.70.01
5-feb-2006Dieterdocumentation for version 1.70.02
30-jun-2006Dieterdocumentation for version 1.70.03
28-sep-2006Dieterdocumentation for version 1.71
29-may-2008Dieterdocumentation for version 1.73
18-jun-2008Dieterdocumentation for version 1.74
27-aug-2008Dieterdocumentation for version 1.75
7-apr-2009Dieterdocumentation of version 1.76
3-sep-2013Dieterdocumentation of version 1.80
10-sep-2013Dieterdocumentation of version 1.80 corrected
11-feb-2014Dieterdocumentation of version 2.00
4-mar-2014Dieterdocumentation of swe_rise_trans() corrected
18-mar-2015Dieterdocumentation of version 2.01
11-aug-2015Dieterdocumentation of version 2.02
14-aug-2015Dieterdocumentation of version 2.02.01
16-oct-2015Dieterdocumentation of version 2.03
21-oct-2015Dieterdocumentation of version 2.04
27-may-2015Dieterdocumentation of version 2.05
27-may-2015Dieterdocumentation of version 2.05.01
10-jan-2016Dieterdocumentation of version 2.06
5-jan-2018Dieterdocumentation of version 2.07
1-feb-2018Dieterdocumentation of version 2.07.01
22-feb-2018Dieterdocu of swe_fixstar2() improved
11-sep-2019Simon HrenReformatting of documentation
22-jul-2020DieterDocumentation of version 2.09
23-jul-2020DieterDocumentation of version 2.09.01
27-jul-2020DieterSmall corrections
18-aug-2020DieterDocumentation of version 2.09.02
1-sep-2020DieterDocumentation of version 2.09.03s
1-dec-2020DieterDocumentation of version 2.10
9-dec-2020DieterDieter: “AD” replaced by “CE” and “BC” replaced by “BCE”.
15-dec-2020AloisMinor cosmetics
27-jan-2021DieterSmall additions and minor cosmetics based on proposals by Aum Hren
2-may-2021DieterRelease notes for version 2.10.01
4-aug-2021AloisRelease notes for version 2.10.02
27-aug-2022AloisRelease notes for version 2.10.03
25-oct-2026DieterRelease notes for versions 2.10.04 and 3.00

C 29.2 Release History

ReleaseDateChanges
1.0030-sep-1997
1.019-oct-1997houses(), sidtime() made more convenient for developer, Vertex added.
1.0216-oct-1997houses() changed again, Visual Basic support, new numbers for fictitious planets This release was pushed to all existing licensees at this date.
1.0328-oct-1997minor bug fixes, improved swe_fixstar() functionality. This release was not pushed, as the changes and bug fixes are minor; no changes of function definitions occurred.
1.048-dec-1997minor bug fixes; more asteroids.
1.109-jan-1998bug fix, s. Appendix. This release was pushed to all existing licensees at this date.
1.1112-jan-1998small improvements
1.2020-jan-1998new: topocentric planets and house positions; a minor bug fix
1.2128-jan-1998Delphi declarations and sample for Delphi 1.0
1.222-feb-1998asteroids moved to subdirectory. Swe_calc() finds them there.
1.2311-feb-1998two minor bug fixes.
1.247-mar-1998documentation for Borland C++ Builder added, see section 14.3
1.254-jun-1998sample for Borland Delphi-2 added
1.2629-nov-1998full source code made available, Placalc API documented
1.272-dec-1998changes to SE_EPHE_PATH and swe_set_ephe_path()
1.3017-dec-1998time range extended to 10'800 years
1.3112-jan-1999new: Eclipse functions added
1.4019-apr-1999new: planetary phenomena added; bug fix in swe_sol_ecl_when_glob();
1.5027-jul-1999new: SIDEREAL planetary positions and houses; new fixstars.cat
1.5116-aug-1999minor bug fixes
1.6015-feb-2000major release with many new features and some minor bug fixes
1.6111-sep-2000minor release, additions to se_rise_trans(), swe_houses(), fictitious planets
1.61.0118-sep-2000minor release, added Alcabitus house system
1.61.0210-jul-2001minor release, fixed bug which prevented asteroid files > 22767 to be accepted
1.61.0320-jul-2001minor release, fixed bug which was introduced in 1.61.02: Ecliptic was computed in Radians instead of degrees
1.62.0023-jul-2001minor release, several bug fixes, code for fictitious satellites of the Earth, asteroid files > 55535 are accepted
1.62.0116-oct-2001bug fix, string overflow in sweph.c::read_const(),
1.63.005-jan-2002added house calculation to swetest.c and swetest.exe
1.64.006-mar-2002house system ‘G’ for house functions and function swe_gauquelin_sector() for Gauquelin sector calculations occultations of planets and fixed stars by the moon new Delta T algorithms
1.64.0126-jun-2002bug fix in swe_fixstar(). Stars with decl. between –1° and 0° were wrong
1.65.0012-jun-2003long variables replaced by INT32 for 64-bit compilers
1.66.0010-jul-2003house system ‘M’ for Morinus houses
1.67.0031-mar-2005update Delta T
1.67.013-may-2005docs for sidereal calculations (Chap. 10) updated (precession-corrected transits)
1.70.0022-feb-2006all relevant IAU resolutions up to 2005 have been implemented
1.70.012-may-2006minor bug fix
1.70.025-may-2006minor bug fix
1.70.0330-jun-2006bug fix
1.7128-sep-2006Swiss Ephemeris functions able to calculate minor planet no 134340 Pluto
1.7228-sep-2007new function swe_refrac_extended(), Delta T update, minor bug fixes
1.7329-may-2008new function swe_fixstars_mag(), Whole Sign houses
1.7418-jun-2008bug fixes
1.7527-aug-2008Swiss Ephemeris can read newer JPL ephemeris files; bug fixes
1.767-apr-2009heliacal risings, UTC and minor improvements/bug fixes
1.7726-jan-2010swe_deltat(), swe_fixstar() improved, swe_utc_time_zone added
1.783-aug-2012new precession, improvement of some eclipse functions, some minor bug fixes
1.7918-apr-2013new precession, improvement of some eclipse functions, some minor bug fixes
1.803-sep-2013security update, APC houses, bug fixes
2.0011-feb-2014Swiss Ephemeris is now based on JPL Ephemeris DE431
2.0118-mar-2015udates for tidal acceleration of the Moon with DE431, Delta T, and leap seconds. a number of bug fixes
2.0211-aug-2015new functions swe_deltat_ex() and swe_get_ayanamsha_ex()/swe_get_ayanamsha_ex_ut() a number of bug fixes
2.02.0114-aug-2015small corrections to new code, for better backward compatibility
2.0316-oct-2015Swiss Ephemeris thread-safe (except DLL)
2.0421-oct-2015Swiss Ephemeris DLL based on calling convention __stdcall again, as used to be
2.0527-may-2015bug fixes, new ayanamshas, new house methods, osculating elements
2.05.0127-may-2015bug fix in new function swe_orbit_max_min_true_distance()
2.0610-jan-2017new Delta T calculation
2.0710-jan-2018better performance of swe_fixstar() and swe_rise_trans()
2.07.011-feb-2018compatibility with Microsoft Visual Studio, minor bugfixes (fixed star functions, leap seconds).
2.0813-jun-2019new Delta T and a number of minor bugfixes.
2.0923-jul-2020improved Placidus houses, sidereal ephemerides, planetary magnitudes; minor bug fixes.
2.09.0123-jul-2020bug fix for improved Placidus houses.
2.09.0218-aug-2020new functions swe_houses_ex2(), swepeeds of house cusps.
2.09.031-sep-2020minor bug fixes.
2.103-dec-2020center of body, planetary moons, and planetocentric ephemerides
2.10.015-may-2021Minor bug fixes and DE441 added to the list of usable JPL ephemerides
2.10.024-aug-2021Added new functions swe_solcross etc, see chapter 5
2.10.0327-aug-2022Improved Moon magnitude, bug fix in swe_lun_eclipse_when
2.10.0418-oct-2026SE 2.10.4, Swiss Ephemeris now fully based on DE441
3.004-dec-2026SE 3.00, Swiss Ephemeris now fully based on DE441

C 29.3 Changes from version 2.10.03 to version 3.00.00

Swiss Ephemeris 3 has the following new features and improvements:

(a) It provides ephemerides based on JPL ephemeris DE441 as a default.

This means:

(b) The precession algorithm has been improved. Our precession model Vondrak (2011) does not work well for dates in the very remote past and future, where it provides ecliptic latitudes considerably greater than 0.5” for the Sun. SE 3 makes a smooth transition to the precession model Owen (1990) for epochs before 0 CE and after 4000 CE. This model Owen 1990 is also used by JPL Horizons.

The differences between the old and the new precession model in ecliptic longitude are as follows:

YearArcsec SE3-SE2
01.01.-12000237.413
01.01.-10000211.707
01.01.-8000146.276
01.01.-600072.769
01.01.-400023.205
01.01.-30009.623
01.01.-20001.824
01.01.-1000-1.926
01.01. 00.000
01.01.10000.000
01.01.20000.000
01.01.30000.000
01.01.40000.000
01.01.500012.343
01.01.600014.797
01.01.700013.865
01.01.80008.625
01.01.9000-0.297
01.01.10000-10.235
01.01.11000-16.775
01.01.12000-15.105
01.01.13000-2.097
01.01.1400021.790
01.01.1500051.967
01.01.1600081.192

(c) The function swe_fixstar() provides speeds of the fixed stars (like swe_fixstar2()).

(d) The calculation of Delta T was updated:

Morrison, Zawilski, Hohenkerk and Stephenson, "Addendum 2020 to ‘Measurement of the Earth’s rotation: 720 BC to AD 2015’", Royal Society Proceedings A, available from their website at

https://royalsocietypublishing.org/rspa/article/477/2246/20200776/82346/Addendum-2020-to-Measurement-of-the-Earth-s (retrieved 18-oct-2026)

Many thanks to Ron Scott for making us aware of this publication. This improves our Delta T by up to 3 min between 720 BCE and 1300 CE and makes them agree with JPL Horizons.

The changes of Delta T in SE 3.00 (SE 2.10.04) versus SE 2.10.03 (which roughly correspond differences between Horizons versus former versions of SE) are as follows:

YearDifference SE3.00.00/2.10.04 vs. SE2.10.03
-8000-10259 s
-1000-328 s
-700 - +1300< +/-190 s
1300 - 1700< +/- 55 s
1700 - 1900< +/- 0.3 s
1900 - 1962< 0.01 s
1962 - 20200.000000 s

The differences between SE3 and Horizons in Delta T are now:

YearDifference SE3.00.00/2.10.04 vs. Horizons
-10000< 0.2 sec
-720< 0.00005 sec
800< 0.00001 sec
1600< 0.000001 sec

The differences between SE3 and Horizons are greater after 1962, namely several 0.1 sec. This is because from this year on, Horizons gives Delta T relative to UTC whereas SE gives it relative to UT1.

https://webspace.science.uu.nl/~gent0113/deltat/deltat_modern.htm (retrieved 18-oct-2026)

This “effect” was already handled in SE2, however with a lower accuracy formula from AA page K8.

The changes resulting from this are minimal:

Yeardiff(ΔT) (SE3.0-SE2.10)
-10000-0.989 sec
-5000-0.354 sec
0-0.039 sec
1956-0.000 sec

(e) The program code for handling the file leap seconds file seleapsec.txt was removed as the CGPM decided in 2026 that there won’t be any future leap seconds.

(f) Heliocentric positions (SEFLG_HELCTR) include the aberration caused by the motion of the Sun around the barycentre of the solar system (up to about 0.01”), for the planets, the Earth, the Moon and the asteroids, as JPL Horizons does (general documentation, Appendix C, Test 4). Planetary moons and centers of body stay without it. SE2 gave astrometric heliocentric positions; with SE3 add SEFLG_NOABERR to get them. Accordingly, swe_calc() no longer returns SEFLG_NOABERR for heliocentric positions of these bodies.

(g) The distance speed of the fixed stars (xx[5] of swe_fixstar(), swe_fixstar_ut(), swe_fixstar2() and swe_fixstar2_ut()) is now computed from the geometric position and velocity of the star relative to the observer; aberration and light deflection do not change the distance. Before, it came from numerical differences of positions as long as the distance of the star and contained rounding noise, up to 100 % of the value for distant stars (Polaris). Positions and angular speeds are unchanged.

(h) The functions for solar eclipses, lunar eclipses and occultations and swe_pheno() compute the angle between two directions with atan2() instead of acos(), which is accurate also for very small angles. Near 0, acos() had steps of about 1 milliarcsecond, and attributes at the maximum of an eclipse or occultation, e.g. attr[0], jumped by up to 2.5e-5 between neighbouring times. In the test suite setest, attributes changed by at most 3.1e-7 and times by at most 4.7e-10 days (40 microseconds).

(i) The header files swephexp.h, sweph.h and sweodef.h contain only ASCII characters. Tools that read them with another encoding than UTF-8 (e.g. Python on Windows) failed on some comments. The degree sign ODEGREE_STRING is written as "\302\260", the same UTF-8 bytes as before.

(j) Delta T: the predictions 2027-2033 of the built-in table (USNO, 2022) were replaced by one value for 2027.0 from IERS Bulletin A of 26 November 2026; after 2027 the polynomial takes over. Delta T changes by up to +0.19 s in 2027-2029 and by -0.28 s to -0.01 s from 2031 to 2132. In 2026-2027 the new values are within 0.06 s of the IERS values (before: up to 0.26 s below). See 9.2 for UTC and UT1 without leap seconds.

(k) The file swe_deltat.txt (10.5) is now found in the ephemeris path also when Delta T is computed before the path has been set, e.g. when the first call of a program is swe_calc_ut() or swe_deltat(). Before, the file was then searched only in the current directory and ignored for the whole run of the program, unless swe_set_ephe_path() or swe_calc() had been called first.

(l) Windows: the folder windows of the repository contains the DLLs swedll32.dll and swedll64.dll with import libraries, the programs swetest.exe and swevents.exe (64 bit) and the sample program swewin32.exe (32 bit); see chapter 19. The DLLs have the same names and export the same functions as the DLLs of SE 2.10.04. In a DLL, swe_get_library_path() now returns the path of the DLL, as described in 2.6 (before, it returned the path of the program). The prototypes in swedll.h now agree with swephexp.h for all exported functions.

(m) Sidereal houses with the projection on the ecliptic of t0 or on the solar system plane (SE_SIDBIT_ECL_T0, SE_SIDBIT_SSY_PLANE): an angle near 0 is now computed without the loss of precision of acos(); the cusps change by at most 0.0004 arcsec near the reference date t0.

(n) swevents: the option -edirPATH (listed in the help, but not handled before) sets the ephemeris path; swevents calls only exported functions, so that it can also be linked with the DLL.

C 29.4 Changes from version 2.10.03 to version 2.10.04

We created new files sepl*.se1, semo*.se1, and seas*.se1 from DE441 for usage with SE2.

C 29.5 Changes from version 2.10.02 to 2.10.03

A bug was fixed in function swe_lun_eclipse_when() which had lead to missing lunar eclipses between the years 776 and 967 CE.

The calculation of Moon`s magnitude for large phase angles (when Moon is close to Sun) has been improved.

C 29.6 Changes from version 2.10.01 to 2.10.02

New functions were added, to find crossings of planets over fixed positions:

C 29.7 Changes from version 2.10 to 2.10.01

1. An old bug in the lunar ephemeris with (iflag & SEFLG_SWIEPH) was fixed. It resulted from the fact that a different ecliptic obliquity J2000 was used in the packing and unpacking of the ephemeris data (function sweph.c:rot_back()). The difference between the two was 0.042". Many thanks to Hal Rollins for finding and reporting this problem.

2. Correct handling of new JPL Ephemeris DE441, using the lunar tidal acceleration (deceleration) -25.936 "/cent^2 (according to Jon Giorgini/JPL's Horizons System).

3. Deltat T was updated for current years.

4. A minor bug in swe_calc_pctr() was fixed: The function did not work correctly with asteroids and (iflag & SEFLG_JPLEPH), resulting in the error message "Ephmeris file seas_18.se1 is damaged (2)".

5. Bug in swe_rise_set() with fixed stars reported by Ricardo Ric was fixed.

C 29.8 Changes from version 2.09.03 to 2.10

New features:

C 29.9 Changes from version 2.09.02 to 2.09.03

Three minor bug fixes:

C 29.10 Changes from version 2.09.01 to 2.09.02

New functions swe_houses_ex2() and swe_houses_armc_ex2() can calculate speeds (“daily motions”) of house cusps and related points.

C 29.11 Changes from version 2.09 to 2.09.01

Bugfix for improved Placidus house cusps near polar circle.

C 29.12 Changes from version 2.08 to 2.09

This release provides new values for Delta T in 2020 and 2021, an improved calculation of Placidus house cusps near the polar circles, new magnitudes for the major planets, improved sidereal ephemerides, and a few new ayanamshas.

1. Our calculation of Placidus house positions did not provide greatest possible precision with high geographic latitudes (noticed by D. Senthilathiban). For details, see further below.

2. New magnitudes according to Mallama 2018 were implemented. The new values agree with JPL Horizons for all planets except Mars, Saturn, and Uranus. Deviations form Horizons are < 0.1m for Mars, < 0.02m for Saturn and < 0.03m for Uranus.

3. New values for Delta T have been added for 2020 and 2021 (the latter estimated).

Sidereal astrology:

A lot of work has been done for more correct calculation of ayanamshas.

4. Improved general documentation:

These parts of the documentation have been improved considerably. Important contributions were made by D. Senthilathiban and A.K. Kaul.

(Thank you very much, indeed!)

If questions arise concerning the reproducibility of ayanamsha values as given in IAE, IENA, or Rashtriya Panchang, please study Appendix E in the general documentation.

5. Small corrections were to some ayanamshas whose original definition was based on an old precession model such as Newcomb or IAU 1976:

ayanamsha correction prec. model

0 Fagan-Bradley 0.41256” Newcomb

1 Lahiri -0.13036” IAU 1976

3 Raman 0.82800” Newcomb

5 Krishnamurti 0.82800” Newcomb

6. Additional, very small, corrections were made with the follwoing ayanamshas:

- Lahiri (1): Correction for nutation on initial date was slightly improved in agreement with IAE 1985, namely nutation Wahr (1980) instead of nutation IAU2000B.

- DeLuce (2): DeLuce assumed zero ayanamsha at 1 Jan. 1 BCE, but used Newcomb precession to determine the ayanamsha for current epochs. The ayanamsha is now based on modern precession. The correction amounts to about 22".

7. New ayanamshas:

The three additional Lahiri ayanamshas are not really important. They were needed for testing and understanding the history of this aynamasha, and for the same reason they should also be kept. Our hitherto Lahiri ayanamsha (SE_SIDM_LAHIRI = 1) is still the official Lahiri ayanamsha as used in Indian Astronomical Ephemeris (IAE) since 1985.

8. Option for ayanamsha calculation relative to ecliptic of date.

#define SE_SIDBIT_ECL_DATE 2048

With swetest, the option -sidbit2048 can be used. (To be used by those only who understand it.)

Other issues:

9. When house calculation fails (which can happen with Placidus, Gauquelin, Koch, Sunshine houses), then the house functions return error but nevertheless provide Porphyry house cusps. Until now, swetest did so silently, without any warning. It now writes a warning.

10. Bug fix in function swehouse.c:swe_house_pos(): Corrected double hcusp[36] to double hcusp[37].

11. Bug fix in function swe_refrac_extended(), calculating true altitude from apparent altitude (SE_APP_TO_TRUE): Function now correctly returns true altitude if apparent altitude is greater or equal to the dip of the horizon.

12. Bug fix in function swe_get_planet_name() when used for asteroids. If the file s*.se1 was older than 2005, then the function provided a name string beginning with "? ".

13. Behaviour of occultation functions with fixed stars: attr[0] and attr[2] (fraction of diameter or disk occulted by the Moon) now have the value 1 (in previous versions they had value 100). The new value is consistent with those given with occultations of planetary disks.

14. The function swe_calc() near its beginning set serr = '' in versions up to 2.08. This destroyed possible warnings written into it in the calling function swe_calc().

15. Perl-Swisseph:

- Functions swe_sol_eclipse_where(), swe_sol_eclipse_how(), swe_lun_eclipse_how() now provide Saros numbers, in the array attr as well as in the variables saros_series and saros_no.

- Functions swe_lun_eclipse_when() now also provide start and end times ecl_begin und ecl_end (as with sol_eclipse_when_glob()).

Concerning the improvement of Placidus house cusps:

Before Swiss Ephemeris 2.09, the Placidus house cusps were calculated with only two iterations. This resulted in an accuracy of 1 arcsec until about the geographic latitude 56°. On higher latitudes, the error was greater for some cusps and for some time of the day. For latitudes extremely close to the polar circle the error could even become greater than a degree.

This problem has been fixed by using a variable number of iterations, which stops when the cusp converges, with n = 100 as maximum number of iterations. If the iteration does not converge with this maximum of iterations, we switch to Porphyry cusps and return a warning.

Example:

Old calculation with SE 2.08:

sweph2.08/swetest -b26.1.2000 -ut8:08 -house30,66.562,P -p

date (dmy) 26.1.2000 greg. 8:08:00 UT version 2.08

UT: 2451569.838888889 delta t: 63.849300 sec

TT: 2451569.839627885

geo. long 30.000000, lat 66.562000, alt 0.000000

Epsilon (t/m) 23°26'16.2121 23°26'21.3741

house 1 93°10'50.7734

house 2 93°35'32.4962

house 3 94°45' 1.3614

house 4 96°22'19.2129

house 5 99°30'38.8122

house 6 107°41'47.9654

New calculation with SE 2.09:

swetest -b26.1.2000 -ut8:08 -house30,66.562,P -p

date (dmy) 26.1.2000 greg. 8:08:00 UT version 2.08.00a

UT: 2451569.838888889 delta t: 63.849300 sec

TT: 2451569.839627885

geo. long 30.000000, lat 66.562000, alt 0.000000

Epsilon (t/m) 23°26'16.2121 23°26'21.3741

Nutation -0° 0'13.1306 -0° 0' 5.1621

Houses system P (Placidus) for long= 30° 0' 0.0000, lat= 66°33'43.2000

house 1 93°10'50.7734

house 2 93°35'32.4962

house 3 94°45' 1.3614

house 4 96°22'19.2129

house 5 99°34' 5.9429

house 6 109°14' 4.4696

C 29.13 Changes from version 2.07.01 to 2.08

This release provides a number minor bug fixes and cleanups, an update for current Delta T, a few little improvements of swetest and three new ayanamshas.

Fixed star functions:

Position values were not affected by this bug.

The nutation component was missing.

Ayanamshas:

SE_SIDM_GALCENT_COCHRANE (David Cochrane)

SE_SIDM_GALEQU_FIORENZA (Nick Anthony Fiorenza)

SE_SIDM_VALENS_MOON (Vettius Valens, 2nd century CE)

For information on these, please look them up in the general documentation of the Swiss Ephemeris.

E = -3;22 in source corresponds ayanamsha ay = 5;40

E = -4;46 in source corresponds ayanamsha ay = 4;16

E = -5;37 in source corresponds ayanamsha ay = 3;25

(Nobody has noticed this error for 20 years.)

Other stuff:

SE_SPLIT_DEG_ROUND_SEC or SE_SPLIT_DEG_ZODIACAL:

Sometimes, it provided sign number 12 when a position was rounded to 360°. This was wrong because sign numbers are defined as 0 - 11. This is a very old bug. From now on, only sign numbers 0 - 11 can occur.

A similar error occurred with SE_SPLIT_DEG_ROUND_SEC and SE_SPLIT_DEG_NAKSHATRA, where only nakshatra numbers 0 - 26 should be returned, no 27.

Improvements of swetest:

All new DLLs and executables were created with Microsoft Visual Studio 2015 (version 14.), no longer with MinGW on Linux. The usage of MinGW since Swiss Ephemeris version 2.05 had caused difficult problems for some of our users. We hope that these problems will now disappear.

C 29.14 Changes from version 2.07 to 2.07.01

C 29.15 Changes from version 2.06 to 2.07

To transform the distances from AU into lightyears or parsec, please use the following defines, which are in swephexp.h:

#define AUNIT_TO_LIGHTYEAR (1.0/63241.077088071)
#define AUNIT_TO_PARSEC (1.0/206264.8062471)

"Vedic" ayanamsha according to Sunil Sheoran (SE_SIDM_TRUE_SHEORAN)

It must be noted that in Sheoran's opinion 0 Aries = 3°20' Ashvini. The user has to carry the responsibility to correctly handle this problem. For calculating a planet's nakshatra position correctly, we recommend the use of the function swe_split_deg() with parameter roundflag |= SE_SPLIT_DEG_NAKSHATRA or roundflag |= 1024. This will handle Sheoran’s ayanamsha correctly.

For more information about this and other ayanamshas, I refer to the general documentation chap. 2.7 or my article on ayanamshas here: https://www.astro.com/astrology/in_ayanamsha_e.htm

SE_BIT_GEOCTR_NO_ECL_LAT 128 /* use geocentric (rather than topocentric) position of object and ignore its ecliptic latitude */

SE_BIT_HINDU_RISING /* calculate risings according to Hindu astrology */

Janez Križaj noticed that in the remote past the ephemeris of the Sun has some unusual ecliptic latitude, which amounts to +-51 arcsec for the year -12998. This phenomenon is due to an intrinsic inaccuracy of the precession theory Vondrak 2011 and therefore we do not try to fix it. While the problem could be avoided by using some older precession theory such as Laskar 1986 or Owen 1990, we give preference to Vondrak 2011 because it is in very good agreement with precession IAU2006 for recent centuries. Also, the “problem” (a very small one) appears only in the very remote past, not in historical epochs.

Important additional information on the new function swe_fixstar2() and its derivatives with increased performance:

Some users had criticized that swe_fixstar() was very inefficient because it reopened and scanned the file sefstars.txt for each fixed star to be calculated. With version 2.07, the new function swe_fixstar2() reads the whole file the first time it is called and saves all stars in a sorted array of structs. Stars are searched in this list using the binary search function bsearch(). After a call of swe_close() the data will be lost. A new call of swe_fixstar2() will reload all stars from sefstars.txt.

The declaration of swe_fixstar2() is identical to old swe_fixstar(), but its behavior is slightly different:

Fixed stars can be searched by

(With previous versions, search string "aldeb" provided the star Aldebaran. This does not work anymore. For abbreviated search strings, a ‘%’ wildcard must, be added, e.g. "aldeb%".)

With the old swe_fixstar(), it was possible to use numbers as search keys. The function then returned the n-th star it found in the list. This functionality is still available in the new version of the function, but the star numbering does no longer follow the order of the stars in the file, but the order of the sorted Bayer designations. Nevertheless this feature is very practical if one wants to create a list of all stars.

for i=1; i<10000; i++) { // choose any number greater than number of lines (stars) in file
sprintf(star, "%d", i);
returncode = swe_fixstar2(star, tjd, ...);
... whatever you want to do with the star positions ...
if (returncode == ERR)
break;
}

C 29.16 Changes from version 2.05.01 to 2.06

New calculation of Delta T, according to:

Stephenson, F.R., Morrison, L.V., and Hohenkerk, C.Y., "Measurement of the Earth's Rotation: 720 BCE to CE 2015", published by Royal Society Proceedings A and available from their website at

https://royalsocietypublishing.org/doi/10.1098/rspa.2016.0404 (retrieved 6 April 2026).

https://web.archive.org/web/20221216163810/http://astro.ukho.gov.uk/nao/lvm/ (retrieved in web archive 6 April 2026)

https://web.archive.org/web/20180601072005/http://astro.ukho.gov.uk/nao/lvm/Table-S15.txt (retrieved in web archive 6 April 2026)

This publication provides algorithms for Delta T from 721 BCE to 2016 CE based on historical observations of eclipses and occultations, as well as a parabolic function for epochs beyond this time range.

The new Swiss Ephemeris uses these algorithms before 1 Dec. 1955 and then switches over to values provided by Astronomical Almanac 1986(etc.) pp. K8-K9 and values from IERS.

Delta T values from 1973 to today have been updated by values from IERS, with four-digit accuracy. Two small bugs that interpolates these tabulated data have been fixed. Changes in Delta T within this time range are smaller than 5 millisec. The accuracy possible with 1-year step width is about 0.05 sec. For better accuracy, we would have to implement a table of monthly or daily delta t values.

Time conversions from or to UTC take into account the leap second of 31 Dec 2016.

Minor bug fixes in heliacal functions. E.g., heliacal functions now work with ObjectName in uppercase or lowercase.

Function swe_house_pos() now provides geometrically correct planetary house positions also for the house methods I, Y, S (Sunshine, APC, Scripati).

House method N (1 = 0° Widder) did not work properly with some sidereal zodiac options.

swe_houses_ex() with sidereal flag and rarely used flags SE_SIDBIT_ECL_T0 or SE_SIDBIT_SSY_PLANE returned a wrong ARMC.

Better behavior of swetest -rise in polar regions.

swetest understands a new parameter -utcHH:MM:SS, where input time is understood as UTC (whereas -utHH:MM:SS understands it as UT1). Note: Output of dates is always in UT1.

About 110 fixed stars were added to file sefstars.txt.

Resulting differences from older versions

Swiss Ephemeris 2.06 has a new Delta T algorithm based on:

https://royalsocietypublishing.org/doi/10.1098/rspa.2016.0404 (retrieved 6 april 2026)

The Swiss Ephemeris uses it for calculations before 1948.

Differences resulting from this update are shown in Chapter 7 on Delta T.

Differences in ΔT, SE 2.06 – SE 2.05 (new – old)

(with resulting differences for lunar and solar ephemerides calculated in UT)

YearΔT secDifference in ΔT (new-old)L (Moon)L (Sun)
-3000750511174644"48"
-250060203865475"36"
-200046979588323"24"
-150035377342188"14"
-10002539812971"5"
-900235969049"4"
-800218605229"2"
-70020142-31-17"-1"
-60018373-229-126"-9"
-50016769-325-179"-13"
-40015311-119-65"-5"
-30013981-5-3"-0"
-200127585027"2"
-100116236234"3"
0105574324"2"
100954063"0"
2008554-31-17"-1"
3007578-53-29"-2"
4006593-62-34"-3"
5005590-81-45"-3"
6004596-110-60"-5"
7003649-135-74"-6"
8002786-145-80"-6"
9002045-135-74"-6"
10001464-94-52"-4"
11001063-13-7"-1"
12008027642"3"
130062514177"6"
140047315786"6"
15002929753"4"
160089-29-16"-1.2"
1700146.53.6"0.27"
1800195.32.9"0.22"
1900-2.00.780.43"0.03"
1920220.470.26"0.02"
1940240.100.05"0.00"
1960330.000.00"0.00"
1970400.000.00"0.00"
1980510.000.00"0.00"
1990570.000.00"0.00"
2000640.000.00"0.00"
2010660.000.00"0.00"
2020700.000.00"0.00"
203074-5.9-3.3"-0.24"
204076-21-12"-0.87"
205078-37-20"-1.5"
210094-119-65"-4.9"
2200163-265-145"-11"
2300297-397-218"-16"
2400520-503-276"-21"
2500855-558-307"-23"
30003292-1004-551"-41"

C 29.17 Changes from version 2.05 to 2.05.01

Bug in new function swe_orbit_max_min_true_distance() has been fixed.

C 29.18 Changes from version 2.04 to 2.05

Starting with release 2.05, the special unit test system setest designed and developed by Rüdiger Plantiko is used by the developers. This improves the reliability of the code considerably and has led to the discovery of multiple bugs and inconsistencies.

Note: setest is not to be confused with swetest, the test command-line utility program.

Bug fixes and new features:

1) The Fixed stars file sefstars.txt was updated with new data from the Simbad Database. Some errors in the file were fixed.

2) Topocentric positions of planets: The value of speed was not very good. This problem was found by Igor "TomCat" Germanenko in March 2015. A more accurate calculation of speed from three positions has now been implemented.

In addition, topocentric positions had an error < 1 arcsec if the function swe_calc() was called without SEFLG_SPEED. This problem was found by Bernd Müller and has now been fixed.

3) Initial calls of the Swiss Ephemeris: Some problems were fixed which appeared when users did calculations without opening the Swiss, i.e. without calling the function swe_set_ephe_path().

NOTE: It is still strongly recommended to call this function in the beginning of an application in order to make sure that the results are always consistent.

4) New function swe_get_orbital_elements() calculates osculating Kepler elements and some other data for planets, Earth-Moon barycentre, Moon, and asteroids. The program swetest has a new option -orbel that displays these data.

New function swe_orbit_max_min_true_distance() provides maximum, minimum, and true distance of a planet, on the basis of its osculating ellipse. The program swetest, when called with the option -fq, displays a relative distance of a planet (0 is maximum distance, 1000 is minimum distance).

5) New house methods were added:

F - Carter poli-equatorial house system

D - Equal houses, where cusp 10 = MC

I - Sunshine

N - Equal houses, where cusp 1 = 0 Aries

L - Pullen SD (sinusoidal delta) = ex Neo-Porphyry

Q - Pullen SR (sinusoidal ratio)

S - Sripati

Note:

Y APC, I Sunshine, L Pullen SD, Q Pullen SR, S Sripati

We hope to implement correct geometrical algorithms with time.

Minor bugfixes with houses:

6) Sidereal zodiac defined relative to UT or TT:

A problem found by Parashara Kumar with the ayanamsha functions: The function swe_get_ayanamsa() requires TT (ET), but some of the ayanamshas were internally defined relative to UT. Resulting error in ayanamsha were about 0.01 arcsec in 500 CE. The error for current dates is about 0.0001 arcsec.

The internal definitions of the ayanamshas has been changed and can be based either on UT or on TT.

Nothing changes for the user, except with user-defined ayanamshas. The t0 used in swe_set_sid_mode() is considered to be TT, except if the new bit flag SE_SIDBIT_USER_UT (1024) is or'ed to the parameter sid_mode.

7) Ayanamshas: Some ayanamshas were corrected:

In addition, the following ayanamshas have been added:

More information about these ayanamshas is given in the General Documentation of the Swiss Ephemeris.

8) _TRUE_ ayanamshas algorithm (True Chitra, True Revati, True Pushya, True Mula, Galactic/Gil Brand, Galactic/Wilhelm) always keep the intended longitude, with or without the following iflags: SEFLG_TRUEPOS, SEFLG_NOABERR, SEFLG_NOGDEFL.

So far, the True Chitra ayanamsha had Spica/Chitra at 180° exactly if the apparent position of the star was calculated, however not if the true position (without aberration/light deflection) was calculated. However, some people may find it more natural if the star’s true position is exactly at 180°.

9) Occultation function swe_lun_occult_when_loc():

As a result of the changes three are very small changes in the timings of the events.

10) Magnitudes for Venus and Mercury have been improved according to Hilten 2005.

The Swiss Ephemeris now provides the same magnitudes as JPL's Horizons System.

11) Heliacal functions: A few bugs discovered by Victor Reijs have been fixed, which however did not become apparent very often.

12) User-defined Delta T: For archeoastronomy (as suggested by Victor Reijs) a new function swe_set_delta_t_userdef() was created that allows the user to set a particular value for delta t.

13) Function swe_nod_aps(): a bug was fixed that occurred with calculations for the EMB.

14) New function swe_get_library_path(): The function returns the path in which the executable resides. If it is running with a DLL, then returns the path of the DLL.

C 29.19 Changes from version 2.03 to 2.04

The DLL of version 2.03 is not compatible with existing software. In all past versions, the function names in the DLL were “decorated” (i.e. they had an initial ‘_’ and a final ‘@99’). However, version 2.03 had the function names “undecorated”. This was a result of the removal of the PASCAL keyword from the function declarations. Because of this, the DLL was created with the __cdecl calling convention whereas with the PASCAL keyword it had been created with the __stdcall calling convention.

Since VBA requires __stdcall, we return to __stdcall and to decorated function names.

The macro PASCAL_CONV, which had been misleading, was renamed as CALL_CONV.

C 29.20 Changes from version 2.02.01 to 2.03

This is a minor release, mainly for those who wish a thread-safe Swiss Ephemeris. It was implemented according to the suggestions made by Rüdiger Plantico and Skylendar. Any errors might be Dieter Koch’s fault. On our Linux system, at least, it seems to work.

However, it seems that that we cannot build a thread-safe DLL inhouse at the moment. If a group member could provide a thread-safe DLL, that could be added to the Swiss Ephemeris download area.

Other changes:

FAR, PASCAL, and EXP16 macros in function declarations were removed.

Minor bug fixes:

Note, other issues that have been discussed recently or even longer ago had to be postponed.

C 29.21 Changes from version 2.02 to 2.02.01

swe_deltat() assumes

SEFLG_JPLEPH, if a JPL file is open;

SEFLG_SWIEPH, otherwise.

Usually, this modification does not result in values different from those provided by former versions SE 2.00 and 2.01.

Note, SEFLG_MOSEPH is never assumed by swe_deltat(). For consistent handling of ephemeris-dependent Delta T, please use the new Delta T function swe_deltat_ex(). Or if you understand the lunar tidal acceleration problem, you can use swe_set_tid_acc() to define the value you want.

Thanks to Thomas Mack for some contributions to this release.

C 29.22 Changes from version 2.01 to 2.02

Many thanks to all who have contributed bug reports, in particular Thomas Mack, Bernd Müller, and Anner van Hardenbroek.

Swiss Ephemeris 2.02 contains the following updates:

The bug also resulted in errors of similar size in azimuth calculations before 1850 and after 2050.

Moreover, the bug resulted in errors of a few milliarcseconds in topocentric planetary positions before 1850 and after 2050.

In addition, the timings of risings, settings, and local eclipses may be slightly affected, again only before 1850 and after 2050.

SEFLG_SWIEPH, SEFLG_JPLEPH, SEFLG_MOSEPH, and serr the usual string for error messages.

It is wise to use this new function instead of the old swe_deltat(), especially if one uses more than one ephemeris or wants to compare different ephemerides in UT.

Detailed explanations about this point are given further below in the general remark concerning Swiss Ephemeris 2.02 and above in chap. 8 (on Delta T functions).

SEFLG_JPLEPH, if a JPL file is open;

SEFLG_SWIEPH, if a Swiss Ephemeris sepl* or semo* file is found;

SEFLG_MOSEPH otherwise.

Usually, this modification does not result in values different from those provided by former versions SE 2.00 and 2.01.

For detailed explanations about this point, see general remarks further below.

Usually, this modification does not result in different results.

With version 2.02, an error is returned instead.

swetest:

A general remark concerning Swiss Ephemeris 2.02:

Since Swiss Ephemeris 2.0, which can handle a wide variety of JPL ephemerides, old design deficiencies of some functions, in particular swe_deltat(), have become incommoding under certain circumstances. Problems may (although need not) have occurred when the user called swe_calc_ut() or swe_fixstar_ut() for the remote past or future or compared planetary positions calculated with different ephemeris flags (SEFLG_SWIEPH, SEFLG_JPLEPH, SEFLG_MOSEPH).

The problem is that the Delta T function actually needs to know what ephemeris is being used but does not have an input parameter ephemeris_flag. Since Swiss Ephemeris 2.00, the function swe_deltat() has therefore made a reasonable guess what kind of ephemeris was being used, depending on the last call of the function swe_set_ephe_path(). However, such guesses are not necessarily always correct, and the functions may have returned slightly inconsistent return values, depending on previous calculations made by the user. Although the resulting error will be always smaller than the inherent inaccuracy in historical observations, the design of the function swe_deltat() is obviously inappropriate.

A similar problem exists for the function swe_get_ayanamsa() although the possible inconsistencies are very small.

To remedy these problems, Swiss Ephemeris 2.02 introduces new functions for the calculation of Delta T and ayanamsha:

swe_deltat_ex(),
swe_get_ayanamsa_ex_ut(), and
swe_get_ayanamsa_ex()
(The latter is independent of Delta T, however some ayanamshas like True Chitrapaksha depend on a precise fixed star calculation, which requires a solar ephemeris for annual aberration. Therefore, an ephemeris flag is required.)

Of course, the old functions swe_deltat(), swe_get_ayanamsa(), and swe_get_ayanamsa_ut() are still supported and work without any problems as long as the user uses only one ephemeris flag and calls the function swe_set_ephe_path() (as well swe_set_jpl_file() if using SEFLG_JPLEPH) before calculating Delta T and planetary positions. Nevertheless, it is recommended to use the new functions swe_deltat_ex(), swe_get_ayanamsa_ex(), and swe_get_ayanamsa_ex_ut() in future projects.

Also, please note that if you calculate planets using swe_calc_ut(), and stars using swe_fixstar_ut(), you usually need not worry about Delta T and can avoid any such complications.

C 29.23 Changes from version 2.00 to 2.01

Many thanks to those who reported bugs or made valuable suggestions. And I apologize if I forgot to mention some name.

Note: Still unsolved is the problem with the lunar node with SEFLG_SWIEPH, discovered recently by Mihai (I don't know his full name).

This problem, which has existed "forever", is tricky and will take more time to solve.

Improvements and updates:

IPN Progress Report 42-196, February 15, 2014, p. 15: W.M. Folkner & alii, “The Planetary and Lunar Ephemerides DE430 and DE431”.

Fixes for bugs introduced with major release 2.0:

This was caused by the new (since 2.0) long-term algorithm for Sidereal Time, which interfered with the function swe_calc().

Errors due to this bug were < 0.3 arcsec for the Moon and < 0.001" for other objects.

Chiron ephemeris range defined as 675 CE to 4650 CE.

Pholus ephemeris range defined as -2958 (2959 BCE) to 7309 CE.

Time range of interpolated lunar apside defined as -3000 (3001 BCE) to 3000 CE.

"... #define _FILE_OFFSET_BITS 64

has to appear before(!) including the standard libraries. ... You then can compile even on 32 bit systems without any need for workarounds."

Fixes for other bugs (all very old):

The following functions were affected:

swe_lun_eclipse_when(), swe_sol_eclipse_when_glob(), swe_sol_eclipse_when_loc().

There was no such problem with the remote past, only with the remote future.

180.0000000000000 could have been printed as "179°59'59.1000".

C 29.24 Changes from version 1.80 to 2.00

This is a major release which makes the Swiss Ephemeris fully compatible with JPL Ephemeris DE430/DE431.

A considerable number of functions were updated. That should not be a problem for existing applications. However, the following notes must be made:

  1. New ephemeris files sepl*.se1 and semo*.se1 were created from DE431, covering the time range from 11 Aug. -12999 Jul. (= 4 May -12999 Greg.) to 7 Jan. 16800. For consistent ephemerides, users are advised to use either old sepl* and semo* files (based on DE406) or new files (based on DE431) but not mix old and new ones together. The internal handling of old and new files is not 100% identical (because of 3. below).

  2. Because the time range of DE431 is a lot greater than that of DE406, better algorithms had to be implemented for objects not contained in JPL ephemerides (mean lunar node and apogee). Also, sidereal time and the equation of time had to be updated in order to give sensible results for the whole time range. The results may slightly deviate from former versions of the Swiss Ephemeris, even for epochs inside the time range of the old ephemeris.

  3. Until version 1.80, the Swiss Ephemeris ignored the fact that the different JPL ephemerides have a different inherent value of the tidal acceleration of the Moon. Calculations of Delta T must be adjusted to this value in order to get best results for the remote past, especially for ancient observations of the Moon and eclipses. Version 2.0 might result in slightly different values for Delta T when compared with older versions of the Swiss Ephemeris. The correct tidal acceleration is automatically set in the functions swe_set_ephe_path() and swe_set_jpl_file(), depending on the available lunar ephemeris. It can also be set using the function swe_set_tid_acc(). Users who work with different ephemerides at the same time, must be aware of this issue. The default value is that of DE430.

New functionality and improvements:

Bug fixes:

These differences are explained by the fact that the Swiss Ephemeris is now based on JPL Ephemeris DE431, whereas before release 2.00 it was based on DE406. The differences are listed above in Ch. 2.1.1.3, see paragraph on “Comparison of JPL ephemerides DE406 (1998) with DE431 (2013)”.

C 29.25 Changes from version 1.79 to 1.80

C 29.26 Changes from version 1.78 to 1.79

C 29.27 Changes from version 1.77 to 1.78

Former versions of the Swiss Ephemeris had used the precession model by Capitaine, Wallace, and Chapront of 2003 for the time range -5500 until 9500 and the precession model Laskar 1986 for epochs outside this time range. (Since planetary ephemerides were restricted to -5400 to +5400, Laskar precession is only relevant for calculations of fixed stars.)

Version 1.78 calculates precession and ecliptic obliquity according to Vondrák, Capitaine, and Wallace, “New precession expressions, valid for long time intervals”, A&A 534, A22 (2011), which is good for +- 200 millennia.

This change has almost no ramifications for historical epochs. Planetary positions and the obliquity of the ecliptic change by less than an arc minute in 5400 BCE. However, for research concerning the prehistoric cave paintings (Lascaux, Altamira, etc., some of which may represent celestial constellations), fixed star positions are required for 15000 BCE or even earlier (the Chauvet cave was painted in 33000 BCE). Such calculations are now possible using the Swiss Ephemeris version 1.78 or higher. However, the Sun, Moon, and the planets remain restricted to the time range 5400 BCE to 5400 CE.

Differences (in arc sec) in precession (v. 1.78 – v. 1.77, test star was Aldebaran)

Only differences between -5500 and +9500 are differences Vondrák – P03. Those outside this time range are actually differences Vondrák – Laskar 1986.

YearDifference
-20000-26716"
-15000-2691"
-10000-256"
-5000-3.95352"
-4000-9.77940"
-3000-7.00524"
-2000-3.40524"
-1000-1.23732"
0-0.33948"
1000-0.05400"
1800-0.00108"
1900-0.00036"
20000.00000"
2100-0.00036"
2200-0.00072"
30000.03528"
40000.59904"
50002.90160"
1000077"
15000228"
190002839"
200005218"

Differences (in arc sec) in ecliptic obliquity:

YearDifference
-2000011074.43664"
-150003321.50652"
-10000632.60532"
-5000-33.42636"
00.01008"
10000.00972"
20000.00000"
3000-0.01008"
4000-0.05868"
10000-72.91980"
15000-772.91712"
20000-3521.23488”

C 29.28 Changes from version 1.76 to 1.77

Fixed stars:

Differences in ΔT, SE 1.77 – SE 1.76

YearDifference in seconds (new - old)
-30003
-20002
-11001
-100129
-900-45
-800-57
-700-696(is a maximum!)
-500-14
until -2003 > diff > -25
until 1003 > diff > -15
until 5003 > diff > -03
until 16004 > diff > -16
until 16301 > diff > -30
until 17000.1| diff |
until 19000.01
until 21000.001

The differences for –1000 to +1630 are explained as follows:

Espenak & Meeus ignore Morrison & Stephenson's values for -700 and -600, whereas the former Swiss Ephemeris versions used them. For -500 to +1600 Espenak & Meeus use polynomials whereas the former Swiss Ephemeris versions used a linear interpolation between Morrison / Stephenson's tabulated values.

C 29.29 Changes from version 1.75 to 1.76

New features:

Other updates:

Minor bug fixes:

C 29.30 Changes from version 1.74 to version 1.75

C 29.31 Changes from version 1.73 to version 1.74

The Swiss Ephemeris is made available under a dual licensing system:

  1. GNU public license version 2 or later;

  2. Swiss Ephemeris Professional License.

For more details, see at the beginning of this file and at the beginning of every source code file.

Minor bug fixes:

C 29.32 Changes from version 1.72 to version 1.73

New features:

C 29.33 Changes from version 1.71 to version 1.72

This function allows correct calculation of refraction for altitudes above sea > 0, where the ideal horizon and planets that are visible may have a negative height.

Differences in ΔT, SE 1.72 – SE 1.71

YearDifference in seconds (new - old)
-3000-4127
-2000-2130
-1000-760
0-20
1000-30
160010
16190.5
16200

C 29.34 Changes from version 1.70.03 to version 1.71

In September 2006, Pluto was introduced to the minor planet catalogue and given the catalogue number 134340.

The numerical integrator we use to generate minor planet ephemerides would crash with 134340 Pluto, because Pluto is one of those planets whose gravitational perturbations are used for the numerical integration. Instead of fixing the numerical integrator for this special case, we changed the Swiss Ephemeris functions in such a way that they treat minor planet 134340 Pluto (ipl=SE_AST_OFFSET+134340) as our main body Pluto (ipl=SE_PLUTO=9). This also results in a slightly better precision for 134340 Pluto.

Swiss Ephemeris versions prior to 1.71 are not able to do any calculations for minor planet number 134340.

C 29.35 Changes from version 1.70.02 to version 1.70.03

Bug fixed (in swecl.c: swi_bias()): This bug sometimes resulted in a crash, if the DLL was used and the SEFLG_SPEED was not set. It seems that the error happened only with the DLL and did not appear, when the Swiss Ephemeris C code was directly linked to the application.

Code to do with (#define NO_MOSHIER) was removed.

C 29.36 Changes from version 1.70.01 to version 1.70.02

Bug fixed in speed calculation for interpolated lunar apsides. With ephemeris positions close to 0 Aries, speed calculations were completely wrong. E.g. swetest -pc -bj3670817.276275689 (speed = 1448042° !)

Thanks, once more, to Thomas Mack, for testing the software so well.

C 29.37 Changes from version 1.70.00 to version 1.70.01

Bug fixed in speed calculation for interpolated lunar apsides. Bug could result in program crashes if the speed flag was set.

C 29.38 Changes from version 1.67 to version 1.70

Update of algorithms to IAU standard recommendations:

All relevant IAU resolutions up to 2005 have been implemented. These include:

For more info, see the documentation swisseph3.pdf, Appendices C and D.

New features:

For more info, see the documentation swisseph3.pdf, section “The Interpolated or Natural Apogee and Perigee”.

For more info, see the documentation swisseph3.pdf, section “Krusinski/Pisa/Goelzer system”.

Bug fixes:

With version 1.70, the standard algorithms recommended by the IAU resolutions up to 2005 were implemented. The following calculations have been added or changed with Swiss Ephemeris version 1.70:

The differences between the old and new planetary positions in ecliptic longitude (arc seconds) are:

YearNew - Old
2000-0.00108
19950.02448
19800.05868
19700.10224
19500.15768
19000.30852
18000.58428
1799-0.04644
1700-0.07524
1500-0.12636
1000-0.25344
0-0.53316
-1000-0.85824
-2000-1.40796
-3000-3.33684
-4000-10.64808
-5000-32.68944
-5400-49.15188

The discontinuity of the curve between 1800 and 1799 is explained by the fact that old versions of the Swiss Ephemeris used different precession models for different time ranges: the model IAU 1976 by Lieske for 1800-2200, and the precession model by Williams 1994 outside that time range.

Note: Precession model P03 is said to be accurate to 0.00005 arc second for CE 1000-3000.

The differences between version 1.70 and older versions for the future are as follows:

YearDifference
2000-0.00108
2010-0.01620
2050-0.14004
2100-0.29448
2200-0.61452
22010.05940
30000.27252
40000.48708
50000.47592
54000.40032

The discontinuity in 2200 has the same explanation as the one in 1800.

Jyotish / sidereal ephemerides

The ephemeris changes by a constant value of about +0.3 arc second. This is because all our ayanamshas have the start epoch 1900, for which epoch precession was corrected by the same amount.

Fictitious planets / bodies from the orbital elements file seorbel.txt

There are changes of several 0.1 arcsec, depending on the epoch of the orbital elements and the correction of precession as can be seen in the tables above.

The differences for ecliptic obliquity in arc seconds (new - old) are:

YearDifference
5400-1.71468
5000-1.25244
4000-0.63612
3000-0.31788
2100-0.06336
2000-0.04212
1900-0.02016
18000.01296
17000.04032
16000.06696
15000.09432
10000.22716
00.51444
-10001.07064
-20002.62908
-30006.68016
-400015.73272
-500033.54480
-540044.22924

The differences for sidereal time in seconds (new - old) are:

YearDifference
5400-2.544
5000-1.461
4000-0.122
30000.126
21000.019
20000.001
19000.019
10000.126
0-0.122
-500-0.594
-1000-1.461
-2000-5.029
-3000-12.355
-4000-25.330
-5000-46.175
-5400-57.273

C 29.39 Changes from version 1.66 to version 1.67

Delta-T updated with new measured values for the years 2003 and 2004, and better estimates for 2005 and 2006.

Bug fixed #define SE_NFICT_ELEM 15

C 29.40 Changes from version 1.65 to version 1.66

New features:

House system according to Morinus (system ‘M’).

C 29.41 Changes from version 1.64.01 to version 1.65.00

C 29.42 Changes from version 1.64 to version 1.64.01

Thanks to John Smith, Serbia, who found this bug.

swetest.c: options –po and –pn work now.

Sweph.c: speed of mean node and mean lunar apogee were wrong in rare cases, near 0 Aries.

C 29.43 Changes from version 1.63 to version 1.64

New features:

  1. Gauquelin sectors:
  1. Waldemath Black Moon elements have been added in seorbel.txt (with thanks to Graham Dawson).

  2. Occultations of the planets and fixed stars by the moon

  1. Minor bug fixes in swe_fixstar() (Cartesian coordinates), solar eclipse functions, swe_rise_trans()

  2. sweclips.c integrated into swetest.c. Swetest now also calculates eclipses, occultations, risings and settings.

  3. new Delta T algorithms

Differences in ΔT, SE 1.64 – SE 1.63

YearDifference in seconds (new - old)
-30002900
01200
160029
161960
1620-0.6
1700-0.4
1800-0.1
1900-0.02
1940-0.001
19500
20000
20202
210023
3000-400

In 1620, where the ΔT table of the Astronomical Almanac starts, there was a discontinuity of a whole minute in the old algorithms. This has been fixed with SE 1.64.

The smaller differences for the period 1620-1955 are due to a correction in the tidal acceleration of the Moon, which now has the same value as is also used by JPL for their T calculations.

C 29.44 Changes from version 1.62 to version 1.63

New features:

The option –house was added to swetest.c so that swetest.exe can now be used to compute complete horoscopes in textual mode.

Bug fix: a minor bug in function swe_co_trans was fixed. It never had an effect.

C 29.45 Changes from version 1.61.03 to version 1.62

New features:

  1. Elements for hypothetical bodies that move around the Earth (e.g. Selena/White Moon) can be added to the file seorbel.txt.

  2. The software will be able to read asteroid files > 55535.

Bug fixes:

  1. error in geocentric planetary descending nodes fixed
  1. swe_calc() now allows hypothetical planets beyond SE_FICT_OFFSET + 15

  2. position of hypothetical planets slightly corrected (< 0.01 arc second)

C 29.46 Changes from version 1.61 to 1.61.01

New features:

  1. swe_houses and swe_houses_armc now supports the Alcabitus house system. The function swe_house_pos() does not yet, because we wanted to release quickly on user request.

C 29.47 Changes from version 1.60 to 1.61

New features:

  1. Function swe_rise_trans(): Risings and settings also for disc center and without refraction
  1. “topocentric” house system added to swe_houses() and other house-related functions

  2. Hypothetical planets (seorbel.txt), orbital elements with t terms are possible now (e.g. for Vulcan according to L.H. Weston)

C 29.48 Changes from version 1.51 to 1.60

New features:

  1. Universal time functions swe_calc_ut(), swe_fixstar_ut(), etc.
  1. Planetary nodes, perihelia, aphelia, focal points.

  2. Risings, settings, and meridian transits of the Moon, planets, asteroids, and stars.

  3. Horizontal coordinates (azimuth and altitude).

  4. Refraction.

  5. User-definable orbital elements.

  6. Asteroid names can be updated by user.

  7. Hitherto missing "Personal Sensitive Points" according to M. Munkasey.

Minor bug fixes:

C 29.49 Changes from version 1.50 to 1.51

Minor bug fixes:

C 29.50 Changes from version 1.40 to 1.50

New: SIDEREAL planetary and house position.

The fixed star file fixstars.cat has been improved and enlarged by Valentin Abramov, Tartu, Estonia.

Stars have been ordered by constellation. Many names and alternative spellings have been added.

Minor bug fix in solar eclipse functions, sometimes relevant in border-line cases annular/total, partial/total.

J2000 coordinates for the lunar nodes were redefined: In versions before 1.50, the J2000 lunar nodes were the intersection points of the lunar orbit with the ecliptic of 2000. From 1.50 on, they are defined as the intersection points with the ecliptic of date, referred to the coordinate system of the ecliptic of J2000.

C 29.51 Changes from version 1.31 to 1.40

New: Function for several planetary phenomena added

Bug fix in swe_sol_ecl_when_glob(). The time for maximum eclipse at local apparent noon (tret[1]) was sometimes wrong. When called from VB5, the program crashed.

C 29.52 Changes from version 1.30 to 1.31

New: Eclipse functions added.

Minor bug fix: with previous versions, the function swe_get_planet_name() got the name wrong, if it was an asteroid name and consisted of two or more words (e.g. Van Gogh)

C 29.53 Changes from version 1.27 to 1.30

The time range of the Swiss Ephemeris has been extended by numerical integration. The Swiss Ephemeris now covers the period 2 Jan 5401 BCE to 31 Dec 5399 CE. To use the extended time range, the appropriate ephemeris files must be downloaded.

In the JPL mode and the Moshier mode the time range remains unchanged at 3000 BCE to 3000 CE.

IMPORTANT

Chiron’s ephemeris is now restricted to the time range 650 CE – 4650 CE; for explanations, see swisseph3.pdf.

Outside this time range, Swiss Ephemeris returns an error code and a position value 0. You must handle this situation in your application. There is a similar restriction with Pholus (as with some other asteroids).

C 29.54 Changes from version 1.26 to 1.27

The environment variable SE_EPHE_PATH is now always overriding the call to swe_set_ephe_path() if it is set and contains a value.

Both the environment variable and the function argument can now contain a list of directory names where the ephemeris files are looked for. Before this release, they could contain only a single directory name.

C 29.55 Changes from version 1.25 to 1.26

C 29.56 Changes from version 1.22 to 1.23

C 29.57 Changes from version 1.21 to 1.22

C 29.58 Changes from version 1.20 to 1.21

Sample program and function declarations for Delphi 1.0 added.

C 29.59 Changes from version 1.11 to 1.20

New:

C 29.60 Changes from version 1.10 to 1.11

No bug fix, but two minor improvements:

C 29.61 Changes from version 1.04 to 1.10

C 29.62 Changes from Version 1.03 to 1.04

Attention: Use these files only with the new DLL. Previous versions cannot deal with more than one additional asteroid besides the main asteroids. This error did not appear so far, because only 433 Eros was on our CD-ROM.

C 29.63 Changes from Version 1.02 to 1.03

C 29.64 Changes from Version 1.01 to 1.02

C 29.65 Changes from Version 1.00 to 1.01

29.65.1 Sidereal time

The computation of the sidereal time is now much easier. The obliquity and nutation are now computed inside the function. The structure of the function swe_sidtime() has been changed as follows:

/* sidereal time */

double swe_sidtime(double tjd_ut); /* Julian day number, UT */

The old functions swe_sidtime0() has been kept for backward compatibility.

29.65.2 Houses

The calculation of houses has been simplified as well. Moreover, the Vertex has been added.

The version 1.01 structure of swe_houses() is:

int swe_houses(
      double tjd_ut, /* Julian day number, UT */
      double geolat, /* geographic latitude, in degrees */
      double geolon, /* geographic longitude, in degrees */
      char hsys, /* house method, one of the letters PKRCAV */
      double *asc, /* address for ascendant */
      double *mc, /* address for mc */
      double *armc, /* address for armc */
      double *vertex, /* address for vertex */
      double *cusps); /* address for 13 doubles: 1 empty + 12 houses */

Note also, that the indices of the cusps have changed:

etc.

29.65.3 Ecliptic obliquity and nutation

The new pseudo-body SE_ECL_NUT replaces the two separate pseudo-bodies SE_ECLIPTIC and SE_NUTATION in the function swe_calc().

C 30 What is not contained in SE?

There are some important limits in regard to what you can expect from an ephemeris module. We do not tell you:

C 31 Index

FlagBody, point
DEFAULT EPHEMERIS FLAGADDITIONAL ASTEROIDS
EPHEMERIS FLAGSFICTITIOUS PLANETS
FLAG BITSFIND A NAME
SPEED FLAGHOW TO COMPUTE
SPECIAL BODY SE_ECL_NUT
URANIAN PLANETS
PositionWhat is …How to …
ASTROMETRICAYANAMSHACHANGE THE TIDAL ACCELERATION
BARYCENTRICDYNAMICAL TIMECOMPUTE SIDEREAL COMPOSITE HOUSE CUSPS
EQUATORIALEPHEMERIS TIMECOMPUTE THE COMPOSITE ECLIPTIC OBLIQUITY
HELIOCENTRICEQUATION OF TIMEDRAW THE ECLIPSE PATH
J2000JULIAN DAYGET OBLIQUITY AND NUTATION
POSITION AND SPEEDUNIVERSAL TIMEGET THE UMBRA/PENUMBRA LIMITS
RADIANS/DEGREESVERTEX/ANTIVERTEXSEARCH FOR A STAR
SIDEREALSWITCH THE COORDINATE SYSTEMS
TOPOCENTRICSWITCH TRUE/MEAN EQUINOX OF DATE
TRUE GEOMETRICAL POSITION
TRUE/APPARENT
X, Y, Z
VariablesErrors
ARMCASTEROIDS
ASCMC[...]AVOIDING KOCH HOUSES
ATPRESSEPHEMERIS PATH LENGTH
ATTEMPERRORS AND RETURN VALUES
AYAN_T0FATAL ERROR
CUSPS[...]HOUSE CUSPS BEYOND THE POLAR CIRCLE
EPSKOCH HOUSES LIMITATIONS
GREGFLAGSPEEDS OF THE FIXED STARS
HSYS
IFLAG
IPL
METHOD
RSMI
SID_MODE
STAR
No.FunctionDescription
1swe_azaltcomputes the horizontal coordinates (azimuth and altitude)
2swe_azalt_revcomputes either ecliptical or equatorial coordinates from azimuth and true altitude
3swe_calccomputes the positions of planets, asteroids, lunar nodes and apogees
4swe_calc_utmodified version of swe_calc
5swe_closereleases most resources used by the Swiss Ephemeris
6swe_cotranscoordinate transformation, from ecliptic to equator or vice-versa
7swe_cotrans_spcoordinate transformation of position and speed, from ecliptic to equator or vice-versa
8swe_date_conversioncomputes a Julian day from year, month, day, time and checks whether a date is legal
9swe_degnormnormalization of any degree number to the range 0 ... 360
10swe_deltatcomputes the difference between Universal Time (UT, GMT) and Ephemeris time
11swe_fixstarcomputes fixed stars
12swe_fixstar_utmodified version of swe_fixstar
13swe_get_ayanamsacomputes the ayanamsha
14swe_get_ayanamsa_utmodified version of swe_get_ayanamsa
15swe_get_planet_namefinds a planetary or asteroid name by given number
16swe_get_tid_accgets the tidal acceleration
17swe_heliacal_utcompute heliacal risings etc. of a planet or star
18swe_house_poscompute the house position of a given body for a given ARMC
19swe_housescalculates houses for a given date and geographic position
20swe_houses_armccomputes houses from ARMC (e.g. with the composite horoscope which has no date)
21swe_houses_exthe same as swe_houses(). Has a parameter, which can be used, if sidereal house positions are wanted
22swe_jdet_to_utcconverts JD (ET/TT) to UTC
23swe_jdut1_to_utcconverts JD (UT1) to UTC
24swe_juldayconversion from day, month, year, time to Julian date
25swe_lat_to_lmtconverts local apparent time (LAT) to local mean time (LMT)
26swe_lmt_to_latconverts local mean time (LMT) to local apparent time (LAT)
27swe_lun_eclipse_howcomputes the attributes of a lunar eclipse at a given time
28swe_lun_eclipse_whenfinds the next lunar eclipse
29swe_lun_eclipse_when_locfinds the next lunar eclipse observable from a geographic location
30swe_nod_apscomputes planetary nodes and apsides: perihelia, aphelia, second focal points of the orbital ellipses
31swe_nod_aps_utmodified version of swe_nod_aps
32swe_phenocomputes phase, phase angle, elongation, apparent diameter, apparent magnitude
33swe_pheno_utmodified version of swe_pheno
34swe_refracthe true/apparent altitude conversion
35swe_refrac_extendedthe true/apparent altitude conversion
36swe_revjulconversion from Julian date to day, month, year, time
37swe_rise_transcomputes the times of rising, setting and meridian transits
38swe_rise_trans_true_horcomputes the times of rising, setting and meridian transits relative to true horizon
39swe_set_ephe_pathset application’s own ephemeris path
40swe_set_jpl_filesets JPL ephemeris directory path
41swe_set_sid_modespecifies the sidereal modes
42swe_set_tid_accsets tidal acceleration used in swe_deltat()
43swe_set_toposets what geographic position is to be used before topocentric planet positions for a certain birth place can be computed
44swe_sidtimereturns sidereal time on Julian day
45swe_sidtime0returns sidereal time on Julian day, obliquity and nutation
46swe_sol_eclipse_howcalculates the solar eclipse attributes for a given geographic position and time
47swe_sol_eclipse_when_globfinds the next solar eclipse globally
48swe_sol_eclipse_when_locfinds the next solar eclipse for a given geographic position
49swe_sol_eclipse_wherefinds out the geographic position where an eclipse is central or maximal
50swe_time_equreturns the difference between local apparent and local mean time
51swe_utc_time_zoneconverts UTC int time zone time
52swe_versionreturns the version of the Swiss Ephemeris
53swe_vis_limit_magcalculates the magnitude for an object to be visible
PlaCalc functionDescription
swe_csnormnormalize argument into interval [0..DEG360]
swe_cs2degstrcentiseconds -> degrees string
swe_cs2lonlatstrcentiseconds -> longitude or latitude string
swe_cs2timestrcentiseconds -> time string
swe_csroundsecround second, but at 29.5959 always down
swe_d2ldouble to long with rounding, no overflow check
swe_day_of_weekday of week Monday = 0, ... Sunday = 6
swe_difcs2ndistance in centisecs p1 – p2 normalized to [-180..180]
swe_difcsndistance in centisecs p1 – p2 normalized to [0..360]
swe_difdeg2ndistance in degrees
swe_difdegndistance in degrees

End of swephprg3.pdf