# The ANSI C language version of the software for accessing JPL planetary ephemerides.

All suggestions, bug reports or questions should be sent directly to the author:
Piotr A. Dybczyński, (dybol@amu.edu.pl)
Please send me a word if you use my software with success also.

## Release 1.6, April 18, 2021

I have learned recently (the spring 2021) that the FTP protocol has been depreciated in many popular web browsers so I decided to put the necessary files available for download directly from this page (but our FTP server is still working and this new release is available there).

### There are two important changes in this software since the release 1.5:

1. In the jplbin.h file the definitions for DE440 and DE441 were added.
2. I have revived the old asc2eph.c program for two reasons:
1. there were no binary files at the JPL server when I started to use the DE440 ephemeris. Happily now the Linux binary files are available.
2. binary ephemeris files are now very large so a user might wish to create smaller ephemeris, covering some sub-interval.

I have added several new definitions to the end of the jplbih.h file to allow asc2eph.c program to work with different ephemeris versions.

According to my tests this software works correctly on both 64 bit and 32 bit Linux systems. The tests were performed under Debian 10 with the default gcc version (8.3.0).

## Release 1.5, March 25, 2020

The only important change is in jplbin.h file. Explicit rules for packing structures were added because of some changes in the default gcc behavior.

As a result this software works correctly both on 64 bit and 32 bit Linux systems.

In the testeph.c file the usage of 'long int' has been abandoned since it is identical with 'int' with current releases of the gcc compiler.

## Release 1.4, March 13, 2014

Release (1.4) works with DE200, DE403, DE404, DE405, DE406, DE421, DE422, DE430 and DE431.

CHANGES FROM RELEASE 1.3:

added support for DE430 and DE431. The main change is to allow for more than 400 ephemeris constants, as required in case of DE430 and DE431. Some minor improvements are also done. Works in a standard, 32-bit Linux environment.

The original JPL data files, FORTRAN code and documentation can be found at:

http://ssd.jpl.nasa.gov/?planet_eph_export

## Release 1.3, February 19, 2012

Release (1.3) works with DE200, DE403, DE404, DE405, DE406, DE421 and DE422.

CHANGES FROM RELEASE 1.2:

added support for DE421 and DE422. In fact only some definitions were added to the jplbin.h header file. The testeph.c file is a copy of that file from version 1.2. Only the formulas for calculating the differences between test points and calculated values are updated in accordance with the JPL Fortran file testeph.f . All other sources and files are obsolete, since Linux binary ephemerides can be obtained from JPL.

## Release 1.2, June 23, 1997 (this README.txt file was updated March 1, 2008)

File list at the FTP server:

   Size   date     time   file
10218 2007-04-20 10:38 asc2eph.c
6405 2007-04-20 10:38 conv.c
9098 2007-04-20 10:38 convm.c
1892 2007-04-20 10:39 jplbin.h
33421 2007-04-20 10:39 testeph.c
409808 1998-06-03 00:00 testpo1.405


CHANGES FROM RELEASE 1.1:

• added support for DE405 and DE406,
• ASC2EPH.C can work with incomplete source file set,
• added CONVM.C - new program for converting and merging multiple binary files,
• bug in libration calculations fixed,
• some minor changes and bug fixes

 The original JPL data files, FORTRAN code and documentation can be found at:
http://ssd.jpl.nasa.gov/?planet_eph_export


This release (1.2) works with DE200, DE403, DE404, DE405 and DE406.

This file describes public domain software for using and manipulating JPL export planetary ephemerides, written in C language.

In original JPL export packages you can find several FORTRAN source files for reading and testing ephemerides.

Here you can find C versions of ASC2EPH and TESTEPH programs and additional two programs: CONV and CONVM, for converting original JPL supplied Unix binary files to DOS/LINUX binaries, without using any additional source files. Please note, that we assume you do not rename any of the original, JPL supplied files.

ASC2EPH.C and TESTEPH.C are manual translations of the original JPL FORTRAN code, slightly changed and adapted for C language. They are designed to keep FORTRAN-based structure of the binary ephemeris files so they can be shared between C and Fortran programmers working both under DOS and LINUX on PC-based machines. ASC2EPH uses original JPL supplied source (ASCII) ephemeris files. There is no need for editing them to replace 'D' with 'E' in exponent parts of double precision numbers.

IT IS NECESSARY TO ADJUST MANUALLY SOURCE FILES before you compile and run them. First, look at the file: JPLBIN.H, used by ASC2EPH.c and TESTEPH.C It contains the definition of DENUM, JPL ephemeris number. Some variables obtain their values depending on DENUM (eg. RECSIZE - the record size ). Second, look at lines with fopen() calls in ASC2EPH.C, TESTEPH.C and CONV.C Adjust them for your environment, adding a path before filenames where necessary.

Program CONV.C is an additional tool for obtaining DOS/LINUX, FORTRAN/C binary files with JPL ephemerides DIRECTLY from JPL supplied binary Unix files (*.unx). It simply reverses the order of bytes in each integer (4 byte) and double (8 byte) number stored in the single JPL Unix binary file found on the original CD-ROM for example. Additionally it can produce the subset of the whole ephemeris - you have to specify starting and final JED epochs.

New program (release 1.2): CONVM.C is designed for simultaneous merging and converting original JPL supplied binary UNIX files (you can obtain them from an anonymous FTP site: ftp://ssd.jpl.nasa.gov/pub/eph/planets ) into a single, binary ephemeris file, readable with FORTRAN and C under both DOS and Linux. It works similarly to CONV.C. You can specify smaller interval of time than the original ephemeris time span.

All source files are rich of comments and ( I hope ) therefore are self explanatory.

On July 8, 1997 JPL released corrected file TESTPO.405, without fictitious "test points" for 5-th and 6-th components of nutation. You can find this file at: ftp://ssd.jpl.nasa.gov/pub/eph/planets/test-data. There is a new file: testpo.406 there!

PLEASE NOTE that due to including of nutation and librations in the test points file (GREAT!) you can expect differences greater than 1.0e-13 when using TESTEPH program. Some values of librations have more than three digits before decimal point and we do not have 17 significant digits on PC-based machines! JPL have changed (June 23 version of TESTEPH.F) the formula for the difference calculation from absolute (del = |xc-xo|) to relative: del = |xc-xo|/(|xc|+|xo|). I have applied this correction in my software and found that now almost all del values are greater than 1e-13, generating software alert. So I decided to comment out this modification. Instead I used the old formula and I found that for all points in TESTPO.405 I have obtained del < 1e-13. This happened even for libration value for JD=2524897.5: 19440.0251465376386. My calculated value was: 19440.0251465376386 ! I have 18 correct significant digits ! I have not switched to long double type, I still use standard 8 byte double precision arithmetic .

All suggestions, bug reports or questions may be directed to the author:

Piotr A. Dybczyński, (dybol@amu.edu.pl)

Please send me a word if you use my software with success also.