├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── run-tests.yml ├── .gitignore ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE.md ├── README.md ├── build-se ├── config.m4 ├── doc ├── doc.html └── doc.md ├── example └── example.php ├── php_swephp.h ├── sweph ├── doc │ ├── README.md │ ├── media │ │ ├── image1.png │ │ ├── image10.png │ │ ├── image11.png │ │ ├── image12.png │ │ ├── image13.png │ │ ├── image14.png │ │ ├── image15.png │ │ ├── image16.png │ │ ├── image17.png │ │ ├── image18.png │ │ ├── image19.png │ │ ├── image2.png │ │ ├── image20.png │ │ ├── image21.png │ │ ├── image22.png │ │ ├── image23.png │ │ ├── image24.png │ │ ├── image25.png │ │ ├── image26.png │ │ ├── image27.png │ │ ├── image28.png │ │ ├── image29.png │ │ ├── image3.png │ │ ├── image30.png │ │ ├── image31.png │ │ ├── image32.png │ │ ├── image33.png │ │ ├── image34.png │ │ ├── image35.png │ │ ├── image36.png │ │ ├── image37.jpeg │ │ ├── image38.png │ │ ├── image39.png │ │ ├── image4.png │ │ ├── image40.png │ │ ├── image5.png │ │ ├── image6.png │ │ ├── image7.png │ │ ├── image8.png │ │ └── image9.png │ ├── swephprg.md │ ├── swephprg.pdf │ ├── swisseph.htm │ ├── swisseph.md │ ├── swisseph.pdf │ └── template.htm ├── ephe │ ├── seas_18.se1 │ ├── sefstars.txt │ ├── semo_18.se1 │ └── sepl_18.se1 └── src │ ├── LICENSE │ ├── LICENSE.TXT │ ├── Makefile │ ├── agpl-3.0.txt │ ├── sefstars.txt │ ├── seleapsec.txt │ ├── seorbel.txt │ ├── sweasp.c │ ├── swecl.c │ ├── sweclips.c │ ├── swedate.c │ ├── swedate.h │ ├── swedll.h │ ├── sweephe4.c │ ├── sweephe4.h │ ├── swehel.c │ ├── swehouse.c │ ├── swehouse.h │ ├── swejpl.c │ ├── swejpl.h │ ├── swemini.c │ ├── swemmoon.c │ ├── swemplan.c │ ├── swemptab.h │ ├── swenut2000a.h │ ├── sweodef.h │ ├── sweph.c │ ├── sweph.h │ ├── swephexp.h │ ├── swephgen4.c │ ├── swephlib.c │ ├── swephlib.h │ ├── swetest.c │ ├── swevents.c │ └── swevents.h ├── swephp.c ├── swephp.stub.php ├── swephp_arginfo.h ├── swephp_legacy_arginfo.h ├── tests ├── perl_test.phpt ├── swe_azalt_refrac.phpt ├── swe_calc.phpt ├── swe_calc_pctr.phpt ├── swe_calc_ut.phpt ├── swe_close.phpt ├── swe_cotrans.phpt ├── swe_cotrans_sp.phpt ├── swe_cs2degstr.phpt ├── swe_cs2lonlatstr.phpt ├── swe_cs2timestr.phpt ├── swe_csnorm.phpt ├── swe_csroundsec.phpt ├── swe_d2l.phpt ├── swe_date_conversion_invalid.phpt ├── swe_date_conversion_valid.phpt ├── swe_day_of_week.phpt ├── swe_deg_midp.phpt ├── swe_degnorm.phpt ├── swe_deltat.phpt ├── swe_deltat_ex.phpt ├── swe_difcs2n.phpt ├── swe_difcsn.phpt ├── swe_difdeg2n.phpt ├── swe_difdegn.phpt ├── swe_difrad2n.phpt ├── swe_fixstar.phpt ├── swe_fixstar_overrun.phpt ├── swe_gauquelin_sector.phpt ├── swe_get_ayanamsa.phpt ├── swe_get_ayanamsa_ex.phpt ├── swe_get_ayanamsa_ex_ut.phpt ├── swe_get_ayanamsa_name.phpt ├── swe_get_ayanamsa_ut.phpt ├── swe_get_current_file_data.phpt ├── swe_get_library_path.phpt ├── swe_get_planet_name.phpt ├── swe_heliacal_pheno_ut.phpt ├── swe_heliacal_ut.phpt ├── swe_helio_cross.phpt ├── swe_house_name.phpt ├── swe_houses.phpt ├── swe_houses_armc.phpt ├── swe_houses_armc_ex2.phpt ├── swe_houses_ex.phpt ├── swe_houses_ex2.phpt ├── swe_houses_pos.phpt ├── swe_jdet_to_utc.phpt ├── swe_jdut1_to_utc.phpt ├── swe_julday.phpt ├── swe_lat_to_lmt.phpt ├── swe_lmt_to_lat.phpt ├── swe_lun_eclipse.phpt ├── swe_lun_occult.phpt ├── swe_mooncross.phpt ├── swe_mooncross_node.phpt ├── swe_nod_aps.phpt ├── swe_pheno.phpt ├── swe_rad_midp.phpt ├── swe_radnorm.phpt ├── swe_revjul.phpt ├── swe_rise_trans_etc.phpt ├── swe_set_delta_t_userdef.phpt ├── swe_set_ephe_path.phpt ├── swe_set_ephe_path_null.phpt ├── swe_set_jpl_file.phpt ├── swe_set_sid_mode.phpt ├── swe_set_topo.phpt ├── swe_sidtime.phpt ├── swe_sidtime0.phpt ├── swe_sol_eclipse.phpt ├── swe_solcross.phpt ├── swe_split_deg.phpt ├── swe_tid_acc.phpt ├── swe_time_equ.phpt ├── swe_utc_time_zone.phpt ├── swe_utc_to_jd.phpt ├── swe_version.phpt └── swe_vis_limit_mag.phpt └── utility └── Format.php /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: run-tests 2 | 3 | on: [push] 4 | 5 | jobs: 6 | make-test: 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout Repository. 16 | uses: actions/checkout@v2 17 | 18 | - name: Install php${{ matrix.php }}-dev. 19 | run: | 20 | sudo apt install software-properties-common 21 | sudo add-apt-repository ppa:ondrej/php 22 | sudo apt update 23 | sudo apt install php${{ matrix.php }}-dev 24 | sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} 25 | sudo update-alternatives --set phpize /usr/bin/phpize${{ matrix.php }} 26 | sudo update-alternatives --set php-config /usr/bin/php-config${{ matrix.php }} 27 | 28 | - name: Build Extension. 29 | run: | 30 | phpize 31 | ./configure 32 | make 33 | sudo make install 34 | 35 | - name: Run Tests. 36 | env: 37 | NO_INTERACTION: 1 38 | REPORT_EXIT_STATUS: 1 39 | run: make test 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ / PhpStorm project directory. 2 | .DS_Store 3 | .idea 4 | *.swp 5 | .gdb_history 6 | pod2htmd.tmp 7 | tests/*.php 8 | tests/*.diff 9 | tests/*.exp 10 | tests/*.out 11 | tests/*.log 12 | tests/*.sh 13 | tests/*.swp 14 | sweph/src/*.o 15 | sweph/src/libswe.a 16 | sweph/src/swetest 17 | modules 18 | sweph*.la 19 | sweph*.lo 20 | Mak* 21 | .libs/ 22 | build/ 23 | ac* 24 | auto* 25 | libtool 26 | missing 27 | mk* 28 | run-test* 29 | !.github/workflows/run-tests.yml 30 | !config.m4 31 | config* 32 | install-sh 33 | ltmain.sh 34 | fixtest 35 | utility/PHP-Parser-4.12.0 36 | utility/gen_stub.php 37 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please see README 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-fpm 2 | 3 | LABEL maintainer="Kevin DeCapite" 4 | 5 | RUN apt-get -y update 6 | RUN mkdir /root/php-sweph 7 | 8 | WORKDIR /root/php-sweph 9 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Please see README.md and sweph/src/LICENSE 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Extension for Swiss Ephemeris 2 | 3 | ## Introduction 4 | `php-sweph` is a PHP extension to Astrodienst Swiss Ephemeris library. It's statically linked with libswe.a to implement one-to-one, C-to-PHP function mapping, no external binary executable required. 5 | 6 | ## Compatibility 7 | This extension is tested with PHP versions: 8 | - 7.4 9 | - 8.0 10 | - 8.1 11 | - 8.2 12 | - 8.3 13 | - 8.4 14 | 15 | ## License 16 | `php-sweph` is work derived from the original release of the Astrodienst Swiss Ephemeris library. 17 | To use `php-sweph`, the licensing conditions imposed by Astrodienst for Swiss Ephemeris must 18 | be fulfilled. A copy of the license file 19 | is found in `sweph/src/LICENSE`. Please note: since Swiss Ephemeris release 2.10.01 the GPL license has been 20 | replaced with the AGPL license, as one of the options in Astrodienst's dual licensing model. 21 | 22 | ## Installation 23 | 24 | This project uses tagged releases. 25 | As such, the `master` branch should be considered unstable and "bleeding edge". 26 | 27 | Follow the steps to build the latest version of this extension. 28 | Make sure `php-dev` has installed already. 29 | 30 | _If you are on a Mac and use or want to use Homebrew, please see:_ 31 | [Installation on macOS Big Sur](https://github.com/cyjoelchen/php-sweph/wiki/Install-on-macOS-Big-Sur.) 32 | 33 | ``` 34 | git clone -b 4.0.11 https://github.com/cyjoelchen/php-sweph.git 35 | cd php-sweph 36 | phpize 37 | ./configure 38 | make 39 | sudo make install 40 | ``` 41 | 42 | Add `extension=swephp.so` to php.ini. In my case (nginx + php-fpm), it's located in `/etc/php/7.0/fpm/php.ini`. Reload php-fpm to make it take effect. 43 | 44 | Now you should able to see swephp section from `phpinfo()`. 45 | 46 | swephp support | enabled 47 | ---|--- 48 | library (libswe.a) version | 2.10.03 49 | default ephemeris file path | .:/users/ephe2/:/users/ephe/ 50 | 51 | You are all set! 52 | 53 | ## Troubleshooting 54 | Please see the Wiki for additional details on troubleshooting the installation of this extension: 55 | - https://github.com/cyjoelchen/php-sweph/wiki 56 | 57 | ## PhpStorm IDE Support 58 | A plugin repository is maintained for this extension, allowing auto-complete and static analysis in PhpStorm for all Swiss Ephemeris methods: 59 | 60 | https://github.com/arcpointgroup/phpstorm-library-plugin 61 | 62 | ## Contributing 63 | 64 | ### If you have collaborator access on this project: 65 | 66 | 1. Open an issue in Github, explaining the work requirements. 67 | 2. Locally, `git pull origin master` to bring your local master branch up to date. 68 | 3. Locally, `git checkout -b issue/` to create a new working branch. 69 | 4. After your commits are finished, `git push origin issue/` to push this branch to Github. 70 | 5. Create a PR from the Github web interface, or from the link git displays after your initial branch push. 71 | 6. Assign a different collaborator the task of reviewing the work. 72 | 7. Once approved, the author of the PR can merge into master and delete the branch. 73 | 74 | ### If you are not a collaborator on this project: 75 | 76 | Contributions are welcome! If you'd like to contribute, please: 77 | 78 | 1. Fork the project & clone locally. 79 | 2. Create an upstream remote and sync your local copy before you branch. 80 | 3. Create an issue for the work you plan to contribute, or select an issue you want to work on. 81 | 4. Branch for each separate piece of work (ideally named according to the issue). 82 | 5. Do the work, __write good commit messages__, and keep your commits small (i.e. as atomic as possible). 83 | 6. Push to your origin repository. 84 | 7. Create a new PR in GitHub. 85 | 8. Respond to any code review feedback. 86 | 87 | ## Inline documentation 88 | The source code for this extension contains inline documentation in POD style, 89 | which comes from the Perl programming language. 90 | 91 | You can view the inline documentation, if you have Perl installed, with this command: 92 | 93 | perldoc swephp.c 94 | 95 | To create a html documentation page, use this command: 96 | 97 | pod2html swephp.c > php-sweph-doc.html 98 | 99 | _Documentation is included in this repository here:_ 100 | ``` 101 | /doc/doc.html 102 | /doc/doc.md 103 | ``` 104 | [Read it here on GitHub »](https://github.com/cyjoelchen/php-sweph/blob/master/doc/doc.md) 105 | 106 | ## Example 107 | 108 | ```php 109 | $xx['rc'], 'message' => $xx['serr']); 127 | continue; 128 | } 129 | 130 | $planets[$i] = array( 131 | 'name' => swe_get_planet_name($i), 132 | 'lng' => $xx[0], 133 | 'lat' => $xx[1], 134 | 'speed' => $xx[3] 135 | ); 136 | } 137 | 138 | $out = ['planets' => json_encode($planets, JSON_PRETTY_PRINT)]; 139 | 140 | # calc house cusps 141 | define("GEO_LNG", 121.5); 142 | define("GEO_LAT", 25.05); // Taipei, Taiwan: 121E30, 25N03 143 | 144 | $yy = swe_houses($jul_ut, GEO_LAT, GEO_LNG, "P"); // P = Placidus. 145 | 146 | $houses = array(); 147 | 148 | for($i = 1; $i <= 12; $i ++) 149 | { 150 | $houses[$i] = array('lng' => $yy['cusps'][$i]); 151 | } 152 | 153 | $out['houses'] = json_encode($houses, JSON_PRETTY_PRINT); 154 | 155 | echo '
';
156 | var_dump($out);
157 | echo '
'; 158 | ``` 159 | 160 | Functions can also be tested and executed directly from the command line: 161 | ``` 162 | php -r '$jd=swe_julday(2002, 1, 1, 0, 1);var_dump(swe_calc_ut($jd,SE_SUN,SEFLG_SPEED));' 163 | 164 | output: 165 | array(8) { 166 | [0]=> 167 | float(280.38372636858) 168 | [1]=> 169 | float(0.00014970535610325) 170 | [2]=> 171 | float(0.98329783154375) 172 | [3]=> 173 | float(1.0188772684611) 174 | [4]=> 175 | float(1.7224710342829E-5) 176 | [5]=> 177 | float(-1.0215998283642E-5) 178 | ["serr"]=> 179 | string(0) "" 180 | ["rc"]=> 181 | int(258) 182 | } 183 | ``` 184 | 185 | ## Development 186 | 187 | This repository ships with a simple Docker setup for easy development. 188 | Setup your local environment for iterative testing: 189 | 190 | ``` 191 | > docker build -t php_sweph . 192 | > docker run --rm --name php-sweph -dit -v ${PWD}:/root/php-sweph php_sweph 193 | ``` 194 | 195 | _The container `php-sweph` will run in the background._ 196 | 197 | The easiest way to build and test is to start an interactive terminal: 198 | 199 | ``` 200 | > docker exec -it php-sweph bash 201 | > ./build-se 202 | ``` 203 | 204 | The `build-se` bash script will compile the PHP extension and install it for you. 205 | Run tests from the PHP command line via `php -a`. 206 | Repeat `build-se` execution runs as needed. 207 | 208 | When you're finished, exit the container[1]: 209 | 210 | ``` 211 | > exit 212 | > docker stop php-sweph 213 | ``` 214 | [1] 215 | _If you started the container with the command above (i.e. by including the `--rm` switch), 216 | the container will be removed automatically._ 217 | -------------------------------------------------------------------------------- /build-se: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | phpize && \ 4 | ./configure && \ 5 | make && \ 6 | make install && \ 7 | echo "extension=swephp.so" > /usr/local/etc/php/conf.d/swephp.ini && \ 8 | yes n | make test && \ 9 | phpize --clean && \ 10 | rm -f sweph/src/libswe.a && \ 11 | rm -f sweph/src/*.o && \ 12 | rm -f swephp.dep && \ 13 | rm -rf include 14 | -------------------------------------------------------------------------------- /config.m4: -------------------------------------------------------------------------------- 1 | dnl $Id$ 2 | dnl config.m4 for extension swephp 3 | 4 | dnl Comments in this file start with the string 'dnl'. 5 | dnl Remove where necessary. This file will not work 6 | dnl without editing. 7 | 8 | dnl If your extension references something external, use with: 9 | 10 | PHP_ARG_WITH(sweph, for libswe support, 11 | dnl Make sure that the comment is aligned: 12 | [ --with-sweph[=DIR] Include sweph support]) 13 | 14 | dnl Otherwise use enable: 15 | 16 | dnl PHP_ARG_ENABLE(sweph, whether to enable sweph support, 17 | dnl [ --enable-sweph Enable sweph support]) 18 | AC_MSG_RESULT(php_swephp: $PHP_SWEPHP) 19 | 20 | if test "$PHP_SWEPH" != "no"; then 21 | if ! test -r sweph/src/libswe.a; then 22 | AC_MSG_RESULT(Building libswe.a) 23 | (cd sweph/src;make libswe.a) 24 | fi 25 | 26 | if test -r sweph/src/libswe.a; then 27 | SWEPH_DIR=sweph/src 28 | AC_MSG_RESULT(libswe.a found in $SWEPH_DIR) 29 | fi 30 | 31 | if test -z "$SWEPH_DIR"; then 32 | AC_MSG_RESULT([not found]) 33 | AC_MSG_ERROR([Please reinstall the sweph distribution]) 34 | fi 35 | 36 | dnl # --with-sweph -> add include path 37 | PHP_ADD_INCLUDE($SWEPH_DIR) 38 | 39 | dnl # --with-sweph -> check for lib and symbol presence 40 | dnl LIBNAME=swe 41 | dnl LIBSYMBOL=swe_calc_u 42 | 43 | 44 | dnl PHP_SUBST(SWEPH_SHARED_LIBADD) 45 | 46 | # remove this... it causes runtime error when running php5 47 | AC_SUBST(LDFLAGS, "-L$SWEPH_DIR -lswe -lm") 48 | PHP_NEW_EXTENSION(swephp, swephp.c, $ext_shared) 49 | fi 50 | -------------------------------------------------------------------------------- /example/example.php: -------------------------------------------------------------------------------- 1 | $xx['rc']); 19 | continue; 20 | } 21 | 22 | $planets[$i] = array( 23 | 'name' => swe_get_planet_name($i), 24 | 'lng' => $xx[0], 25 | 'lat' => $xx[1], 26 | 'speed' => $xx[3] 27 | ); 28 | } 29 | 30 | $out = ['planets' => json_encode($planets, JSON_PRETTY_PRINT)]; 31 | 32 | # calc house cusps 33 | define("GEO_LNG", 121.5); 34 | define("GEO_LAT", 25.05); // Taipei, Taiwan: 121E30, 25N03 35 | 36 | $yy = swe_houses($jul_ut, GEO_LAT, GEO_LNG, "P"); // P = Placidus. 37 | 38 | $houses = array(); 39 | 40 | for($i = 1; $i <= 12; $i ++) 41 | { 42 | $houses[$i] = array('lng' => $yy['cusps'][$i]); 43 | } 44 | 45 | $out['houses'] = json_encode($houses, JSON_PRETTY_PRINT); 46 | 47 | echo '
';
48 | var_dump($out);
49 | echo '
'; 50 | -------------------------------------------------------------------------------- /php_swephp.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | PHP Version 7 Swiss Ephemeris extension | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2007-2021 | 6 | +----------------------------------------------------------------------+ 7 | | Author: Joel Chen | 8 | | Contributor: Alois Treindl 9 | +----------------------------------------------------------------------+ 10 | */ 11 | 12 | #ifndef PHP_SWEPH_H 13 | #define PHP_SWEPH_H 14 | 15 | extern zend_module_entry swephp_module_entry; 16 | #define phpext_swephp_ptr &swephp_module_entry 17 | 18 | #ifdef PHP_WIN32 19 | #define PHP_SWEPH_API __declspec(dllexport) 20 | #else 21 | #define PHP_SWEPH_API 22 | #endif 23 | 24 | #ifdef ZTS 25 | #include "TSRM.h" 26 | #endif 27 | 28 | PHP_MINIT_FUNCTION(swephp); 29 | PHP_MSHUTDOWN_FUNCTION(swephp); 30 | PHP_RINIT_FUNCTION(swephp); 31 | PHP_RSHUTDOWN_FUNCTION(swephp); 32 | PHP_MINFO_FUNCTION(swephp); 33 | 34 | /* Joel - sweph functions */ 35 | 36 | /**************************** 37 | * exports from sweph.c 38 | ****************************/ 39 | PHP_FUNCTION(swe_calc); 40 | PHP_FUNCTION(swe_calc_ut); 41 | PHP_FUNCTION(swe_calc_pctr); 42 | PHP_FUNCTION(swe_solcross); 43 | PHP_FUNCTION(swe_solcross_ut); 44 | PHP_FUNCTION(swe_mooncross); 45 | PHP_FUNCTION(swe_mooncross_ut); 46 | PHP_FUNCTION(swe_mooncross_node); 47 | PHP_FUNCTION(swe_mooncross_node_ut); 48 | PHP_FUNCTION(swe_helio_cross); 49 | PHP_FUNCTION(swe_helio_cross_ut); 50 | PHP_FUNCTION(swe_fixstar); 51 | PHP_FUNCTION(swe_fixstar_ut); 52 | PHP_FUNCTION(swe_fixstar_mag); 53 | PHP_FUNCTION(swe_fixstar2); 54 | PHP_FUNCTION(swe_fixstar2_ut); 55 | PHP_FUNCTION(swe_fixstar2_mag); 56 | PHP_FUNCTION(swe_close); 57 | PHP_FUNCTION(swe_set_ephe_path); 58 | PHP_FUNCTION(swe_set_jpl_file); 59 | PHP_FUNCTION(swe_get_planet_name); 60 | PHP_FUNCTION(swe_set_topo); 61 | PHP_FUNCTION(swe_set_sid_mode); 62 | PHP_FUNCTION(swe_get_ayanamsa); 63 | PHP_FUNCTION(swe_get_ayanamsa_ut); 64 | PHP_FUNCTION(swe_get_ayanamsa_ex); 65 | PHP_FUNCTION(swe_get_ayanamsa_ex_ut); 66 | PHP_FUNCTION(swe_get_ayanamsa_name); 67 | PHP_FUNCTION(swe_version); 68 | PHP_FUNCTION(swe_get_library_path); 69 | PHP_FUNCTION(swe_get_current_file_data); 70 | 71 | /**************************** 72 | * exports from swedate.c 73 | ****************************/ 74 | PHP_FUNCTION(swe_date_conversion); 75 | PHP_FUNCTION(swe_julday); 76 | PHP_FUNCTION(swe_revjul); 77 | PHP_FUNCTION(swe_jdet_to_utc); 78 | PHP_FUNCTION(swe_jdut1_to_utc); 79 | PHP_FUNCTION(swe_utc_to_jd); 80 | PHP_FUNCTION(swe_utc_time_zone); 81 | 82 | 83 | /**************************** 84 | * exports from swehouse.c 85 | ****************************/ 86 | PHP_FUNCTION(swe_houses); 87 | PHP_FUNCTION(swe_houses_ex); 88 | PHP_FUNCTION(swe_houses_ex2); 89 | PHP_FUNCTION(swe_houses_armc); 90 | PHP_FUNCTION(swe_houses_armc_ex2); 91 | PHP_FUNCTION(swe_house_pos); 92 | PHP_FUNCTION(swe_gauquelin_sector); 93 | PHP_FUNCTION(swe_house_name); 94 | 95 | /**************************** 96 | * exports from swecl.c 97 | ****************************/ 98 | 99 | PHP_FUNCTION(swe_sol_eclipse_where); 100 | PHP_FUNCTION(swe_lun_occult_where); 101 | PHP_FUNCTION(swe_sol_eclipse_how); 102 | PHP_FUNCTION(swe_sol_eclipse_when_loc); 103 | PHP_FUNCTION(swe_lun_occult_when_loc); 104 | PHP_FUNCTION(swe_sol_eclipse_when_glob); 105 | PHP_FUNCTION(swe_lun_occult_when_glob); 106 | PHP_FUNCTION(swe_lun_eclipse_how); 107 | PHP_FUNCTION(swe_lun_eclipse_when); 108 | PHP_FUNCTION(swe_lun_eclipse_when_loc); 109 | 110 | /* planetary phenomena */ 111 | PHP_FUNCTION(swe_pheno); 112 | PHP_FUNCTION(swe_pheno_ut); 113 | PHP_FUNCTION(swe_refrac); 114 | PHP_FUNCTION(swe_refrac_extended); 115 | PHP_FUNCTION(swe_azalt); 116 | PHP_FUNCTION(swe_azalt_rev); 117 | PHP_FUNCTION(swe_rise_trans); 118 | PHP_FUNCTION(swe_rise_trans_true_hor); 119 | PHP_FUNCTION(swe_nod_aps); 120 | PHP_FUNCTION(swe_nod_aps_ut); 121 | PHP_FUNCTION(swe_get_orbital_elements); 122 | PHP_FUNCTION(swe_orbit_max_min_true_distance); 123 | PHP_FUNCTION(swe_heliacal_ut); 124 | PHP_FUNCTION(swe_heliacal_pheno_ut); 125 | PHP_FUNCTION(swe_vis_limit_mag); 126 | 127 | /**************************** 128 | * exports from swephlib.c 129 | ****************************/ 130 | PHP_FUNCTION(swe_deltat); 131 | PHP_FUNCTION(swe_deltat_ex); 132 | PHP_FUNCTION(swe_time_equ); 133 | PHP_FUNCTION(swe_lmt_to_lat); 134 | PHP_FUNCTION(swe_lat_to_lmt); 135 | PHP_FUNCTION(swe_sidtime0); 136 | PHP_FUNCTION(swe_sidtime); 137 | PHP_FUNCTION(swe_cotrans); 138 | PHP_FUNCTION(swe_cotrans_sp); 139 | PHP_FUNCTION(swe_get_tid_acc); 140 | PHP_FUNCTION(swe_set_tid_acc); 141 | PHP_FUNCTION(swe_set_delta_t_userdef); 142 | PHP_FUNCTION(swe_degnorm); 143 | PHP_FUNCTION(swe_radnorm); 144 | PHP_FUNCTION(swe_rad_midp); 145 | PHP_FUNCTION(swe_deg_midp); 146 | PHP_FUNCTION(swe_split_deg); 147 | 148 | /******************************************************* 149 | * other functions from swephlib.c; 150 | * they are not needed for Swiss Ephemeris, 151 | * but may be useful to former Placalc users. 152 | ********************************************************/ 153 | PHP_FUNCTION(swe_csnorm); 154 | PHP_FUNCTION(swe_difcsn); 155 | PHP_FUNCTION(swe_difdegn); 156 | PHP_FUNCTION(swe_difcs2n); 157 | PHP_FUNCTION(swe_difdeg2n); 158 | PHP_FUNCTION(swe_difrad2n); 159 | PHP_FUNCTION(swe_csroundsec); 160 | PHP_FUNCTION(swe_d2l); 161 | PHP_FUNCTION(swe_day_of_week); 162 | PHP_FUNCTION(swe_cs2timestr); 163 | PHP_FUNCTION(swe_cs2lonlatstr); 164 | PHP_FUNCTION(swe_cs2degstr); 165 | 166 | 167 | PHP_FUNCTION(confirm_sweph_compiled); /* For testing, remove later. */ 168 | 169 | /* 170 | Declare any global variables you may need between the BEGIN 171 | and END macros here: 172 | 173 | ZEND_BEGIN_MODULE_GLOBALS(swephp) 174 | long global_value; 175 | char *global_string; 176 | ZEND_END_MODULE_GLOBALS(swephp) 177 | */ 178 | 179 | /* In every utility function you add that needs to use variables 180 | in php_swephp_globals, call TSRMLS_FETCH(); after declaring other 181 | variables used by that function, or better yet, pass in TSRMLS_CC 182 | after the last function argument and declare your utility function 183 | with TSRMLS_DC after the last declared argument. Always refer to 184 | the globals in your function as SWEPH_G(variable). You are 185 | encouraged to rename these macros something shorter, see 186 | examples in any other php module directory. 187 | */ 188 | 189 | #ifdef ZTS 190 | #define SWEPH_G(v) TSRMG(swephp_globals_id, zend_swephp_globals *, v) 191 | #else 192 | #define SWEPH_G(v) (swephp_globals.v) 193 | #endif 194 | 195 | #endif /* PHP_SWEPH_H */ 196 | 197 | 198 | /* 199 | * Local variables: 200 | * tab-width: 4 201 | * c-basic-offset: 4 202 | * indent-tabs-mode: t 203 | * End: 204 | */ 205 | -------------------------------------------------------------------------------- /sweph/doc/README.md: -------------------------------------------------------------------------------- 1 | ## Please note: 2 | The official Swiss Ephemeris documentation is found at https://www.astro.com/ftp/swisseph/doc/ 3 | 4 | The documentation on Github is in an experimental stage. 5 | 6 | We are in process of moving from MS-Word files to Markdown files for easier maintenance 7 | of the documentation, but the transition is far from complete. 8 | 9 | The PDF and HTM files you find in this directory have been automatically created 10 | out of the .md files. See makefile for details of this process. 11 | 12 | -------------------------------------------------------------------------------- /sweph/doc/media/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image1.png -------------------------------------------------------------------------------- /sweph/doc/media/image10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image10.png -------------------------------------------------------------------------------- /sweph/doc/media/image11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image11.png -------------------------------------------------------------------------------- /sweph/doc/media/image12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image12.png -------------------------------------------------------------------------------- /sweph/doc/media/image13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image13.png -------------------------------------------------------------------------------- /sweph/doc/media/image14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image14.png -------------------------------------------------------------------------------- /sweph/doc/media/image15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image15.png -------------------------------------------------------------------------------- /sweph/doc/media/image16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image16.png -------------------------------------------------------------------------------- /sweph/doc/media/image17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image17.png -------------------------------------------------------------------------------- /sweph/doc/media/image18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image18.png -------------------------------------------------------------------------------- /sweph/doc/media/image19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image19.png -------------------------------------------------------------------------------- /sweph/doc/media/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image2.png -------------------------------------------------------------------------------- /sweph/doc/media/image20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image20.png -------------------------------------------------------------------------------- /sweph/doc/media/image21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image21.png -------------------------------------------------------------------------------- /sweph/doc/media/image22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image22.png -------------------------------------------------------------------------------- /sweph/doc/media/image23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image23.png -------------------------------------------------------------------------------- /sweph/doc/media/image24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image24.png -------------------------------------------------------------------------------- /sweph/doc/media/image25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image25.png -------------------------------------------------------------------------------- /sweph/doc/media/image26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image26.png -------------------------------------------------------------------------------- /sweph/doc/media/image27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image27.png -------------------------------------------------------------------------------- /sweph/doc/media/image28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image28.png -------------------------------------------------------------------------------- /sweph/doc/media/image29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image29.png -------------------------------------------------------------------------------- /sweph/doc/media/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image3.png -------------------------------------------------------------------------------- /sweph/doc/media/image30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image30.png -------------------------------------------------------------------------------- /sweph/doc/media/image31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image31.png -------------------------------------------------------------------------------- /sweph/doc/media/image32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image32.png -------------------------------------------------------------------------------- /sweph/doc/media/image33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image33.png -------------------------------------------------------------------------------- /sweph/doc/media/image34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image34.png -------------------------------------------------------------------------------- /sweph/doc/media/image35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image35.png -------------------------------------------------------------------------------- /sweph/doc/media/image36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image36.png -------------------------------------------------------------------------------- /sweph/doc/media/image37.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image37.jpeg -------------------------------------------------------------------------------- /sweph/doc/media/image38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image38.png -------------------------------------------------------------------------------- /sweph/doc/media/image39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image39.png -------------------------------------------------------------------------------- /sweph/doc/media/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image4.png -------------------------------------------------------------------------------- /sweph/doc/media/image40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image40.png -------------------------------------------------------------------------------- /sweph/doc/media/image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image5.png -------------------------------------------------------------------------------- /sweph/doc/media/image6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image6.png -------------------------------------------------------------------------------- /sweph/doc/media/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image7.png -------------------------------------------------------------------------------- /sweph/doc/media/image8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image8.png -------------------------------------------------------------------------------- /sweph/doc/media/image9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/media/image9.png -------------------------------------------------------------------------------- /sweph/doc/swephprg.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/swephprg.pdf -------------------------------------------------------------------------------- /sweph/doc/swisseph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/doc/swisseph.pdf -------------------------------------------------------------------------------- /sweph/doc/template.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $title$ 7 | 8 | 9 |

Date: $date$

10 | $if(toc)$ 11 |
12 | $if(toctitle)$ 13 |

$toctitle$

14 | $endif$ 15 | $table-of-contents$ 16 |
17 | $endif$ 18 | $body$ 19 | 20 | 21 | -------------------------------------------------------------------------------- /sweph/ephe/seas_18.se1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/ephe/seas_18.se1 -------------------------------------------------------------------------------- /sweph/ephe/semo_18.se1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/ephe/semo_18.se1 -------------------------------------------------------------------------------- /sweph/ephe/sepl_18.se1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/ephe/sepl_18.se1 -------------------------------------------------------------------------------- /sweph/src/LICENSE: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 2 | 3 | License conditions 4 | ------------------ 5 | 6 | This file is part of Swiss Ephemeris. 7 | 8 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 9 | or distributor accepts any responsibility for the consequences of using it, 10 | or for whether it serves any particular purpose or works at all, unless he 11 | or she says so in writing. 12 | 13 | Swiss Ephemeris is made available by its authors under a dual licensing 14 | system. The software developer, who uses any part of Swiss Ephemeris 15 | in his or her software, must choose between one of the two license models, 16 | which are 17 | a) GNU Affero General Public License (AGPL) 18 | b) Swiss Ephemeris Professional License 19 | 20 | The choice must be made before the software developer distributes software 21 | containing parts of Swiss Ephemeris to others, and before any public 22 | service using the developed software is activated. 23 | 24 | If the developer choses the AGPL software license, he or she must fulfill 25 | the conditions of that license, which includes the obligation to place his 26 | or her whole software project under the AGPL or a compatible license. 27 | See https://www.gnu.org/licenses/agpl-3.0.html 28 | 29 | If the developer choses the Swiss Ephemeris Professional license, 30 | he must follow the instructions as found in http://www.astro.com/swisseph/ 31 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 32 | and sign the corresponding license contract. 33 | 34 | The License grants you the right to use, copy, modify and redistribute 35 | Swiss Ephemeris, but only under certain conditions described in the License. 36 | Among other things, the License requires that the copyright notices and 37 | this notice be preserved on all copies. 38 | 39 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 40 | 41 | The authors of Swiss Ephemeris have no control or influence over any of 42 | the derived works, i.e. over software or services created by other 43 | programmers which use Swiss Ephemeris functions. 44 | 45 | The names of the authors or of the copyright holder (Astrodienst) must not 46 | be used for promoting any software, product or service which uses or contains 47 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 48 | names of the authors can legally appear, except in cases where they have 49 | given special permission in writing. 50 | */ 51 | 52 | 53 | -------------------------------------------------------------------------------- /sweph/src/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | LICENSE -------------------------------------------------------------------------------- /sweph/src/Makefile: -------------------------------------------------------------------------------- 1 | # this Makefile creates a SwissEph library and a swetest sample on 64-bit 2 | # Redhat Enterprise Linux RHEL 7. 3 | 4 | # The mode marked as 'Linux' should also work with the GNU C compiler 5 | # gcc on other systems. 6 | 7 | # If you modify this makefile for another compiler, please 8 | # let us know. We would like to add as many variations as possible. 9 | # If you get warnings and error messages from your compiler, please 10 | # let us know. We like to fix the source code so that it compiles 11 | # free of warnings. 12 | # send email to the Swiss Ephemeris mailing list. 13 | # 14 | 15 | CFLAGS = -g -Wall -fPIC # for Linux and other gcc systems 16 | CFLAGS = -O2 -Wall -fPIC # for Linux and other gcc systems 17 | OP=$(CFLAGS) 18 | CC=cc #for Linux 19 | 20 | # compilation rule for general cases 21 | .o : 22 | $(CC) $(OP) -o $@ $? -lm 23 | .c.o: 24 | $(CC) -c $(OP) $< 25 | 26 | SWEOBJ = swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o sweph.o\ 27 | swephlib.o swecl.o swehel.o 28 | 29 | all: swetest swetests swevents swemini 30 | 31 | # build swetest with SE linked in, using dynamically linked system libraries libc, libm, libdl. 32 | swetest: swetest.o libswe.a 33 | $(CC) $(OP) -o swetest swetest.o -L. -lswe -lm -ldl 34 | 35 | # build a statically linked version of swetest. first find out where libc.a and libm.a reside, 36 | # and add this path with -L like below 37 | # a statically linked program will run on any Linux variant, independent of dynamic system libraries. 38 | swetests: swetest.o $(SWEOBJ) 39 | $(CC) $(OP) -static -L/usr/lib/x86_64-redhat-linux6E/lib64/ -o swetests swetest.o $(SWEOBJ) -lm -ldl 40 | 41 | swevents: swevents.o libswe.a 42 | $(CC) $(OP) -o swevents swevents.o -L. -lswe -lm -ldl 43 | 44 | swemini: swemini.o libswe.a 45 | $(CC) $(OP) -o swemini swemini.o -L. -lswe -lm -ldl 46 | 47 | # create an archive and a dynamic link libary fro SwissEph 48 | # a user of this library will inlcude swephexp.h and link with -lswe 49 | 50 | libswe.a: $(SWEOBJ) 51 | ar r libswe.a $(SWEOBJ) 52 | 53 | libswe.so: $(SWEOBJ) 54 | $(CC) -shared -o libswe.so $(SWEOBJ) 55 | 56 | test: 57 | cd setest && make && ./setest t 58 | 59 | test.exp: 60 | cd setest && make && ./setest -g t 61 | 62 | clean: 63 | rm -f *.o swetest libswe* 64 | cd setest && make clean 65 | 66 | ### 67 | swecl.o: swejpl.h sweodef.h swephexp.h swedll.h sweph.h swephlib.h 68 | sweclips.o: sweodef.h swephexp.h swedll.h 69 | swedate.o: swephexp.h sweodef.h swedll.h 70 | swehel.o: swephexp.h sweodef.h swedll.h 71 | swehouse.o: swephexp.h sweodef.h swedll.h swephlib.h swehouse.h 72 | swejpl.o: swephexp.h sweodef.h swedll.h sweph.h swejpl.h 73 | swemini.o: swephexp.h sweodef.h swedll.h 74 | swemmoon.o: swephexp.h sweodef.h swedll.h sweph.h swephlib.h 75 | swemplan.o: swephexp.h sweodef.h swedll.h sweph.h swephlib.h swemptab.h 76 | sweph.o: swejpl.h sweodef.h swephexp.h swedll.h sweph.h swephlib.h 77 | swephlib.o: swephexp.h sweodef.h swedll.h sweph.h swephlib.h 78 | swetest.o: swephexp.h sweodef.h swedll.h 79 | swevents.o: swephexp.h sweodef.h swedll.h 80 | -------------------------------------------------------------------------------- /sweph/src/sefstars.txt: -------------------------------------------------------------------------------- 1 | ../ephe/sefstars.txt -------------------------------------------------------------------------------- /sweph/src/seleapsec.txt: -------------------------------------------------------------------------------- 1 | # This file contains the dates of leap seconds to be taken into account 2 | # by the Swiss Ephemeris. 3 | # For each new leap second add the date of its insertion in the format 4 | # yyyymmdd, e.g. "20081231" for 31 december 2008. 5 | # The leap second is inserted at the end of the day. 6 | 20081231 7 | -------------------------------------------------------------------------------- /sweph/src/seorbel.txt: -------------------------------------------------------------------------------- 1 | # Orbital elements of ficticious planets 2 | # 27 Jan. 2000 3 | # 4 | # This file is part of the Swiss Ephemeris, from Version 1.52 on. 5 | # 6 | # Warning! These planets do not exist! 7 | # 8 | # The user can add his or her own elements. 9 | # 960 is the maximum number of ficticious planets. 10 | # 11 | # The elements order is as follows: 12 | # 1. epoch of elements (Julian day) 13 | # 2. equinox (Julian day or "J1900" or "B1950" or "J2000") 14 | # 3. mean anomaly at epoch 15 | # 4. semi-axis 16 | # 5. eccentricity 17 | # 6. argument of perihelion (ang. distance of perihelion from node) 18 | # 7. ascending node 19 | # 8. inclination 20 | # 9. name of planet 21 | # 22 | # use '#' for comments 23 | # to compute a body with swe_calc(), use planet number 24 | # ipl = SE_FICT_OFFSET_1 + number_of_elements_set, 25 | # e.g. number of Kronos is ipl = 39 + 4 = 43 26 | # 27 | # Witte/Sieggruen planets, refined by James Neely 28 | J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1 29 | J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2 30 | J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3 31 | J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4 32 | J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5 33 | J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6 34 | J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7 35 | J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8 36 | # 37 | # Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff. 38 | # Strubell does not give an equinox. 1945 is taken in order to 39 | # reproduce the as best as ASTRON ephemeris. (This is a strange 40 | # choice, though.) 41 | # The epoch according to Strubell is 1772.76. 42 | # 1772 is a leap year! 43 | # The fraction is counted from 1 Jan. 1772 44 | 2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9 45 | # Nibiru, elements from Christian Woeltge, Hannover 46 | 1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10 47 | # Harrington, elements from Astronomical Journal 96(4), Oct. 1988 48 | 2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11 49 | # according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63 50 | 2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12 51 | 2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13 52 | 2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14 53 | 2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15 54 | # intramercurian hypothetical Vulcan acc. to L.H. Weston 55 | 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 56 | # Selena/White Moon 57 | J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17 58 | # Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html 59 | # J1900, 170.73 + 51.05 * T 60 | J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18 61 | # Waldemath's Second Earth Moon 62 | # Elements were derived by D.Koch from Waldemaths original elements as given in 63 | # David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons) 64 | # elements, which are based on the assumption that the "mean longitude" given 65 | # by Waldemath is an observation (a true longitude) 66 | # Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris, 67 | # which is obviously wrong. 68 | 2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19 69 | # Colin R. Nicholl's Comet, according to "The Great Christ Comet", p. 223. 70 | 1719500.7, J2000, 0.0, 1190.0, 0.9999, 9.47, 200.08, 178.3, Christ Comet # 20 71 | # Planet 9, according to: Fienga & alii, Constraints on the location of a 72 | # possible 9th planet, Astronomy & Astrophysics no. FiengaLaskar2016R5. The 73 | # authors provide true anomaly 117.8. Mean anomaly derived by D. Koch 74 | 2457388.5,J2000,45.5272966,700,0.6,150,113,30,Planet_9 # 21 75 | # Comet Halley 12 BCE, only good near 12 BCE; 76 | # Yeomans/Kiang, Mon. Not. R. astr. Soc. (1981), 197, p. 643 77 | # http://adsabs.harvard.edu/full/1981MNRAS.197..633Y 78 | 1717323.34852, B1950, 0.0, 17.99261849, 0.9673664, 92.54399, 35.19064, 163.58392, Comet Halley 12 BCE # 22 79 | # 2015 RR245 80 | 2457600.5,J2000,322.50413,81.2891975,0.5852663,261.41753,211.67680,7.57643,2015 RR245 # 23 81 | # Koré apres Aureas 82 | #2415021.5,JDATE, 345.632, 52.0, 0,0,0, 0, Korè #24, adapted to fit 9°19 8.7.1923 83 | 2415021.5,JDATE, 345.67, 52.0014913, 0,0,0, 0, Korè #24 84 | # Comet Halley 1198 BCE, only good near 1198 BCE 85 | # Yeomans/Kiang, Mon. Not. R. astr. Soc. (1981), 197, p. 643 86 | # http://adsabs.harvard.edu/full/1981MNRAS.197..633Y 87 | 1283983.73252, B1950, 0.0, 16.80480637, 0.9625705, 74.46894, 14.66132, 162.95968, Comet Halley 1198 BCE # 25 88 | # 89 | # The following elements are for test only 90 | # (Selena without T) 91 | J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17 92 | # (Selena with T, gives exactly the same position) 93 | J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17 94 | J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18 95 | J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18 96 | -------------------------------------------------------------------------------- /sweph/src/sweclips.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cyjoelchen/php-sweph/cbad57e18e0c278d1c2a0eb520f3f4cd01e0d122/sweph/src/sweclips.c -------------------------------------------------------------------------------- /sweph/src/swedate.h: -------------------------------------------------------------------------------- 1 | /********************************************************* 2 | version 21-apr-2021 3 | *********************************************************/ 4 | 5 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 6 | 7 | License conditions 8 | ------------------ 9 | 10 | This file is part of Swiss Ephemeris. 11 | 12 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 13 | or distributor accepts any responsibility for the consequences of using it, 14 | or for whether it serves any particular purpose or works at all, unless he 15 | or she says so in writing. 16 | 17 | Swiss Ephemeris is made available by its authors under a dual licensing 18 | system. The software developer, who uses any part of Swiss Ephemeris 19 | in his or her software, must choose between one of the two license models, 20 | which are 21 | a) GNU Affero General Public License (AGPL) 22 | b) Swiss Ephemeris Professional License 23 | 24 | The choice must be made before the software developer distributes software 25 | containing parts of Swiss Ephemeris to others, and before any public 26 | service using the developed software is activated. 27 | 28 | If the developer choses the AGPL software license, he or she must fulfill 29 | the conditions of that license, which includes the obligation to place his 30 | or her whole software project under the AGPL or a compatible license. 31 | See https://www.gnu.org/licenses/agpl-3.0.html 32 | 33 | If the developer choses the Swiss Ephemeris Professional license, 34 | he must follow the instructions as found in http://www.astro.com/swisseph/ 35 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 36 | and sign the corresponding license contract. 37 | 38 | The License grants you the right to use, copy, modify and redistribute 39 | Swiss Ephemeris, but only under certain conditions described in the License. 40 | Among other things, the License requires that the copyright notices and 41 | this notice be preserved on all copies. 42 | 43 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 44 | 45 | The authors of Swiss Ephemeris have no control or influence over any of 46 | the derived works, i.e. over software or services created by other 47 | programmers which use Swiss Ephemeris functions. 48 | 49 | The names of the authors or of the copyright holder (Astrodienst) must not 50 | be used for promoting any software, product or service which uses or contains 51 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 52 | names of the authors can legally appear, except in cases where they have 53 | given special permission in writing. 54 | 55 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 56 | for promoting such software, products or services. 57 | */ 58 | 59 | #ifdef __cplusplus 60 | extern "C" { 61 | #endif 62 | 63 | #ifndef _SWEDLL_H 64 | extern EXP32 int swe_date_conversion ( 65 | int y , int m , int d , /* year, month, day */ 66 | double utime, /* universal time in hours (decimal) */ 67 | char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ 68 | double *tgmt); 69 | 70 | extern EXP32 double *swe_julday( 71 | int year, int month, int day, double hour, 72 | int gregflag); 73 | 74 | extern EXP32 void swe_revjul ( 75 | double jd, 76 | int gregflag, 77 | int *jyear, int *jmon, int *jday, double *jut); 78 | #endif 79 | #ifdef __cplusplus 80 | } /* extern C */ 81 | #endif 82 | -------------------------------------------------------------------------------- /sweph/src/sweephe4.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | 3 | header file for structures and functions in module sweephe.c 4 | for reading and writing stored ephemerides in format ep4 5 | a fast precomputed ephemeris used in some Astrodienst applications. 6 | 7 | The design of ephemeris type ep4: 8 | In all ASYS and transit application of stored ephemerides 9 | except Progressed Declinations Type 56 we need only the 10 | longitudes of the planets or nodes. 11 | The old EP3 format contains also latitudes, and uses ephemeris time. 12 | Therefore we define a new ephemeris format, which is capable of 13 | replacing EP3, when some ASYS programs are changed. 14 | The ASYS programs requiring different data can receive them 15 | by asking the calcserv module. 16 | 17 | We therefore store now a daily ephemeris with only logitudes, ecl and nut. 18 | The ephemeris is computed and stored for midnight ephemeris time, i.e. 19 | for jd = 2400000.5, 2400001.5 etc. 20 | In the ephemeris record for this date, only floor(jd) is kept. 21 | 22 | In many cases universal time (UT) is desired, not ephemeris time. 23 | Because computation with our current computers is very cheap for 24 | everything except trigonometrci functions, we can afford to 25 | build a good interpolation into the ephemeris package. 26 | 27 | The user can request from ephread() ephemeris positions for 28 | any (double) jd, not only for midnight ephemeris time. 29 | Inside the package the same quick Everett 5th-order interpolator 30 | is used as in placalc. 31 | It delivers positions within 0.01" for all planets except moon, mercury 32 | and true node. Moon and Mercury suffer, because their positions are 33 | stored only with a precision of 0.1"; true node suffers because 34 | it oscillates quickly with the fastest moon terms. 35 | The maximum observed differences between placalc and ephread for 12.00 noon 36 | are 0.25" for moon and true node and 0.1" for Mercury; in 80% of the days 37 | the differences are less than 0.1". This is significantly better than 38 | the implemented precision of the placalc package itself. 39 | 40 | The Everett interpolator delivers without any additional cost also 41 | the speed of the planets. This speed is very much better than the 42 | speed derived for the inner planets from the mean orbits. 43 | 44 | The returned data from ephread are in an array of centisec, 45 | with ecl and nut behind the planets. 46 | The default, pflag = 0, returns all. 47 | The speeds are returned in the second half of the array; 48 | the speed is always there, even when the speed bit has not been set. 49 | ***********************************************************/ 50 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 51 | 52 | License conditions 53 | ------------------ 54 | 55 | This file is part of Swiss Ephemeris. 56 | 57 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 58 | or distributor accepts any responsibility for the consequences of using it, 59 | or for whether it serves any particular purpose or works at all, unless he 60 | or she says so in writing. 61 | 62 | Swiss Ephemeris is made available by its authors under a dual licensing 63 | system. The software developer, who uses any part of Swiss Ephemeris 64 | in his or her software, must choose between one of the two license models, 65 | which are 66 | a) GNU Affero General Public License (AGPL) 67 | b) Swiss Ephemeris Professional License 68 | 69 | The choice must be made before the software developer distributes software 70 | containing parts of Swiss Ephemeris to others, and before any public 71 | service using the developed software is activated. 72 | 73 | If the developer choses the AGPL software license, he or she must fulfill 74 | the conditions of that license, which includes the obligation to place his 75 | or her whole software project under the AGPL or a compatible license. 76 | See https://www.gnu.org/licenses/agpl-3.0.html 77 | 78 | If the developer choses the Swiss Ephemeris Professional license, 79 | he must follow the instructions as found in http://www.astro.com/swisseph/ 80 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 81 | and sign the corresponding license contract. 82 | 83 | The License grants you the right to use, copy, modify and redistribute 84 | Swiss Ephemeris, but only under certain conditions described in the License. 85 | Among other things, the License requires that the copyright notices and 86 | this notice be preserved on all copies. 87 | 88 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 89 | 90 | The authors of Swiss Ephemeris have no control or influence over any of 91 | the derived works, i.e. over software or services created by other 92 | programmers which use Swiss Ephemeris functions. 93 | 94 | The names of the authors or of the copyright holder (Astrodienst) must not 95 | be used for promoting any software, product or service which uses or contains 96 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 97 | names of the authors can legally appear, except in cases where they have 98 | given special permission in writing. 99 | 100 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 101 | for promoting such software, products or services. 102 | */ 103 | 104 | # ifndef _EPHE_INCLUDED 105 | # define _EPHE_INCLUDED 106 | #ifdef __cplusplus 107 | extern "C" { 108 | #endif 109 | 110 | // definitions must agree wit astrolib.h 111 | #define PLACALC_SUN 0 /* used synonymously for earth too */ 112 | #define PLACALC_EARTH 0 113 | #define PLACALC_MOON 1 114 | #define PLACALC_MERCURY 2 115 | #define PLACALC_VENUS 3 116 | #define PLACALC_MARS 4 117 | #define PLACALC_JUPITER 5 118 | #define PLACALC_SATURN 6 119 | #define PLACALC_URANUS 7 120 | #define PLACALC_NEPTUNE 8 121 | #define PLACALC_PLUTO 9 122 | #define PLACALC_LASTPLANET PLUTO 123 | #define PLACALC_MEAN_NODE 10 124 | #define PLACALC_TRUE_NODE 11 125 | #define PLACALC_CHIRON 12 126 | #define PLACALC_LILITH 13 127 | #define PLACALC_CALC_N 14 /* number of planets in placalc module */ 128 | #define PLACALC_CERES 14 129 | #define PLACALC_PALLAS 15 130 | #define PLACALC_JUNO 16 131 | #define PLACALC_VESTA 17 132 | #define PLACALC_EARTHHEL 18 /* heliocentric earth */ 133 | #define PLACALC_PFORTUNAE 19 134 | // next numbers after 19 are reserved for AC, MC, houses, signs; 135 | # define PLACALC_AC 20 136 | # define PLACALC_ASC 20 137 | # define PLACALC_MC 21 138 | # define PLACALC_CALC_N_MC 22 /* number of normal natal factors */ 139 | 140 | # define EP4_BLOCKSIZE sizeof(struct ep4) 141 | # if HPUNIX 142 | # define EP4_PATH "/home/ephe/" 143 | # else 144 | # define EP4_PATH "ephe\\" 145 | # endif 146 | # define EP4_FILE "sep4_" /* packed ephemeris */ 147 | # define EP4_NDAYS 10000L /* days per EP4_ file */ 148 | # define NDB 10L /* 10 days per block */ 149 | 150 | /* 151 | * bits for plalist in ephread(): 152 | * the planet flag bits SUN .. PLACALC_CHIRON, ECl, NUT can be set individually. 153 | * plalist = 0 is equivalent to all planets and ecl,nut 154 | * EP_ALL_PLANETS sets all planet bits SUN .. PLACALC_CHIRON 155 | * EP_ALL_BITS sets all bits. 156 | */ 157 | 158 | # define EP_NP (PLACALC_CHIRON + 3) /* total number of factors in ep4 */ 159 | /* sun .. chiron, ecl, nut */ 160 | 161 | # define EP_ALL_PLANETS ((1 << (PLACALC_CHIRON + 1)) - 1) /* bits 0..12 set */ 162 | # define EP_CALC_N (PLACALC_CHIRON+1) /* 13 planets, SUN .. PLACALC_CHIRON */ 163 | # define EP_ECL_INDEX (PLACALC_CHIRON + 1) /* index for ecliptic centisec */ 164 | # define EP_NUT_INDEX (PLACALC_CHIRON + 2) /* index for nutation centisec */ 165 | # define EP_ECL_BIT (1 << EP_ECL_INDEX) 166 | # define EP_NUT_BIT (1 << EP_NUT_INDEX) 167 | # define EP_ALL_BITS (EP_ALL_PLANETS|EP_ECL_BIT|EP_NUT_BIT) 168 | 169 | // bits for flag in ephread(), values come from placalc compatibility 170 | # define EP_BIT_SPEED 16 // must get speed 171 | # define EP_BIT_MUST_USE_EPHE 256 172 | 173 | 174 | struct elon { /* longitudes for 10 days */ 175 | short p0m; /* longitude at day 0, minutes */ 176 | short p0s; /* 0.01" */ 177 | short pd1m; /* delta of days 1, 0.01" */ 178 | short pd1s; /* 0.01" */ 179 | short pd2[NDB-2]; /* second differences, day 2 .. 9, 180 | 0.1" moon, mercury, 0.01" others*/ 181 | }; 182 | 183 | /* 184 | * ep4 is the new ephemeris format for longitude only, ephemeris time 185 | */ 186 | struct ep4 { 187 | short j_10000; /* floor(jd - 0.5) / 10000L; */ 188 | short j_rest; /* (jd - 0.5 ) - 10000L * j_10000 189 | j_rest is always positive; 190 | jd = j_10000 * 10000L + j_rest + 0.5 */ 191 | short ecl0m; /* true ecliptic day 0, min ; */ 192 | short ecl0s; /* 0.01" */ 193 | short ecld1[NDB-1]; /* first differences 0.01", day 1..9 */ 194 | short nuts[NDB]; /* nutation in 0.01", day 0..9 */ 195 | struct elon elo[PLACALC_CHIRON +1]; /* longitude sun...chiron */ 196 | }; 197 | 198 | 199 | /****************************************** 200 | globals exported by module ephe.c 201 | ********************************************/ 202 | extern FILE *ephfp; 203 | 204 | /****************************************** 205 | functions exported by module ephe.c 206 | ********************************************/ 207 | 208 | extern centisec *ephread(double jd, int plalist, int flag, char *errtext); 209 | /* 210 | * This is the only function normally used by applications. 211 | * ATTENTION: jd is an absolute Julian date, whereas calc() and deltat() 212 | * require Astrodienst-relative Julian dates. 213 | * plalist can consist of individual planet bit flags, to indicate that 214 | * only these planets are wanted. 215 | * plalist = 0 returns all planets, and ecl and nut. 216 | * Because the computation is so fast, it is recommended to use pflag = 0. 217 | * flag recognizes only the bits CALC_BIT_SPEED and CALC_MUST_USE_EPHE. 218 | * If CALC_BIT_SPEED is set, of the planets are returned in the result array 219 | * after all longitudes (speeds for ecl and nut are always set to zero). 220 | * If CALC_BIT_MUST_USE_EPHE is NOT set, calc() will be used if reading 221 | * the ephemeris fails. 222 | * cp is the returned pointer, the longitude of the planet p is 223 | * at cp[p] and the speed is at cp[p + EP_NP]. 224 | * The returned longitudes are always normalized into [0..DEG360[, 225 | * except for nut, which is small and close to zero, negative or positive. 226 | */ 227 | extern double *dephread2(double jd, int plalist, int flag, char *errtext); 228 | 229 | extern int eph4_posit (int jlong, AS_BOOL writeflag, char *errtext); 230 | 231 | extern int ephe_plac2swe(int p); 232 | 233 | extern void shortreorder (UCHAR *p, int n); 234 | 235 | #ifdef __cplusplus 236 | } 237 | #endif 238 | 239 | # endif /* _EPHE_INCLUDED */ 240 | -------------------------------------------------------------------------------- /sweph/src/swehouse.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | module swehouse.h 3 | house and (simple) aspect calculation 4 | 5 | *******************************************************/ 6 | 7 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 8 | 9 | License conditions 10 | ------------------ 11 | 12 | This file is part of Swiss Ephemeris. 13 | 14 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 15 | or distributor accepts any responsibility for the consequences of using it, 16 | or for whether it serves any particular purpose or works at all, unless he 17 | or she says so in writing. 18 | 19 | Swiss Ephemeris is made available by its authors under a dual licensing 20 | system. The software developer, who uses any part of Swiss Ephemeris 21 | in his or her software, must choose between one of the two license models, 22 | which are 23 | a) GNU Affero General Public License (AGPL) 24 | b) Swiss Ephemeris Professional License 25 | 26 | The choice must be made before the software developer distributes software 27 | containing parts of Swiss Ephemeris to others, and before any public 28 | service using the developed software is activated. 29 | 30 | If the developer choses the AGPL software license, he or she must fulfill 31 | the conditions of that license, which includes the obligation to place his 32 | or her whole software project under the AGPL or a compatible license. 33 | See https://www.gnu.org/licenses/agpl-3.0.html 34 | 35 | If the developer choses the Swiss Ephemeris Professional license, 36 | he must follow the instructions as found in http://www.astro.com/swisseph/ 37 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 38 | and sign the corresponding license contract. 39 | 40 | The License grants you the right to use, copy, modify and redistribute 41 | Swiss Ephemeris, but only under certain conditions described in the License. 42 | Among other things, the License requires that the copyright notices and 43 | this notice be preserved on all copies. 44 | 45 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 46 | 47 | The authors of Swiss Ephemeris have no control or influence over any of 48 | the derived works, i.e. over software or services created by other 49 | programmers which use Swiss Ephemeris functions. 50 | 51 | The names of the authors or of the copyright holder (Astrodienst) must not 52 | be used for promoting any software, product or service which uses or contains 53 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 54 | names of the authors can legally appear, except in cases where they have 55 | given special permission in writing. 56 | 57 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 58 | for promoting such software, products or services. 59 | */ 60 | 61 | struct houses { 62 | double cusp[37]; 63 | double cusp_speed[37]; 64 | double ac; 65 | double ac_speed; // speed of ac 66 | double mc; 67 | double mc_speed; // speed of mc 68 | double armc_speed; // speed of armc 69 | double vertex; 70 | double vertex_speed; // speed of vertex 71 | double equasc; 72 | double equasc_speed; // speed 73 | double coasc1; 74 | double coasc1_speed; // speed 75 | double coasc2; 76 | double coasc2_speed; // speed 77 | double polasc; 78 | double polasc_speed; // speed 79 | double sundec; // declination of Sun for Sunshine houses 80 | AS_BOOL do_speed; 81 | AS_BOOL do_hspeed; 82 | AS_BOOL do_interpol; 83 | char serr[AS_MAXCH]; 84 | }; 85 | 86 | #define HOUSES struct houses 87 | #define VERY_SMALL 1E-10 88 | 89 | #define degtocs(x) (d2l((x) * DEG)) 90 | #define cstodeg(x) (double)((x) * CS2DEG) 91 | 92 | #define sind(x) sin((x) * DEGTORAD) 93 | #define cosd(x) cos((x) * DEGTORAD) 94 | #define tand(x) tan((x) * DEGTORAD) 95 | #define asind(x) (asin(x) * RADTODEG) 96 | #define acosd(x) (acos(x) * RADTODEG) 97 | #define atand(x) (atan(x) * RADTODEG) 98 | #define atan2d(y, x) (atan2(y, x) * RADTODEG) 99 | -------------------------------------------------------------------------------- /sweph/src/swejpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | | 3 | | Subroutines for reading JPL ephemerides. 4 | | derived from testeph.f as contained in DE403 distribution July 1995. 5 | | works with DE200, DE102, DE403, DE404, DE405, DE406, DE431 6 | | (attention, these ephemerides do not have exactly the same reference frame) 7 | 8 | Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich 9 | 10 | **************************************************************/ 11 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 12 | 13 | License conditions 14 | ------------------ 15 | 16 | This file is part of Swiss Ephemeris. 17 | 18 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 19 | or distributor accepts any responsibility for the consequences of using it, 20 | or for whether it serves any particular purpose or works at all, unless he 21 | or she says so in writing. 22 | 23 | Swiss Ephemeris is made available by its authors under a dual licensing 24 | system. The software developer, who uses any part of Swiss Ephemeris 25 | in his or her software, must choose between one of the two license models, 26 | which are 27 | a) GNU Affero General Public License (AGPL) 28 | b) Swiss Ephemeris Professional License 29 | 30 | The choice must be made before the software developer distributes software 31 | containing parts of Swiss Ephemeris to others, and before any public 32 | service using the developed software is activated. 33 | 34 | If the developer choses the AGPL software license, he or she must fulfill 35 | the conditions of that license, which includes the obligation to place his 36 | or her whole software project under the AGPL or a compatible license. 37 | See https://www.gnu.org/licenses/agpl-3.0.html 38 | 39 | If the developer choses the Swiss Ephemeris Professional license, 40 | he must follow the instructions as found in http://www.astro.com/swisseph/ 41 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 42 | and sign the corresponding license contract. 43 | 44 | The License grants you the right to use, copy, modify and redistribute 45 | Swiss Ephemeris, but only under certain conditions described in the License. 46 | Among other things, the License requires that the copyright notices and 47 | this notice be preserved on all copies. 48 | 49 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 50 | 51 | The authors of Swiss Ephemeris have no control or influence over any of 52 | the derived works, i.e. over software or services created by other 53 | programmers which use Swiss Ephemeris functions. 54 | 55 | The names of the authors or of the copyright holder (Astrodienst) must not 56 | be used for promoting any software, product or service which uses or contains 57 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 58 | names of the authors can legally appear, except in cases where they have 59 | given special permission in writing. 60 | 61 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 62 | for promoting such software, products or services. 63 | */ 64 | 65 | 66 | #include "sweodef.h" 67 | 68 | #define J_MERCURY 0 /* jpl body indices, modified by Alois */ 69 | #define J_VENUS 1 /* now they start at 0 and not at 1 */ 70 | #define J_EARTH 2 71 | #define J_MARS 3 72 | #define J_JUPITER 4 73 | #define J_SATURN 5 74 | #define J_URANUS 6 75 | #define J_NEPTUNE 7 76 | #define J_PLUTO 8 77 | #define J_MOON 9 78 | #define J_SUN 10 79 | #define J_SBARY 11 80 | #define J_EMB 12 81 | #define J_NUT 13 82 | #define J_LIB 14 83 | 84 | /* 85 | * compute position and speed at time et, for body ntarg with center 86 | * ncent. rrd must be double[6] to contain the return vectors. 87 | * ntarg can be all of the above, ncent all except J_NUT and J_LIB. 88 | * Librations and Nutations are not affected by ncent. 89 | */ 90 | extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr); 91 | 92 | /* 93 | * read the ephemeris constants. ss[0..2] returns start, end and granule size. 94 | * If do_show is TRUE, a list of constants is printed to stdout. 95 | */ 96 | extern void swi_close_jpl_file(void); 97 | 98 | extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr); 99 | 100 | extern int32 swi_get_jpl_denum(void); 101 | 102 | extern void swi_IERS_FK5(double *xin, double *xout, int dir); 103 | 104 | -------------------------------------------------------------------------------- /sweph/src/swemini.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | swemini.c A minimal program to test the Swiss Ephemeris. 5 | 6 | Input: a date (in gregorian calendar, sequence day.month.year) 7 | if no date is entered, 1 Jan 2022 is used. Next time, the date 8 | advances by one day. 9 | Output: Planet positions at midnight Universal time, ecliptic coordinates, 10 | geocentric apparent positions relative to true equinox of date, as 11 | usual in western astrology. 12 | 13 | 14 | Authors: Dieter Koch and Alois Treindl. 15 | 16 | The code of sample program swemini.c is in the public domain. 17 | (But not the code of the library functions called by it.) 18 | 19 | **************************************************************/ 20 | 21 | 22 | #include "swephexp.h" 23 | 24 | char *smon[] = {NULL, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; 25 | 26 | int main() 27 | { 28 | char sdate[AS_MAXCH], snam[40], serr[AS_MAXCH]; 29 | int jday = 1, jmon = 1, jyear = 2022; 30 | double jut = 0.0; 31 | double tjd, te, x2[6]; 32 | int32 iflag, iflgret; 33 | int p; 34 | swe_set_ephe_path(NULL); 35 | iflag = SEFLG_SPEED; 36 | while (TRUE) { 37 | printf("\nDate (d.m.y) ?"); 38 | fgets(sdate, sizeof(sdate)-1, stdin); 39 | // stop if a period . is entered 40 | if (*sdate == '.') 41 | return OK; 42 | sscanf (sdate, "%d%*c%d%*c%d", &jday,&jmon,&jyear); 43 | // we have day, month and year and convert to Julian day number 44 | if (jmon < 1 || jmon > 12) { 45 | printf("illegal month %d\n", jmon); 46 | continue; 47 | } 48 | tjd = swe_julday(jyear,jmon,jday,jut,SE_GREG_CAL); 49 | // compute Ephemeris time from Universal time by adding delta_t 50 | te = tjd + swe_deltat(tjd); 51 | printf("date: %02d %s %04d at 0:00 Universal time, jd=%.1lf\n", jday, smon[jmon], jyear, tjd); 52 | printf("planet \tlongitude\tlatitude\tdistance\tspeed long.\n"); 53 | for (p = SE_SUN; p <= SE_CHIRON; p++) { // a loop over all planets 54 | if (p == SE_EARTH) continue; 55 | swe_get_planet_name(p, snam); // get the name of the planet p 56 | // do the coordinate calculation for this planet p 57 | iflgret = swe_calc(te, p, iflag, x2, serr); 58 | // if there is a problem, a negative value is returned and an error message is in serr. 59 | if (iflgret < 0) { 60 | printf("%10s\terror: %s\n", snam, serr); 61 | continue; 62 | } 63 | if (iflgret != iflag) 64 | printf("warning: iflgret != iflag. %s\n", serr); 65 | // print the coordinates 66 | printf("%10s\t%11.7f\t%10.7f\t%10.7f\t%10.7f\n", 67 | snam, x2[0], x2[1], x2[2], x2[3]); 68 | } 69 | tjd++; // if date entry is empty, take next day 70 | swe_revjul(tjd, SE_GREG_CAL, &jyear, &jmon, &jday, &jut); 71 | } 72 | return OK; 73 | } 74 | -------------------------------------------------------------------------------- /sweph/src/sweodef.h: -------------------------------------------------------------------------------- 1 | /************************************************************ 2 | definitions and constants for all Swiss Ephemeris source files, 3 | only required for compiling the libraries, not for the external 4 | interface of the libraries. 5 | 6 | The definitions are a subset of Astrodienst's ourdef.h content 7 | and must be kept compatible. Everything not used in SwissEph 8 | has been deleted. 9 | 10 | Does auto-detection of MSDOS (TURBO_C or MS_C), HPUNIX, Linux. 11 | Must be extended for more portability; there should be a way 12 | to detect byte order and file system type. 13 | 14 | ************************************************************/ 15 | 16 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 17 | 18 | License conditions 19 | ------------------ 20 | 21 | This file is part of Swiss Ephemeris. 22 | 23 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 24 | or distributor accepts any responsibility for the consequences of using it, 25 | or for whether it serves any particular purpose or works at all, unless he 26 | or she says so in writing. 27 | 28 | Swiss Ephemeris is made available by its authors under a dual licensing 29 | system. The software developer, who uses any part of Swiss Ephemeris 30 | in his or her software, must choose between one of the two license models, 31 | which are 32 | a) GNU Affero General Public License (AGPL) 33 | b) Swiss Ephemeris Professional License 34 | 35 | The choice must be made before the software developer distributes software 36 | containing parts of Swiss Ephemeris to others, and before any public 37 | service using the developed software is activated. 38 | 39 | If the developer choses the AGPL software license, he or she must fulfill 40 | the conditions of that license, which includes the obligation to place his 41 | or her whole software project under the AGPL or a compatible license. 42 | See https://www.gnu.org/licenses/agpl-3.0.html 43 | 44 | If the developer choses the Swiss Ephemeris Professional license, 45 | he must follow the instructions as found in http://www.astro.com/swisseph/ 46 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 47 | and sign the corresponding license contract. 48 | 49 | The License grants you the right to use, copy, modify and redistribute 50 | Swiss Ephemeris, but only under certain conditions described in the License. 51 | Among other things, the License requires that the copyright notices and 52 | this notice be preserved on all copies. 53 | 54 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 55 | 56 | The authors of Swiss Ephemeris have no control or influence over any of 57 | the derived works, i.e. over software or services created by other 58 | programmers which use Swiss Ephemeris functions. 59 | 60 | The names of the authors or of the copyright holder (Astrodienst) must not 61 | be used for promoting any software, product or service which uses or contains 62 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 63 | names of the authors can legally appear, except in cases where they have 64 | given special permission in writing. 65 | 66 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 67 | for promoting such software, products or services. 68 | */ 69 | 70 | #ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */ 71 | #ifndef _SWEODEF_INCLUDED /* allow multiple #includes */ 72 | #define _SWEODEF_INCLUDED 73 | 74 | # define MY_TRUE 1 /* for use in other defines, before TRUE is defined */ 75 | # define MY_FALSE 0 /* for use in other defines, before TRUE is defined */ 76 | 77 | #ifdef __CYGWIN__ // following T. Mack Jan/July 2021 78 | # undef __GNUC__ 79 | #endif 80 | 81 | /* TLS support 82 | * 83 | * Sun Studio C/C++, IBM XL C/C++, GNU C and Intel C/C++ (Linux systems) -> __thread 84 | * Borland, VC++ -> __declspec(thread) 85 | */ 86 | #if !defined(TLSOFF) && !defined( __APPLE__ ) && !defined(WIN32) && !defined(DOS32) 87 | #if defined( __GNUC__ ) || defined( __CYGWIN__ ) 88 | #define TLS __thread 89 | #else 90 | #define TLS __declspec(thread) 91 | #endif 92 | #else 93 | #define TLS 94 | #endif 95 | 96 | #ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */ 97 | # undef MSDOS 98 | # define MSDOS MY_TRUE 99 | #include 100 | #include 101 | #include 102 | #include 103 | #include 104 | #include 105 | # define sleep(x) Sleep((x) * 1000) 106 | #endif 107 | 108 | #ifdef _MSC_VER 109 | # define MS_VC 110 | #endif 111 | 112 | #ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */ 113 | # define MSDOS MY_TRUE 114 | #endif 115 | 116 | #ifdef MSDOS /* already defined by some DOS compilers */ 117 | # undef MSDOS 118 | # define MSDOS MY_TRUE 119 | #endif 120 | 121 | #ifdef __TURBOC__ /* defined by turboc */ 122 | # ifndef MSDOS 123 | # define MSDOS MY_TRUE 124 | # endif 125 | # define TURBO_C 126 | #endif 127 | 128 | #ifdef __SC__ /* defined by Symantec C */ 129 | # ifndef MSDOS 130 | # define MSDOS MY_TRUE 131 | # endif 132 | # define SYMANTEC_C 133 | #endif 134 | 135 | #ifdef __WATCOMC__ /* defined by WatcomC */ 136 | # ifndef MSDOS 137 | # define MSDOS MY_TRUE 138 | # endif 139 | # define WATCOMC 140 | #endif 141 | 142 | #ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */ 143 | # if macintosh && powerc 144 | # define MACOS MY_TRUE /* let it undefined otherwise */ 145 | # define MSDOS MY_FALSE /* in case one above fired falsely */ 146 | # endif 147 | #endif 148 | 149 | #ifdef MSDOS 150 | # define HPUNIX MY_FALSE 151 | # define INTEL_BYTE_ORDER 1 152 | # ifndef TURBO_C 153 | # define MS_C /* assume Microsoft C compiler */ 154 | # endif 155 | # define UNIX_FS MY_FALSE 156 | #else 157 | # ifdef MACOS 158 | # define HPUNIX MY_FALSE 159 | # define UNIX_FS MY_FALSE 160 | # else 161 | # define MSDOS MY_FALSE 162 | # define HPUNIX MY_TRUE 163 | # ifndef _HPUX_SOURCE 164 | # define _HPUX_SOURCE 165 | # endif 166 | # define UNIX_FS MY_TRUE 167 | # endif 168 | #endif 169 | 170 | #include 171 | #include 172 | #ifndef FILE 173 | # include 174 | #endif 175 | 176 | #if HPUNIX 177 | # include 178 | #endif 179 | 180 | /* 181 | * if we have 16-bit ints, we define INT_16; we will need %ld to printf an int32 182 | * if we have 64-bit long, we define LONG_64 183 | * If none is defined, we have int = long = 32 bit, and use %d to printf an int32 184 | */ 185 | #include 186 | #if INT_MAX < 40000 187 | # define INT_16 188 | #else 189 | # if LONG_MAX > INT_MAX 190 | # define LONG_64 191 | # endif 192 | #endif 193 | 194 | #ifdef BYTE_ORDER 195 | #ifdef LITTLE_ENDIAN 196 | # if BYTE_ORDER == LITTLE_ENDIAN 197 | # define INTEL_BYTE_ORDER 198 | # endif 199 | #endif 200 | #endif 201 | 202 | #ifdef INT_16 203 | typedef long int32; 204 | typedef unsigned long uint32; 205 | typedef int int16; 206 | typedef double REAL8; /* real with at least 64 bit precision */ 207 | typedef long INT4; /* signed integer with at least 32 bit precision */ 208 | typedef unsigned long UINT4; 209 | /* unsigned integer with at least 32 bit precision */ 210 | typedef int AS_BOOL; 211 | typedef unsigned int UINT2; /* unsigned 16 bits */ 212 | # define ABS4 labs /* abs function for long */ 213 | #else 214 | typedef int int32; 215 | typedef long long int64; 216 | typedef unsigned int uint32; 217 | typedef short int16; 218 | typedef double REAL8; /* real with at least 64 bit precision */ 219 | typedef int INT4; /* signed integer with at least 32 bit precision */ 220 | typedef unsigned int UINT4; 221 | /* unsigned integer with at least 32 bit precision */ 222 | typedef int AS_BOOL; 223 | typedef unsigned short UINT2; /* unsigned 16 bits */ 224 | # define ABS4 abs /* abs function for long */ 225 | #endif 226 | 227 | #if MSDOS 228 | # ifdef TURBO_C 229 | # include /* MSC needs malloc ! */ 230 | # else 231 | # include 232 | # endif 233 | # define SIGALRM SIGINT 234 | #endif 235 | 236 | #ifndef TRUE 237 | # define TRUE 1 238 | # define FALSE 0 239 | #endif 240 | 241 | #ifndef OK 242 | # define OK (0) 243 | # define ERR (-1) 244 | #endif 245 | 246 | /* hack because UCHAR is already used by mingw gcc */ 247 | #ifdef __GNUC__ 248 | #ifdef _WIN32 249 | #define UCHAR SWE_UCHAR 250 | #endif 251 | #endif 252 | 253 | typedef unsigned char UCHAR; 254 | #define UCP (UCHAR*) 255 | #define SCP (char*) 256 | 257 | # define ODEGREE_STRING "°" /* degree as string, utf8 encoding */ 258 | 259 | 260 | 261 | #ifndef HUGE 262 | # define HUGE 1.7E+308 /* biggest value for REAL8 */ 263 | #endif 264 | #ifndef M_PI 265 | # define M_PI 3.14159265358979323846 266 | #endif 267 | 268 | /* #define forward static obsolete */ 269 | 270 | #define AS_MAXCH 256 /* used for string declarations, allowing 255 char+\0 */ 271 | 272 | /* 273 | #define DEGTORAD 0.0174532925199433 274 | #define RADTODEG 57.2957795130823 275 | */ 276 | #define RADTODEG (180.0 / M_PI) 277 | #define DEGTORAD (M_PI / 180.0) 278 | 279 | typedef int32 centisec; /* centiseconds used for angles and times */ 280 | #define CS (centisec) /* use for casting */ 281 | #define CSEC centisec /* use for typing */ 282 | 283 | #define DEG 360000 /* degree expressed in centiseconds */ 284 | #define DEG7_30 (2700000) /* 7.5 degrees */ 285 | #define DEG15 (15 * DEG) 286 | #define DEG24 (24 * DEG) 287 | #define DEG30 (30 * DEG) 288 | #define DEG60 (60 * DEG) 289 | #define DEG90 (90 * DEG) 290 | #define DEG120 (120 * DEG) 291 | #define DEG150 (150 * DEG) 292 | #define DEG180 (180 * DEG) 293 | #define DEG270 (270 * DEG) 294 | #define DEG360 (360 * DEG) 295 | 296 | /* #define CSTORAD 4.84813681109536E-08 centisec to rad: pi / 180 /3600/100 */ 297 | /* #define RADTOCS 2.06264806247096E+07 rad to centisec 180*3600*100/pi */ 298 | #define CSTORAD (DEGTORAD / 360000.0) 299 | #define RADTOCS (RADTODEG * 360000.0) 300 | 301 | #define CS2DEG (1.0/360000.0) /* centisec to degree */ 302 | 303 | /* control strings for fopen() */ 304 | #if UNIX_FS 305 | # define BFILE_R_ACCESS "r" /* open binary file for reading */ 306 | # define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */ 307 | # define BFILE_W_CREATE "w" /* create/open binary file for write*/ 308 | # define BFILE_A_ACCESS "a+" /* create/open binary file for append*/ 309 | # define FILE_R_ACCESS "r" /* open text file for reading */ 310 | # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */ 311 | # define FILE_W_CREATE "w" /* create/open text file for write*/ 312 | # define FILE_A_ACCESS "a+" /* create/open text file for append*/ 313 | # define O_BINARY 0 /* for open(), not defined in Unix */ 314 | # define OPEN_MODE 0666 /* default file creation mode */ 315 | # define DIR_GLUE "/" /* glue string for directory/file */ 316 | # define PATH_SEPARATOR ";:" /* semicolon or colon may be used */ 317 | #else 318 | # define BFILE_R_ACCESS "rb" /* open binary file for reading */ 319 | # define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */ 320 | # define BFILE_W_CREATE "wb" /* create/open binary file for write*/ 321 | # define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/ 322 | # define PATH_SEPARATOR ";" /* semicolon as PATH separator */ 323 | # define OPEN_MODE 0666 /* default file creation mode */ 324 | # ifdef MACOS 325 | # define FILE_R_ACCESS "r" /* open text file for reading */ 326 | # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */ 327 | # define FILE_W_CREATE "w" /* create/open text file for write*/ 328 | # define FILE_A_ACCESS "a+" /* create/open text file for append*/ 329 | # define DIR_GLUE ":" /* glue string for directory/file */ 330 | # else 331 | # define FILE_R_ACCESS "rt" /* open text file for reading */ 332 | # define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */ 333 | # define FILE_W_CREATE "wt" /* create/open text file for write*/ 334 | # define FILE_A_ACCESS "a+t" /* create/open text file for append*/ 335 | /* attention, all backslashes for msdos directry names must be written as \\, 336 | because it is the C escape character */ 337 | # define DIR_GLUE "\\" /* glue string for directory/file */ 338 | # endif 339 | #endif 340 | 341 | #include 342 | #include 343 | 344 | #endif /* _SWEODEF_INCLUDED */ 345 | #endif /* _OURDEF_INCLUDED */ 346 | -------------------------------------------------------------------------------- /sweph/src/swephgen4.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | sweephgen4.c 3 | 4 | Create ephemeris file type 4 ep4_ 5 | a fast precoomputed ephemeris used in some Astrodienst applications. 6 | 7 | options: -fYYY (start) file number, required option 8 | -nNN number of files to be created, default 1 9 | -v verbose: print differences (default: no) 10 | -t test by reading 11 | 12 | 13 | File format: 14 | 1000 blocks of xxx bytes 15 | File names: ep4_243, ep4_244 16 | corresponding to the absolute julian day number 17 | 18 | *********************************************************************/ 19 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 20 | 21 | License conditions 22 | ------------------ 23 | 24 | This file is part of Swiss Ephemeris. 25 | 26 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 27 | or distributor accepts any responsibility for the consequences of using it, 28 | or for whether it serves any particular purpose or works at all, unless he 29 | or she says so in writing. 30 | 31 | Swiss Ephemeris is made available by its authors under a dual licensing 32 | system. The software developer, who uses any part of Swiss Ephemeris 33 | in his or her software, must choose between one of the two license models, 34 | which are 35 | a) GNU Affero General Public License (AGPL) 36 | b) Swiss Ephemeris Professional License 37 | 38 | The choice must be made before the software developer distributes software 39 | containing parts of Swiss Ephemeris to others, and before any public 40 | service using the developed software is activated. 41 | 42 | If the developer choses the AGPL software license, he or she must fulfill 43 | the conditions of that license, which includes the obligation to place his 44 | or her whole software project under the AGPL or a compatible license. 45 | See https://www.gnu.org/licenses/agpl-3.0.html 46 | 47 | If the developer choses the Swiss Ephemeris Professional license, 48 | he must follow the instructions as found in http://www.astro.com/swisseph/ 49 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 50 | and sign the corresponding license contract. 51 | 52 | The License grants you the right to use, copy, modify and redistribute 53 | Swiss Ephemeris, but only under certain conditions described in the License. 54 | Among other things, the License requires that the copyright notices and 55 | this notice be preserved on all copies. 56 | 57 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 58 | 59 | The authors of Swiss Ephemeris have no control or influence over any of 60 | the derived works, i.e. over software or services created by other 61 | programmers which use Swiss Ephemeris functions. 62 | 63 | The names of the authors or of the copyright holder (Astrodienst) must not 64 | be used for promoting any software, product or service which uses or contains 65 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 66 | names of the authors can legally appear, except in cases where they have 67 | given special permission in writing. 68 | 69 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 70 | for promoting such software, products or services. 71 | */ 72 | 73 | 74 | # include "swephexp.h" 75 | # include "sweephe4.h" 76 | 77 | # define EPHR_NPL (PLACALC_CHIRON + 1) 78 | 79 | char *arg0; 80 | int32 max_dd[EP_CALC_N]; /* remember maximum of second dfifferences */ 81 | double max_err[EP_CALC_N]; /* remember maximum error */ 82 | AS_BOOL verbose = FALSE; 83 | char errtext[AS_MAXCH]; 84 | 85 | int split(w, m, min, sec) 86 | int32 w; /* position in seconds/m */ 87 | int m; /* factor for seconds */ 88 | short *min, /* storage for degrees and minutes */ 89 | *sec; /* storage for seconds * m */ 90 | { 91 | if (w >= 0) { 92 | *sec = w % (60 * m); 93 | *min = w / (60 * m); 94 | } else { 95 | *sec = -(-w % (60 * m)); 96 | *min = -(-w / (60 * m)); 97 | } 98 | return OK; 99 | } 100 | 101 | 102 | /************************************************************* 103 | Pack positions of 10 days and write to file 104 | The longitude is packed with second differences in such a way, 105 | that the accumulating rounding erros do not exceed half of 106 | the last stored digit, i.e. 0.05" moon, 0.005" other planets 107 | **************************************************************/ 108 | int eph4_pack (int32 jd, double (*l)[NDB], double ecliptic[], 109 | double nutation[]) 110 | { 111 | int i, p,ps; 112 | int32 d1, d2, dd, d_ret, w0, w_ret; 113 | double err; 114 | struct ep4 e; 115 | e.j_10000 = jd / 10000.0; 116 | e.j_rest = jd - 10000.0 * e.j_10000; 117 | w0 = swe_d2l( ecliptic[0] * DEG); 118 | split( w0, 100, &e.ecl0m, &e.ecl0s ); 119 | for (i = 1; i < NDB; i++) 120 | e.ecld1[i-1] = swe_d2l(ecliptic[i] * DEG - w0); 121 | for (i = 0; i < NDB; i++) 122 | e.nuts[i] = swe_d2l( nutation[i] * DEG ); /* int32 casted into short */ 123 | for (p = PLACALC_SUN; p <= PLACALC_CHIRON ; p++) { 124 | ps = p; 125 | w0 = swe_d2l( l[ps][0] * DEG); 126 | d1 = swe_d2l( l[ps][1] * DEG - w0); 127 | if (d1 >= DEG180) 128 | d1 -= DEG360; 129 | else if (d1 <= -DEG180) 130 | d1 += DEG360; 131 | split(w0, 100, &e.elo[p].p0m, &e.elo[p].p0s); 132 | split(d1, 100, &e.elo[p].pd1m, &e.elo[p].pd1s); 133 | d_ret = d1; /* recalculated diff */ 134 | w_ret = w0 + d_ret; /* recalculated position */ 135 | for (i = 2; i < NDB; i++) { 136 | d2 = swe_d2l( l[ps][i] * DEG - w_ret); 137 | if (d2 >= DEG180) 138 | d2 -= DEG360; 139 | else if (d2 <= -DEG180) 140 | d2 += DEG360; 141 | dd = d2 - d_ret; /* second difference */ 142 | if (p == PLACALC_MOON || p == PLACALC_MERCURY) 143 | dd = swe_d2l(dd / 10.0); /* moon only 0.1" */ 144 | if (verbose && abs(dd) > abs(max_dd[ps])) 145 | max_dd[ps] = dd; 146 | e.elo[p].pd2[i-2] = dd; 147 | if (p == PLACALC_MOON || p == PLACALC_MERCURY) 148 | d_ret += e.elo[p].pd2[i-2] * 10L; 149 | else 150 | d_ret += e.elo[p].pd2[i-2]; 151 | w_ret += d_ret; 152 | if (verbose) { 153 | err = swe_difdeg2n(w_ret/360000.0, l[ps][i]); /* error */ 154 | if (fabs(err) > fabs(max_err[ps])) 155 | max_err[ps] = err; 156 | } 157 | } 158 | } /* for p */ 159 | #ifdef INTEL_BYTE_ORDER 160 | shortreorder((UCHAR *) &e, sizeof(struct ep4)); 161 | #endif 162 | fwrite (&e, sizeof(struct ep4), 1, ephfp); 163 | return (OK); 164 | } 165 | 166 | 167 | /*************************************/ 168 | char *degstr (t) 169 | double t; 170 | { 171 | static char a[20]; /* must survive call */ 172 | double min, sec; 173 | int ideg, imin; 174 | char sign = ' '; 175 | if ( t < 0) sign = '-'; 176 | t = fabs (t); 177 | ideg = (int) floor (t); 178 | min = ( t - ideg ) * 60.0; 179 | imin = (int) floor(min); 180 | sec = ( min - imin ) * 60.0; 181 | sprintf (a, "%c%3d %2d'%5.2f\"", sign, ideg, imin, sec); 182 | return (a); 183 | } /* degstr */ 184 | 185 | /********************************************************/ 186 | int eph_test() 187 | { 188 | char cal; 189 | int p, jday, jmon, jyear; 190 | double al, jd; 191 | centisec *cp; 192 | while (TRUE) { 193 | printf ("date ?"); 194 | if (scanf ("%d%d%d", &jday,&jmon,&jyear) < 1) exit(1); 195 | if (jyear < 1600) 196 | cal = 'j'; 197 | else 198 | cal = 'g'; 199 | swe_date_conversion (jyear, jmon, jday, 0, cal, &jd); 200 | if ((cp = ephread(jd, 0,0, errtext)) == NULL) { 201 | fprintf (stderr,"%s: %s", arg0, errtext); 202 | exit (1); 203 | } 204 | printf ("ephgen test d=%12.1f dmy %d.%d.%d", jd, jday, jmon, jyear); 205 | if (cal == 'g') 206 | printf (" greg"); 207 | else 208 | printf (" julian"); 209 | printf ("\n\tecliptic %s ", degstr(cp[EP_ECL_INDEX]*CS2DEG)); 210 | printf ("nutation %s\n", degstr(cp[EP_NUT_INDEX] * CS2DEG)); 211 | for (p = 0; p <= PLACALC_CHIRON; p++) { 212 | al = cp[p] * CS2DEG; 213 | printf ("%2d%18s\n", p, degstr(al)); 214 | } 215 | } 216 | } /* end ephtest */ 217 | 218 | int main(int argc, char **argv) 219 | { 220 | int day, i, n, p; 221 | char serr[AS_MAXCH]; 222 | double l[EPHR_NPL][NDB], ecliptic[NDB], nutation[NDB]; 223 | double jd0, jd; 224 | double x[6]; 225 | int32 jlong; 226 | int file; 227 | int nfiles = 1; 228 | int fnr = -10000; 229 | int32 iflagret; 230 | arg0 = argv[0]; 231 | for (i = 1; i < argc; i++) { 232 | if (strncmp(argv[i], "-f", 2) == 0) { 233 | fnr = atoi (argv[i] + 2); 234 | if (fnr < -20 || fnr > 300) { 235 | printf("file number out of range -20 ... 300"); 236 | exit (1); 237 | } 238 | } 239 | if (strncmp(argv[i], "-n", 2) == 0) { 240 | nfiles = atoi (argv[i] + 2); 241 | } 242 | if (strncmp(argv[i], "-v", 2) == 0) { 243 | verbose = TRUE; 244 | } 245 | if (strncmp(argv[i], "-t", 2) == 0) { 246 | eph_test(); 247 | exit(0); 248 | } 249 | } 250 | if (fnr == -10000) { 251 | fprintf(stderr,"missing file number -fNNN\n"); 252 | exit(1); 253 | } 254 | for (file = fnr; file < fnr + nfiles; file++) { 255 | if (file > fnr) printf ("\n"); 256 | printf ("file = %d\n", file); 257 | jd0 = EP4_NDAYS * file + 0.5; 258 | jlong = floor(jd0); 259 | if (eph4_posit (jlong, TRUE, errtext) != OK) { 260 | fprintf (stderr,"%s: %s", arg0, errtext); 261 | exit(1); 262 | } 263 | for (n = 0; n < EP4_NDAYS; n += NDB, jd0 += NDB) { 264 | if (n % 500 == 0) { 265 | if ( n > 0 && verbose) { 266 | printf ("\ndd"); 267 | for (p = 0; p < 11; p++) { 268 | printf("%6d ",max_dd[p]); 269 | max_dd[p] = 0; 270 | } 271 | printf("\ner"); 272 | for (p = 0; p < 11; p++) { 273 | printf("%6.3f ",max_err[p] * 3600); 274 | max_err[p] = 0; 275 | } 276 | } 277 | printf ("\n%d ", n); 278 | } else { 279 | printf ("."); 280 | } 281 | fflush( stdout ); 282 | for (day = 0; day < NDB; day++) { /* compute positions for 10 days */ 283 | jd = jd0 + day; 284 | for (p = PLACALC_SUN; p <= EP_CALC_N; p++) { 285 | if ((iflagret = swe_calc(jd, ephe_plac2swe(p), 0, x, serr)) == ERR) { 286 | swe_close(); 287 | printf("error in swe_calc() %s\n", serr); 288 | exit (1); 289 | } 290 | l[p][day] = x[0]; 291 | } 292 | if ((iflagret = swe_calc(jd, SE_ECL_NUT, 0, x, serr)) == ERR) { 293 | swe_close(); 294 | printf("error in swe_calc() %s\n", serr); 295 | exit (1); 296 | } 297 | ecliptic[day] = x[0]; 298 | nutation[day] = x[2]; 299 | } 300 | jlong = floor(jd0); 301 | eph4_pack (jlong, l, ecliptic, nutation); 302 | } 303 | putchar('\n'); 304 | fclose (ephfp); 305 | ephfp = NULL; 306 | } /* for file */ 307 | swe_close(); 308 | return(0); 309 | } /* end main */ 310 | -------------------------------------------------------------------------------- /sweph/src/swephlib.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************ 3 | 4 | Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich 5 | 6 | ************************************************************/ 7 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 8 | 9 | License conditions 10 | ------------------ 11 | 12 | This file is part of Swiss Ephemeris. 13 | 14 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 15 | or distributor accepts any responsibility for the consequences of using it, 16 | or for whether it serves any particular purpose or works at all, unless he 17 | or she says so in writing. 18 | 19 | Swiss Ephemeris is made available by its authors under a dual licensing 20 | system. The software developer, who uses any part of Swiss Ephemeris 21 | in his or her software, must choose between one of the two license models, 22 | which are 23 | a) GNU Affero General Public License (AGPL) 24 | b) Swiss Ephemeris Professional License 25 | 26 | The choice must be made before the software developer distributes software 27 | containing parts of Swiss Ephemeris to others, and before any public 28 | service using the developed software is activated. 29 | 30 | If the developer choses the AGPL software license, he or she must fulfill 31 | the conditions of that license, which includes the obligation to place his 32 | or her whole software project under the AGPL or a compatible license. 33 | See https://www.gnu.org/licenses/agpl-3.0.html 34 | 35 | If the developer choses the Swiss Ephemeris Professional license, 36 | he must follow the instructions as found in http://www.astro.com/swisseph/ 37 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 38 | and sign the corresponding license contract. 39 | 40 | The License grants you the right to use, copy, modify and redistribute 41 | Swiss Ephemeris, but only under certain conditions described in the License. 42 | Among other things, the License requires that the copyright notices and 43 | this notice be preserved on all copies. 44 | 45 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 46 | 47 | The authors of Swiss Ephemeris have no control or influence over any of 48 | the derived works, i.e. over software or services created by other 49 | programmers which use Swiss Ephemeris functions. 50 | 51 | The names of the authors or of the copyright holder (Astrodienst) must not 52 | be used for promoting any software, product or service which uses or contains 53 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 54 | names of the authors can legally appear, except in cases where they have 55 | given special permission in writing. 56 | 57 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 58 | for promoting such software, products or services. 59 | */ 60 | 61 | #define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */ 62 | #define PREC_IAU_2000_CTIES 2.0 /* J2000 +/- two centuries */ 63 | /* we use P03 for whole ephemeris */ 64 | #define PREC_IAU_2006_CTIES 75.0 /* J2000 +/- 75 centuries */ 65 | 66 | /* For reproducing JPL Horizons to 2 mas (SEFLG_JPLHOR): 67 | * The user has to keep the following files up to date which contain 68 | * the earth orientation parameters related to the IAU 1980 nutation 69 | * theory. 70 | * Download the file 71 | * datacenter.iers.org/eop/-/somos/5Rgv/document/tx13iers.u24/eopc04_08.62-now 72 | * and rename it as eop_1962_today.txt. For current data and estimations for 73 | * the near future, also download maia.usno.navy.mil/ser7/finals.all and 74 | * rename it as eop_finals.txt */ 75 | #define DPSI_DEPS_IAU1980_FILE_EOPC04 "eop_1962_today.txt" 76 | #define DPSI_DEPS_IAU1980_FILE_FINALS "eop_finals.txt" 77 | #define DPSI_DEPS_IAU1980_TJD0_HORIZONS 2437684.5 78 | #define HORIZONS_TJD0_DPSI_DEPS_IAU1980 2437684.5 79 | #define DPSI_IAU1980_TJD0 (64.284 / 1000.0) // arcsec 80 | #define DEPS_IAU1980_TJD0 (6.151 / 1000.0) // arcsec 81 | 82 | /* The above files must be available in order to reproduce JPL Horizons 83 | * in agreement with IERS Conventions 1996 (1992), p. 22. 84 | * Call swe_calc_ut() with iflag|SEFLG_JPLHOR. 85 | * This options works only, if the files DPSI_DEPS_IAU1980_FILE_EOPC04 86 | * and DPSI_DEPS_IAU1980_FILE_FINALS are in the ephemeris path. 87 | * 88 | * If the software does not find the earth orientation files 89 | * in the ephemeris path, then SEFLG_JPLHOR will run as 90 | * SEFLG_JPLHOR_APPROX. 91 | */ 92 | 93 | /* coordinate transformation */ 94 | extern void swi_coortrf(double *xpo, double *xpn, double eps); 95 | 96 | /* coordinate transformation */ 97 | extern void swi_coortrf2(double *xpo, double *xpn, double sineps, double coseps); 98 | 99 | /* cartesian to polar coordinates */ 100 | extern void swi_cartpol(double *x, double *l); 101 | 102 | /* cartesian to polar coordinates with velocity */ 103 | extern void swi_cartpol_sp(double *x, double *l); 104 | extern void swi_polcart_sp(double *l, double *x); 105 | 106 | /* polar to cartesian coordinates */ 107 | extern void swi_polcart(double *l, double *x); 108 | 109 | /* GCRS to J2000 */ 110 | extern void swi_bias(double *x, double tjd, int32 iflag, AS_BOOL backward); 111 | extern void swi_get_eop_time_range(void); 112 | /* GCRS to FK5 */ 113 | extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward); 114 | 115 | /* precession */ 116 | extern int swi_precess(double *R, double J, int32 iflag, int direction ); 117 | extern void swi_precess_speed(double *xx, double t, int32 iflag, int direction); 118 | 119 | extern int32 swi_guess_ephe_flag(void); 120 | 121 | /* from sweph.c, light deflection, aberration, etc. */ 122 | extern void swi_deflect_light(double *xx, double dt, int32 iflag); 123 | extern void swi_aberr_light(double *xx, double *xe, int32 iflag); 124 | extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx); 125 | extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag); 126 | extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, int32 iflag); 127 | extern int swi_get_observer(double tjd, int32 iflag, 128 | AS_BOOL do_save, double *xobs, char *serr); 129 | extern void swi_force_app_pos_etc(void); 130 | 131 | /* obliquity of ecliptic */ 132 | extern void swi_check_ecliptic(double tjd, int32 iflag); 133 | extern double swi_epsiln(double J, int32 iflag); 134 | extern void swi_ldp_peps(double J, double *dpre, double *deps); 135 | 136 | /* nutation */ 137 | extern void swi_check_nutation(double tjd, int32 iflag); 138 | extern int swi_nutation(double J, int32 iflag, double *nutlo); 139 | extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward); 140 | 141 | extern void swi_mean_lunar_elements(double tjd, 142 | double *node, double *dnode, 143 | double *peri, double *dperi); 144 | /* */ 145 | extern double swi_mod2PI(double x); 146 | 147 | /* evaluation of chebyshew series and derivative */ 148 | extern double swi_echeb(double x, double *coef, int ncf); 149 | extern double swi_edcheb(double x, double *coef, int ncf); 150 | 151 | /* cross product of vectors */ 152 | extern void swi_cross_prod(double *a, double *b, double *x); 153 | /* dot product of vecotrs */ 154 | extern double swi_dot_prod_unit(double *x, double *y); 155 | 156 | extern double swi_angnorm(double x); 157 | 158 | /* generation of SWISSEPH file names */ 159 | extern void swi_gen_filename(double tjd, int ipli, char *fname); 160 | 161 | /* cyclic redundancy checksum (CRC), 32 bit */ 162 | extern uint32 swi_crc32(unsigned char *buf, int len); 163 | 164 | extern int swi_cutstr(char *s, char *cutlist, char *cpos[], int nmax); 165 | extern char *swi_right_trim(char *s); 166 | 167 | extern double swi_kepler(double E, double M, double ecce); 168 | 169 | extern char *swi_get_fict_name(int32 ipl, char *s); 170 | 171 | extern void swi_FK4_FK5(double *xp, double tjd); 172 | 173 | extern char *swi_strcpy(char *to, char *from); 174 | extern char *swi_strncpy(char *to, char *from, size_t n); 175 | 176 | extern double swi_deltat_ephe(double tjd_ut, int32 epheflag); 177 | 178 | #ifdef TRACE 179 | # define TRACE_COUNT_MAX 10000 180 | extern TLS FILE *swi_fp_trace_c; 181 | extern TLS FILE *swi_fp_trace_out; 182 | extern TLS int32 swi_trace_count; 183 | extern void swi_open_trace(char *serr); 184 | static const char *fname_trace_c = "swetrace.c"; 185 | static const char *fname_trace_out = "swetrace.txt"; 186 | #ifdef FORCE_IFLAG 187 | static const char *fname_force_flg = "force.flg"; 188 | #endif 189 | #endif /* TRACE */ 190 | -------------------------------------------------------------------------------- /sweph/src/swevents.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved. 2 | 3 | License conditions 4 | ------------------ 5 | 6 | This file is part of Swiss Ephemeris. 7 | 8 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 9 | or distributor accepts any responsibility for the consequences of using it, 10 | or for whether it serves any particular purpose or works at all, unless he 11 | or she says so in writing. 12 | 13 | Swiss Ephemeris is made available by its authors under a dual licensing 14 | system. The software developer, who uses any part of Swiss Ephemeris 15 | in his or her software, must choose between one of the two license models, 16 | which are 17 | a) GNU Affero General Public License (AGPL) 18 | b) Swiss Ephemeris Professional License 19 | 20 | The choice must be made before the software developer distributes software 21 | containing parts of Swiss Ephemeris to others, and before any public 22 | service using the developed software is activated. 23 | 24 | If the developer choses the AGPL software license, he or she must fulfill 25 | the conditions of that license, which includes the obligation to place his 26 | or her whole software project under the AGPL or a compatible license. 27 | See https://www.gnu.org/licenses/agpl-3.0.html 28 | 29 | If the developer choses the Swiss Ephemeris Professional license, 30 | he must follow the instructions as found in http://www.astro.com/swisseph/ 31 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 32 | and sign the corresponding license contract. 33 | 34 | The License grants you the right to use, copy, modify and redistribute 35 | Swiss Ephemeris, but only under certain conditions described in the License. 36 | Among other things, the License requires that the copyright notices and 37 | this notice be preserved on all copies. 38 | 39 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 40 | 41 | The authors of Swiss Ephemeris have no control or influence over any of 42 | the derived works, i.e. over software or services created by other 43 | programmers which use Swiss Ephemeris functions. 44 | 45 | The names of the authors or of the copyright holder (Astrodienst) must not 46 | be used for promoting any software, product or service which uses or contains 47 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 48 | names of the authors can legally appear, except in cases where they have 49 | given special permission in writing. 50 | 51 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 52 | for promoting such software, products or services. 53 | */ 54 | #define TTINY 0.000001 55 | #define TENTHOFSEC (1.0 / 86400.0) 56 | #define HUNDTHOFSEC (1.0 / 864000.0) 57 | 58 | #define NEVENTMAX 100000 59 | #define EVENT struct event 60 | struct event { 61 | double tjd; 62 | int32 evtype; 63 | int32 ipla; 64 | int32 iplb; /* needed for aspects, occultations, */ 65 | char stnama[40]; 66 | char stnamb[40]; 67 | int32 iasp; 68 | int32 bpind; /* body pair index: ipl1 * 50 + ipl2 */ 69 | double dasp; 70 | double dang; 71 | int32 isign; /* needed for ingresses */ 72 | int32 backward; /* needed for ingresses */ 73 | double dorb; 74 | double dret; /* content depends on event type */ 75 | }; 76 | 77 | struct aspdat { 78 | double tjd; 79 | int32 iasp; 80 | double tjd_pre; 81 | double tjd_post; 82 | int32 fpos_tjd_post; 83 | }; 84 | 85 | #define CTYP_MASPECTS 0 86 | #define CTYP_INGRESSES 1 87 | #define CTYP_TRANSITS 2 88 | #define CTYP_VOC 3 89 | 90 | #define SPLAN_INGRESS "0123456789mtAFD" 91 | #define SPLAN_ASPECTS "0123456789mtAFD,a[136199],f[Gal]" 92 | /*#define SPLAN_ASPECTS "0123456789mtAFD,f[Gal],f[Ald],a[136199],a[433]"*/ 93 | #define SASP_ASPECTS "1234567" 94 | 95 | /* void-of-course moon calculation */ 96 | #define VOC struct voc 97 | 98 | VOC { 99 | double tvoc; /* time of begin of voc phase */ 100 | double tingr; /* time of ingress that ends voc phase */ 101 | double tingr0; /* time of first ingress, if there are two ingresses 102 | * during voc phase */ 103 | char casp, cpl; /* aspect and planet that marks begin of voc phase */ 104 | int isign_voc; /* sign in which moon begins voc phase */ 105 | int isign_ingr; /* sign of ingress that ends voc phase */ 106 | int isign_ingr0; /* sign of first ingress, if there are two ingresses 107 | * during voc phase */ 108 | }; 109 | 110 | #define INGRESS struct ingress 111 | 112 | INGRESS { 113 | int ipl; /* planet that makes ingress */ 114 | double tingr; /* time of ingress */ 115 | int isign; /* sign of ingress */ 116 | int direction; /* direct/retrograde: 1 or -1 */ 117 | int ino; /* number of transit over this sign boundary */ 118 | }; 119 | -------------------------------------------------------------------------------- /tests/perl_test.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 57 | --EXPECT-- 58 | swe_cotrans(80, 5, 0, -23) like perl line 21 59 | array(3) { 60 | [0]=> 61 | float(78.741) 62 | [1]=> 63 | float(27.616) 64 | [2]=> 65 | float(0) 66 | } 67 | swe_cotrans_sp(80, 5, 0, 1, 0, 0, -23) like perl line 25 68 | array(6) { 69 | [0]=> 70 | float(78.741) 71 | [1]=> 72 | float(27.616) 73 | [2]=> 74 | float(0) 75 | [3]=> 76 | float(1.12) 77 | [4]=> 78 | float(0.076) 79 | [5]=> 80 | float(0) 81 | } 82 | swe_deltat(2451545) like perl line 34 83 | array(1) { 84 | [0]=> 85 | float(63.828) 86 | } 87 | swe_deltat_ex(2451545, SEFLG_MOSEPH) like perl line 36 88 | array(1) { 89 | [0]=> 90 | float(63.828) 91 | } 92 | swe_pheno(2415020.5, 3, SEFLG_MOSEPH), like perl line 246 93 | Venus retflag = 4 100 94 | array(2) { 95 | ["retflag"]=> 96 | int(4) 97 | ["attr"]=> 98 | array(6) { 99 | [0]=> 100 | float(36.744) 101 | [1]=> 102 | float(0.9) 103 | [2]=> 104 | float(26.271) 105 | [3]=> 106 | float(0.003) 107 | [4]=> 108 | float(-3.91) 109 | [5]=> 110 | float(0) 111 | } 112 | } 113 | swe_lun_occult_where for Venus, like perl line 370 114 | float(2454531.296945) 115 | string(20) "2008 3 5 19:7:36 UT" 116 | array(3) { 117 | ["retflag"]=> 118 | int(5) 119 | ["geopos"]=> 120 | array(2) { 121 | [0]=> 122 | float(-132.448226) 123 | [1]=> 124 | float(-3.224077) 125 | } 126 | ["attr"]=> 127 | array(8) { 128 | [0]=> 129 | float(86.757446) 130 | [1]=> 131 | float(172.526683) 132 | [2]=> 133 | float(29765.456543) 134 | [3]=> 135 | float(-3461.913794) 136 | [4]=> 137 | float(336.205691) 138 | [5]=> 139 | float(76.844797) 140 | [6]=> 141 | float(76.848587) 142 | [7]=> 143 | float(1.8E-5) 144 | } 145 | } 146 | swe_lun_occult_when_loc for Venus, like perl line 437 147 | array(3) { 148 | ["retflag"]=> 149 | int(8070) 150 | ["tret"]=> 151 | array(8) { 152 | [0]=> 153 | float(2454802.198) 154 | [1]=> 155 | float(2454802.169) 156 | [2]=> 157 | float(2454802.17) 158 | [3]=> 159 | float(2454802.225) 160 | [4]=> 161 | float(2454802.225) 162 | [5]=> 163 | float(0) 164 | [6]=> 165 | float(0) 166 | [7]=> 167 | float(0) 168 | } 169 | ["attr"]=> 170 | array(10) { 171 | [0]=> 172 | float(32.399) 173 | [1]=> 174 | float(106.892) 175 | [2]=> 176 | float(11426.043) 177 | [3]=> 178 | float(-3452.982) 179 | [4]=> 180 | float(33.358) 181 | [5]=> 182 | float(11.69) 183 | [6]=> 184 | float(11.762) 185 | [7]=> 186 | float(0.099) 187 | [8]=> 188 | float(0) 189 | [9]=> 190 | float(0) 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /tests/swe_azalt_refrac.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 49 | --EXPECT-- 50 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 317.13145, -8.1E-5) 51 | planet Sun lon=317.131450 lat=-0.000081 52 | horizon coordinates 53 | array(3) { 54 | [0]=> 55 | float(31.000508) 56 | [1]=> 57 | float(19.979725) 58 | [2]=> 59 | float(20.019722) 60 | } 61 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 31.000508, 19.979725) 62 | converted back lon=317.131450 lat=-0.000081 63 | swe_refrac(19.979725, 0, 30, SE_TRUE_TO_APP) 64 | app. alt = 19.979725 65 | swe_refrac_extended(19.979725, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 66 | array(6) { 67 | ["rc"]=> 68 | int(19) 69 | [0]=> 70 | float(19.979725) 71 | [1]=> 72 | float(19.976138) 73 | [2]=> 74 | float(-0.003586) 75 | [3]=> 76 | float(-0.582825) 77 | ["retflag"]=> 78 | float(19) 79 | } 80 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 309.888398, -1.616416) 81 | planet Moon lon=309.888398 lat=-1.616416 82 | horizon coordinates 83 | array(3) { 84 | [0]=> 85 | float(35.830421) 86 | [1]=> 87 | float(14.168707) 88 | [2]=> 89 | float(14.225327) 90 | } 91 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 35.830421, 14.168707) 92 | converted back lon=309.888398 lat=-1.616416 93 | swe_refrac(14.168707, 0, 30, SE_TRUE_TO_APP) 94 | app. alt = 14.168707 95 | swe_refrac_extended(14.168707, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 96 | array(6) { 97 | ["rc"]=> 98 | int(14) 99 | [0]=> 100 | float(14.168707) 101 | [1]=> 102 | float(14.163619) 103 | [2]=> 104 | float(-0.005087) 105 | [3]=> 106 | float(-0.582825) 107 | ["retflag"]=> 108 | float(14) 109 | } 110 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 317.58169, 3.572776) 111 | planet Mercury lon=317.581690 lat=3.572776 112 | horizon coordinates 113 | array(3) { 114 | [0]=> 115 | float(33.015527) 116 | [1]=> 117 | float(23.054618) 118 | [2]=> 119 | float(23.088823) 120 | } 121 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 33.015527, 23.054618) 122 | converted back lon=317.581690 lat=3.572775 123 | swe_refrac(23.054618, 0, 30, SE_TRUE_TO_APP) 124 | app. alt = 23.054618 125 | swe_refrac_extended(23.054618, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 126 | array(6) { 127 | ["rc"]=> 128 | int(23) 129 | [0]=> 130 | float(23.054618) 131 | [1]=> 132 | float(23.051552) 133 | [2]=> 134 | float(-0.003065) 135 | [3]=> 136 | float(-0.582825) 137 | ["retflag"]=> 138 | float(23) 139 | } 140 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 286.274617, 0.458249) 141 | planet Venus lon=286.274617 lat=0.458249 142 | horizon coordinates 143 | array(3) { 144 | [0]=> 145 | float(55.087222) 146 | [1]=> 147 | float(0.074098) 148 | [2]=> 149 | float(0.490624) 150 | } 151 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 55.087222, 0.074098) 152 | converted back lon=286.274617 lat=0.458248 153 | swe_refrac(0.074098, 0, 30, SE_TRUE_TO_APP) 154 | app. alt = 0.074098 155 | swe_refrac_extended(0.074098, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 156 | array(6) { 157 | ["rc"]=> 158 | int(0) 159 | [0]=> 160 | float(0.074098) 161 | [1]=> 162 | float(0.030373) 163 | [2]=> 164 | float(-0.043724) 165 | [3]=> 166 | float(-0.582825) 167 | ["retflag"]=> 168 | float(0) 169 | } 170 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 84.347673, 3.269827) 171 | planet Mars lon=84.347673 lat=3.269827 172 | horizon coordinates 173 | array(3) { 174 | [0]=> 175 | float(249.152268) 176 | [1]=> 177 | float(17.317286) 178 | [2]=> 179 | float(17.363767) 180 | } 181 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 249.152268, 17.317286) 182 | converted back lon=84.347673 lat=3.269826 183 | swe_refrac(17.317286, 0, 30, SE_TRUE_TO_APP) 184 | app. alt = 17.317286 185 | swe_refrac_extended(17.317286, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 186 | array(6) { 187 | ["rc"]=> 188 | int(17) 189 | [0]=> 190 | float(17.317286) 191 | [1]=> 192 | float(17.313115) 193 | [2]=> 194 | float(-0.00417) 195 | [3]=> 196 | float(-0.582825) 197 | ["retflag"]=> 198 | float(17) 199 | } 200 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 281.081048, 0.116115) 201 | planet Jupiter lon=281.081048 lat=0.116115 202 | horizon coordinates 203 | array(3) { 204 | [0]=> 205 | float(58.699496) 206 | [1]=> 207 | float(-3.675366) 208 | [2]=> 209 | float(-3.675366) 210 | } 211 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 58.699496, -3.675366) 212 | converted back lon=281.081048 lat=0.116114 213 | swe_refrac(-3.675366, 0, 30, SE_TRUE_TO_APP) 214 | app. alt = -3.675366 215 | swe_refrac_extended(-3.675366, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 216 | array(6) { 217 | ["rc"]=> 218 | int(-3) 219 | [0]=> 220 | float(-3.675366) 221 | [1]=> 222 | float(-3.675366) 223 | [2]=> 224 | float(0) 225 | [3]=> 226 | float(-0.582825) 227 | ["retflag"]=> 228 | float(-3) 229 | } 230 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 156.55664, 1.807919) 231 | planet Saturn lon=156.556640 lat=1.807919 232 | horizon coordinates 233 | array(3) { 234 | [0]=> 235 | float(192.185197) 236 | [1]=> 237 | float(-29.463313) 238 | [2]=> 239 | float(-29.463313) 240 | } 241 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 192.185197, -29.463313) 242 | converted back lon=156.556639 lat=1.807919 243 | swe_refrac(-29.463313, 0, 30, SE_TRUE_TO_APP) 244 | app. alt = -29.463313 245 | swe_refrac_extended(-29.463313, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 246 | array(6) { 247 | ["rc"]=> 248 | int(-29) 249 | [0]=> 250 | float(-29.463313) 251 | [1]=> 252 | float(-29.463313) 253 | [2]=> 254 | float(0) 255 | [3]=> 256 | float(-0.582825) 257 | ["retflag"]=> 258 | float(-29) 259 | } 260 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 346.911442, -0.738805) 261 | planet Uranus lon=346.911442 lat=-0.738805 262 | horizon coordinates 263 | array(3) { 264 | [0]=> 265 | float(1.848703) 266 | [1]=> 267 | float(35.134978) 268 | [2]=> 269 | float(35.15571) 270 | } 271 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 1.848703, 35.134978) 272 | converted back lon=346.911442 lat=-0.738805 273 | swe_refrac(35.134978, 0, 30, SE_TRUE_TO_APP) 274 | app. alt = 35.134978 275 | swe_refrac_extended(35.134978, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 276 | array(6) { 277 | ["rc"]=> 278 | int(35) 279 | [0]=> 280 | float(35.134978) 281 | [1]=> 282 | float(35.133121) 283 | [2]=> 284 | float(-0.001856) 285 | [3]=> 286 | float(-0.582825) 287 | ["retflag"]=> 288 | float(35) 289 | } 290 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 321.544644, -0.29238) 291 | planet Neptune lon=321.544644 lat=-0.292380 292 | horizon coordinates 293 | array(3) { 294 | [0]=> 295 | float(27.052451) 296 | [1]=> 297 | float(22.432808) 298 | [2]=> 299 | float(22.468063) 300 | } 301 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 27.052451, 22.432808) 302 | converted back lon=321.544643 lat=-0.292380 303 | swe_refrac(22.432808, 0, 30, SE_TRUE_TO_APP) 304 | app. alt = 22.432808 305 | swe_refrac_extended(22.432808, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 306 | array(6) { 307 | ["rc"]=> 308 | int(22) 309 | [0]=> 310 | float(22.432808) 311 | [1]=> 312 | float(22.429647) 313 | [2]=> 314 | float(-0.00316) 315 | [3]=> 316 | float(-0.582825) 317 | ["retflag"]=> 318 | float(22) 319 | } 320 | swe_azalt(2454503.06, SE_ECL2HOR, 12.1, 49, 330, 0, 30, 270.338455, 6.283563) 321 | planet Pluto lon=270.338455 lat=6.283563 322 | horizon coordinates 323 | array(3) { 324 | [0]=> 325 | float(70.859346) 326 | [1]=> 327 | float(-6.169858) 328 | [2]=> 329 | float(-6.169858) 330 | } 331 | swe_azalt_rev(2454503.06, SE_HOR2ECL, 12.1, 49, 330, 70.859346, -6.169858) 332 | converted back lon=270.338456 lat=6.283563 333 | swe_refrac(-6.169858, 0, 30, SE_TRUE_TO_APP) 334 | app. alt = -6.169858 335 | swe_refrac_extended(-6.169858, 330, 0, 30, 10.0, SE_TRUE_TO_APP) 336 | array(6) { 337 | ["rc"]=> 338 | int(-6) 339 | [0]=> 340 | float(-6.169858) 341 | [1]=> 342 | float(-6.169858) 343 | [2]=> 344 | float(0) 345 | [3]=> 346 | float(-0.582825) 347 | ["retflag"]=> 348 | float(-6) 349 | } 350 | -------------------------------------------------------------------------------- /tests/swe_calc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(8) { 17 | [0]=> 18 | float(280.382968) 19 | [1]=> 20 | float(0.000149) 21 | [2]=> 22 | float(0.983297) 23 | [3]=> 24 | float(1.018877) 25 | [4]=> 26 | float(1.7E-5) 27 | [5]=> 28 | float(-1.0E-5) 29 | ["serr"]=> 30 | string(0) "" 31 | ["rc"]=> 32 | int(258) 33 | } 34 | -------------------------------------------------------------------------------- /tests/swe_calc_pctr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(8) { 17 | [0]=> 18 | float(115.594557) 19 | [1]=> 20 | float(2.05413) 21 | [2]=> 22 | float(1.232681) 23 | [3]=> 24 | float(1.572858) 25 | [4]=> 26 | float(-0.050397) 27 | [5]=> 28 | float(-0.018083) 29 | ["serr"]=> 30 | string(0) "" 31 | ["rc"]=> 32 | int(258) 33 | } 34 | -------------------------------------------------------------------------------- /tests/swe_calc_ut.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(8) { 17 | [0]=> 18 | float(280.382968) 19 | [1]=> 20 | float(0.000149) 21 | [2]=> 22 | float(0.983297) 23 | [3]=> 24 | float(1.018877) 25 | [4]=> 26 | float(1.7E-5) 27 | [5]=> 28 | float(-1.0E-5) 29 | ["serr"]=> 30 | string(0) "" 31 | ["rc"]=> 32 | int(258) 33 | } 34 | -------------------------------------------------------------------------------- /tests/swe_close.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | NULL 15 | -------------------------------------------------------------------------------- /tests/swe_cotrans.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(3) { 17 | [0]=> 18 | float(114.119848) 19 | [1]=> 20 | float(22.754921) 21 | [2]=> 22 | float(1) 23 | } 24 | -------------------------------------------------------------------------------- /tests/swe_cotrans_sp.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(6) { 17 | [0]=> 18 | float(114.119848) 19 | [1]=> 20 | float(22.754921) 21 | [2]=> 22 | float(1) 23 | [3]=> 24 | float(-0.493672) 25 | [4]=> 26 | float(5.538766) 27 | [5]=> 28 | float(1) 29 | } 30 | -------------------------------------------------------------------------------- /tests/swe_cs2degstr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | string(9) " 4°47'17" 16 | -------------------------------------------------------------------------------- /tests/swe_cs2lonlatstr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | string(9) "274 47'17" 17 | string(9) "274.47'17" 18 | -------------------------------------------------------------------------------- /tests/swe_cs2timestr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | string(8) "23:36:00" 16 | string(5) "23:36" 17 | -------------------------------------------------------------------------------- /tests/swe_csnorm.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | int(0) 17 | int(64800000) 18 | int(0) 19 | -------------------------------------------------------------------------------- /tests/swe_csroundsec.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | int(100) 17 | int(200) 18 | int(595900) 19 | -------------------------------------------------------------------------------- /tests/swe_d2l.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | int(90) 16 | int(91) 17 | -------------------------------------------------------------------------------- /tests/swe_date_conversion_invalid.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test return NULL. 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | NULL 15 | -------------------------------------------------------------------------------- /tests/swe_date_conversion_valid.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test return float/double. 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | float(2452275.5) 15 | -------------------------------------------------------------------------------- /tests/swe_day_of_week.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | int(1) 15 | -------------------------------------------------------------------------------- /tests/swe_deg_midp.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(90) 16 | float(270) 17 | -------------------------------------------------------------------------------- /tests/swe_degnorm.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | float(0) 18 | float(0) 19 | float(359) 20 | -------------------------------------------------------------------------------- /tests/swe_deltat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | float(64.300074) 17 | -------------------------------------------------------------------------------- /tests/swe_deltat_ex.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 19 | --EXPECT-- 20 | float(64.300074) 21 | -------------------------------------------------------------------------------- /tests/swe_difcs2n.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | int(-64800000) 15 | -------------------------------------------------------------------------------- /tests/swe_difcsn.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | int(64800000) 15 | -------------------------------------------------------------------------------- /tests/swe_difdeg2n.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | float(-179.5) 15 | -------------------------------------------------------------------------------- /tests/swe_difdegn.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | float(180.5) 15 | -------------------------------------------------------------------------------- /tests/swe_difrad2n.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | float(-3.141592) 15 | -------------------------------------------------------------------------------- /tests/swe_fixstar.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 24 | --EXPECT-- 25 | swe_fixstar 26 | array(9) { 27 | [0]=> 28 | float(104.112149) 29 | [1]=> 30 | float(-39.605526) 31 | [2]=> 32 | float(543929.857182) 33 | [3]=> 34 | float(0) 35 | [4]=> 36 | float(0) 37 | [5]=> 38 | float(0) 39 | ["star"]=> 40 | string(12) "Sirius,alCMa" 41 | ["serr"]=> 42 | string(0) "" 43 | ["rc"]=> 44 | int(2) 45 | } 46 | swe_fixstar2 47 | array(9) { 48 | [0]=> 49 | float(104.112149) 50 | [1]=> 51 | float(-39.605526) 52 | [2]=> 53 | float(543929.857182) 54 | [3]=> 55 | float(0) 56 | [4]=> 57 | float(0) 58 | [5]=> 59 | float(0) 60 | ["star"]=> 61 | string(12) "Sirius,alCMa" 62 | ["serr"]=> 63 | string(0) "" 64 | ["rc"]=> 65 | int(2) 66 | } 67 | swe_fixstar_ut 68 | array(9) { 69 | [0]=> 70 | float(38.647424) 71 | [1]=> 72 | float(89.276469) 73 | [2]=> 74 | float(27356067.783757) 75 | [3]=> 76 | float(0) 77 | [4]=> 78 | float(0) 79 | [5]=> 80 | float(0) 81 | ["star"]=> 82 | string(13) "Polaris,alUMi" 83 | ["serr"]=> 84 | string(0) "" 85 | ["rc"]=> 86 | int(2050) 87 | } 88 | swe_fixstar2_ut 89 | array(9) { 90 | [0]=> 91 | float(38.647424) 92 | [1]=> 93 | float(89.276469) 94 | [2]=> 95 | float(27356067.783757) 96 | [3]=> 97 | float(0) 98 | [4]=> 99 | float(0) 100 | [5]=> 101 | float(0) 102 | ["star"]=> 103 | string(13) "Polaris,alUMi" 104 | ["serr"]=> 105 | string(0) "" 106 | ["rc"]=> 107 | int(2050) 108 | } 109 | swe_fixstar2_mag 110 | array(4) { 111 | ["mag"]=> 112 | float(-1.46) 113 | ["star"]=> 114 | string(12) "Sirius,alCMa" 115 | ["serr"]=> 116 | string(0) "" 117 | ["rc"]=> 118 | int(0) 119 | } 120 | -------------------------------------------------------------------------------- /tests/swe_fixstar_overrun.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test str length. 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 32 | --EXPECT-- 33 | swe_fixstar 34 | array(9) { 35 | [0]=> 36 | float(0) 37 | [1]=> 38 | float(0) 39 | [2]=> 40 | float(0) 41 | [3]=> 42 | float(0) 43 | [4]=> 44 | float(0) 45 | [5]=> 46 | float(0) 47 | ["star"]=> 48 | string(40) "1234567890123456789012345678901234567890" 49 | ["serr"]=> 50 | string(55) "star 1234567890123456789012345678901234567890 not found" 51 | ["rc"]=> 52 | int(-1) 53 | } 54 | swe_fixstar2 55 | array(9) { 56 | [0]=> 57 | float(0) 58 | [1]=> 59 | float(0) 60 | [2]=> 61 | float(0) 62 | [3]=> 63 | float(0) 64 | [4]=> 65 | float(0) 66 | [5]=> 67 | float(0) 68 | ["star"]=> 69 | string(40) "1234567890123456789012345678901234567890" 70 | ["serr"]=> 71 | string(87) "error, swe_fixstar(): could not find star name 1234567890123456789012345678901234567890" 72 | ["rc"]=> 73 | int(-1) 74 | } 75 | swe_fixstar_ut 76 | array(9) { 77 | [0]=> 78 | float(0) 79 | [1]=> 80 | float(0) 81 | [2]=> 82 | float(0) 83 | [3]=> 84 | float(0) 85 | [4]=> 86 | float(0) 87 | [5]=> 88 | float(0) 89 | ["star"]=> 90 | string(40) "1234567890123456789012345678901234567890" 91 | ["serr"]=> 92 | string(55) "star 1234567890123456789012345678901234567890 not found" 93 | ["rc"]=> 94 | int(-1) 95 | } 96 | swe_fixstar2_ut 97 | array(9) { 98 | [0]=> 99 | float(0) 100 | [1]=> 101 | float(0) 102 | [2]=> 103 | float(0) 104 | [3]=> 105 | float(0) 106 | [4]=> 107 | float(0) 108 | [5]=> 109 | float(0) 110 | ["star"]=> 111 | string(40) "1234567890123456789012345678901234567890" 112 | ["serr"]=> 113 | string(87) "error, swe_fixstar(): could not find star name 1234567890123456789012345678901234567890" 114 | ["rc"]=> 115 | int(-1) 116 | } 117 | swe_fixstar2_mag 118 | array(3) { 119 | ["star"]=> 120 | string(40) "1234567890123456789012345678901234567890" 121 | ["serr"]=> 122 | string(87) "error, swe_fixstar(): could not find star name 1234567890123456789012345678901234567890" 123 | ["rc"]=> 124 | int(-1) 125 | } 126 | -------------------------------------------------------------------------------- /tests/swe_gauquelin_sector.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(2) { 17 | ["rc"]=> 18 | int(0) 19 | ["gsect"]=> 20 | float(36.207748) 21 | } 22 | -------------------------------------------------------------------------------- /tests/swe_get_ayanamsa.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(24.768238) 16 | -------------------------------------------------------------------------------- /tests/swe_get_ayanamsa_ex.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(2) { 18 | ["daya"]=> 19 | float(24.763655) 20 | ["rc"]=> 21 | int(2) 22 | } 23 | array(2) { 24 | ["daya"]=> 25 | float(24.768237) 26 | ["rc"]=> 27 | int(66) 28 | } 29 | -------------------------------------------------------------------------------- /tests/swe_get_ayanamsa_ex_ut.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(2) { 18 | ["daya"]=> 19 | float(24.763655) 20 | ["rc"]=> 21 | int(2) 22 | } 23 | array(2) { 24 | ["daya"]=> 25 | float(24.768237) 26 | ["rc"]=> 27 | int(66) 28 | } 29 | -------------------------------------------------------------------------------- /tests/swe_get_ayanamsa_name.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | string(13) "Fagan/Bradley" 16 | -------------------------------------------------------------------------------- /tests/swe_get_ayanamsa_ut.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(24.768238) 16 | -------------------------------------------------------------------------------- /tests/swe_get_current_file_data.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(4) { 18 | ["path"]=> 19 | string(24) "./sweph/ephe/semo_18.se1" 20 | ["tfstart"]=> 21 | float(2378487.55537) 22 | ["tfend"]=> 23 | float(2597656.457452) 24 | ["denum"]=> 25 | int(431) 26 | } 27 | -------------------------------------------------------------------------------- /tests/swe_get_library_path.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | string(18) "/modules/swephp.so" 16 | -------------------------------------------------------------------------------- /tests/swe_get_planet_name.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | string(7) "Neptune" 15 | -------------------------------------------------------------------------------- /tests/swe_heliacal_pheno_ut.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(31) { 17 | ["rc"]=> 18 | int(0) 19 | [0]=> 20 | float(5.416663) 21 | [1]=> 22 | float(5.563551) 23 | [2]=> 24 | float(5.418086) 25 | [3]=> 26 | float(130.262291) 27 | [4]=> 28 | float(3.943499) 29 | [5]=> 30 | float(127.365385) 31 | [6]=> 32 | float(1.473164) 33 | [7]=> 34 | float(1.474586) 35 | [8]=> 36 | float(-2.896906) 37 | [9]=> 38 | float(3.250326) 39 | [10]=> 40 | float(0.266695) 41 | [11]=> 42 | float(-14.142036) 43 | [12]=> 44 | float(2452275.478566) 45 | [13]=> 46 | float(2452275.478567) 47 | [14]=> 48 | float(99999999) 49 | [15]=> 50 | float(99999999) 51 | [16]=> 52 | float(0) 53 | [17]=> 54 | float(0) 55 | [18]=> 56 | float(0) 57 | [19]=> 58 | float(0.001422) 59 | [20]=> 60 | float(-3.912729) 61 | [21]=> 62 | float(2452275.471343) 63 | [22]=> 64 | float(2452275.478913) 65 | [23]=> 66 | float(-0.00757) 67 | [24]=> 68 | float(99999999) 69 | [25]=> 70 | float(0) 71 | [26]=> 72 | float(3.247819) 73 | [27]=> 74 | float(99.852992) 75 | [28]=> 76 | float(0) 77 | [29]=> 78 | float(0) 79 | } 80 | -------------------------------------------------------------------------------- /tests/swe_heliacal_ut.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(4) { 17 | ["rc"]=> 18 | int(0) 19 | [0]=> 20 | float(2452586.417484) 21 | [1]=> 22 | float(2452586.424) 23 | [2]=> 24 | float(2452586.43135) 25 | } 26 | -------------------------------------------------------------------------------- /tests/swe_helio_cross.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(3) { 18 | ["serr"]=> 19 | string(0) "" 20 | ["rc"]=> 21 | int(0) 22 | ["jx"]=> 23 | float(2461855.380331) 24 | } 25 | array(3) { 26 | ["serr"]=> 27 | string(0) "" 28 | ["rc"]=> 29 | int(0) 30 | ["jx"]=> 31 | float(2461855.379534) 32 | } 33 | -------------------------------------------------------------------------------- /tests/swe_house_name.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | string(8) "Placidus" 15 | -------------------------------------------------------------------------------- /tests/swe_houses.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(3) { 16 | ["cusps"]=> 17 | array(13) { 18 | [0]=> 19 | float(0) 20 | [1]=> 21 | float(191.098936) 22 | [2]=> 23 | float(222.650399) 24 | [3]=> 25 | float(251.723822) 26 | [4]=> 27 | float(279.376846) 28 | [5]=> 29 | float(307.790747) 30 | [6]=> 31 | float(338.578256) 32 | [7]=> 33 | float(11.098936) 34 | [8]=> 35 | float(42.650399) 36 | [9]=> 37 | float(71.723822) 38 | [10]=> 39 | float(99.376846) 40 | [11]=> 41 | float(127.790747) 42 | [12]=> 43 | float(158.578256) 44 | } 45 | ["ascmc"]=> 46 | array(10) { 47 | [0]=> 48 | float(191.098936) 49 | [1]=> 50 | float(99.376846) 51 | [2]=> 52 | float(100.203168) 53 | [3]=> 54 | float(0) 55 | [4]=> 56 | float(191.098936) 57 | [5]=> 58 | float(191.098936) 59 | [6]=> 60 | float(180) 61 | [7]=> 62 | float(11.098936) 63 | [8]=> 64 | float(0) 65 | [9]=> 66 | float(0) 67 | } 68 | ["rc"]=> 69 | int(0) 70 | } 71 | -------------------------------------------------------------------------------- /tests/swe_houses_armc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(3) { 16 | ["cusps"]=> 17 | array(13) { 18 | [0]=> 19 | float(0) 20 | [1]=> 21 | float(90) 22 | [2]=> 23 | float(117.91759) 24 | [3]=> 25 | float(147.826411) 26 | [4]=> 27 | float(180) 28 | [5]=> 29 | float(212.173588) 30 | [6]=> 31 | float(242.082409) 32 | [7]=> 33 | float(270) 34 | [8]=> 35 | float(297.91759) 36 | [9]=> 37 | float(327.826411) 38 | [10]=> 39 | float(0) 40 | [11]=> 41 | float(32.173588) 42 | [12]=> 43 | float(62.082409) 44 | } 45 | ["ascmc"]=> 46 | array(10) { 47 | [0]=> 48 | float(90) 49 | [1]=> 50 | float(0) 51 | [2]=> 52 | float(0) 53 | [3]=> 54 | float(180) 55 | [4]=> 56 | float(90) 57 | [5]=> 58 | float(90) 59 | [6]=> 60 | float(180) 61 | [7]=> 62 | float(270) 63 | [8]=> 64 | float(0) 65 | [9]=> 66 | float(0) 67 | } 68 | ["rc"]=> 69 | int(0) 70 | } 71 | -------------------------------------------------------------------------------- /tests/swe_houses_armc_ex2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(6) { 16 | ["cusps"]=> 17 | array(13) { 18 | [0]=> 19 | float(0) 20 | [1]=> 21 | float(204.119848) 22 | [2]=> 23 | float(231.643448) 24 | [3]=> 25 | float(263.842862) 26 | [4]=> 27 | float(299.200017) 28 | [5]=> 29 | float(332.765247) 30 | [6]=> 31 | float(1.145655) 32 | [7]=> 33 | float(24.119848) 34 | [8]=> 35 | float(51.643448) 36 | [9]=> 37 | float(83.842862) 38 | [10]=> 39 | float(119.200017) 40 | [11]=> 41 | float(152.765247) 42 | [12]=> 43 | float(181.145655) 44 | } 45 | ["ascmc"]=> 46 | array(10) { 47 | [0]=> 48 | float(204.119848) 49 | [1]=> 50 | float(119.200017) 51 | [2]=> 52 | float(121.34) 53 | [3]=> 54 | float(54.839335) 55 | [4]=> 56 | float(213.565832) 57 | [5]=> 58 | float(232.021265) 59 | [6]=> 60 | float(203.41011) 61 | [7]=> 62 | float(52.021265) 63 | [8]=> 64 | float(0) 65 | [9]=> 66 | float(0) 67 | } 68 | ["cusp_speed"]=> 69 | array(13) { 70 | [0]=> 71 | float(0) 72 | [1]=> 73 | float(276.413953) 74 | [2]=> 75 | float(299.730979) 76 | [3]=> 77 | float(326.584645) 78 | [4]=> 79 | float(346.062087) 80 | [5]=> 81 | float(338.122375) 82 | [6]=> 83 | float(308.624737) 84 | [7]=> 85 | float(276.413953) 86 | [8]=> 87 | float(299.730979) 88 | [9]=> 89 | float(326.584645) 90 | [10]=> 91 | float(346.062087) 92 | [11]=> 93 | float(338.122375) 94 | [12]=> 95 | float(308.624737) 96 | } 97 | ["ascmc_speed"]=> 98 | array(10) { 99 | [0]=> 100 | float(276.413953) 101 | [1]=> 102 | float(346.062087) 103 | [2]=> 104 | float(360.985647) 105 | [3]=> 106 | float(500.510971) 107 | [4]=> 108 | float(374.37069) 109 | [5]=> 110 | float(493.376119) 111 | [6]=> 112 | float(268.429022) 113 | [7]=> 114 | float(493.376119) 115 | [8]=> 116 | float(0) 117 | [9]=> 118 | float(0) 119 | } 120 | ["rc"]=> 121 | int(0) 122 | ["serr"]=> 123 | string(0) "" 124 | } 125 | -------------------------------------------------------------------------------- /tests/swe_houses_ex.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(3) { 16 | ["cusps"]=> 17 | array(13) { 18 | [0]=> 19 | float(0) 20 | [1]=> 21 | float(191.098936) 22 | [2]=> 23 | float(222.650399) 24 | [3]=> 25 | float(251.723822) 26 | [4]=> 27 | float(279.376846) 28 | [5]=> 29 | float(307.790747) 30 | [6]=> 31 | float(338.578256) 32 | [7]=> 33 | float(11.098936) 34 | [8]=> 35 | float(42.650399) 36 | [9]=> 37 | float(71.723822) 38 | [10]=> 39 | float(99.376846) 40 | [11]=> 41 | float(127.790747) 42 | [12]=> 43 | float(158.578256) 44 | } 45 | ["ascmc"]=> 46 | array(10) { 47 | [0]=> 48 | float(191.098936) 49 | [1]=> 50 | float(99.376846) 51 | [2]=> 52 | float(100.203168) 53 | [3]=> 54 | float(0) 55 | [4]=> 56 | float(191.098936) 57 | [5]=> 58 | float(191.098936) 59 | [6]=> 60 | float(180) 61 | [7]=> 62 | float(11.098936) 63 | [8]=> 64 | float(0) 65 | [9]=> 66 | float(0) 67 | } 68 | ["rc"]=> 69 | int(0) 70 | } 71 | -------------------------------------------------------------------------------- /tests/swe_houses_ex2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(6) { 16 | ["cusps"]=> 17 | array(13) { 18 | [0]=> 19 | float(0) 20 | [1]=> 21 | float(197.758938) 22 | [2]=> 23 | float(224.813027) 24 | [3]=> 25 | float(256.407659) 26 | [4]=> 27 | float(291.253138) 28 | [5]=> 29 | float(324.938005) 30 | [6]=> 31 | float(353.97936) 32 | [7]=> 33 | float(17.758938) 34 | [8]=> 35 | float(44.813027) 36 | [9]=> 37 | float(76.407659) 38 | [10]=> 39 | float(111.253138) 40 | [11]=> 41 | float(144.938005) 42 | [12]=> 43 | float(173.97936) 44 | } 45 | ["ascmc"]=> 46 | array(10) { 47 | [0]=> 48 | float(197.758938) 49 | [1]=> 50 | float(111.253138) 51 | [2]=> 52 | float(112.973168) 53 | [3]=> 54 | float(42.793948) 55 | [4]=> 56 | float(204.799238) 57 | [5]=> 58 | float(219.65981) 59 | [6]=> 60 | float(197.110576) 61 | [7]=> 62 | float(39.65981) 63 | [8]=> 64 | float(0) 65 | [9]=> 66 | float(0) 67 | } 68 | ["cusp_speed"]=> 69 | array(13) { 70 | [0]=> 71 | float(0) 72 | [1]=> 73 | float(278.165632) 74 | [2]=> 75 | float(300.659228) 76 | [3]=> 77 | float(323.07017) 78 | [4]=> 79 | float(339.37847) 80 | [5]=> 81 | float(334.332381) 82 | [6]=> 83 | float(309.126057) 84 | [7]=> 85 | float(278.165632) 86 | [8]=> 87 | float(300.659228) 88 | [9]=> 89 | float(323.07017) 90 | [10]=> 91 | float(339.37847) 92 | [11]=> 93 | float(334.332381) 94 | [12]=> 95 | float(309.126057) 96 | } 97 | ["ascmc_speed"]=> 98 | array(10) { 99 | [0]=> 100 | float(278.165632) 101 | [1]=> 102 | float(339.37847) 103 | [2]=> 104 | float(360.985647) 105 | [3]=> 106 | float(577.366703) 107 | [4]=> 108 | float(382.499568) 109 | [5]=> 110 | float(553.301545) 111 | [6]=> 112 | float(268.117199) 113 | [7]=> 114 | float(553.301545) 115 | [8]=> 116 | float(0) 117 | [9]=> 118 | float(0) 119 | } 120 | ["rc"]=> 121 | int(0) 122 | ["serr"]=> 123 | string(0) "" 124 | } 125 | -------------------------------------------------------------------------------- /tests/swe_houses_pos.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | float(10) 15 | -------------------------------------------------------------------------------- /tests/swe_jdet_to_utc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(6) { 16 | ["year"]=> 17 | int(2001) 18 | ["month"]=> 19 | int(12) 20 | ["day"]=> 21 | int(31) 22 | ["hour"]=> 23 | int(23) 24 | ["min"]=> 25 | int(58) 26 | ["sec"]=> 27 | float(55.815998) 28 | } 29 | -------------------------------------------------------------------------------- /tests/swe_jdut1_to_utc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(6) { 16 | ["year"]=> 17 | int(2001) 18 | ["month"]=> 19 | int(12) 20 | ["day"]=> 21 | int(31) 22 | ["hour"]=> 23 | int(23) 24 | ["min"]=> 25 | int(58) 26 | ["sec"]=> 27 | float(55.815998) 28 | } 29 | -------------------------------------------------------------------------------- /tests/swe_julday.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(2452275.5) 16 | float(2452275.5) 17 | -------------------------------------------------------------------------------- /tests/swe_lat_to_lmt.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(3) { 17 | ["rc"]=> 18 | int(0) 19 | ["tjd_lmt"]=> 20 | float(2452275.5) 21 | ["serr"]=> 22 | string(0) "" 23 | } 24 | -------------------------------------------------------------------------------- /tests/swe_lmt_to_lat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(3) { 17 | ["rc"]=> 18 | int(0) 19 | ["tjd_lat"]=> 20 | float(2452275.497825) 21 | ["serr"]=> 22 | string(0) "" 23 | } 24 | -------------------------------------------------------------------------------- /tests/swe_lun_eclipse.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 39 | --EXPECT-- 40 | swe_lun_eclipse_when(2454466.5, SEFLG_SWIEPH, 0, 0) 41 | retflag = 4 100 42 | 2454517.643069 2008 2 21 3:26:1 UT 43 | array(8) { 44 | [0]=> 45 | float(2454517.643069) 46 | [1]=> 47 | float(0) 48 | [2]=> 49 | float(2454517.571723) 50 | [3]=> 51 | float(2454517.714418) 52 | [4]=> 53 | float(2454517.625803) 54 | [5]=> 55 | float(2454517.66035) 56 | [6]=> 57 | float(2454517.525389) 58 | [7]=> 59 | float(2454517.760855) 60 | } 61 | swe_lun_eclipse_when_loc(2454517.643069, SEFLG_SWIEPH, 12.1, 49, 330, 0) 62 | retflag = 29584 111001110010000 63 | 2454695.382052 2008 8 16 21:10:9 UT 64 | array(3) { 65 | [0]=> 66 | float(12.1) 67 | [1]=> 68 | float(49) 69 | [2]=> 70 | int(330) 71 | } 72 | array(10) { 73 | [0]=> 74 | float(2454695.382051) 75 | [1]=> 76 | float(0) 77 | [2]=> 78 | float(2454695.31671) 79 | [3]=> 80 | float(2454695.44739) 81 | [4]=> 82 | float(0) 83 | [5]=> 84 | float(0) 85 | [6]=> 86 | float(2454695.267205) 87 | [7]=> 88 | float(2454695.496797) 89 | [8]=> 90 | float(0) 91 | [9]=> 92 | float(0) 93 | } 94 | array(11) { 95 | [0]=> 96 | float(0.807612) 97 | [1]=> 98 | float(1.836649) 99 | [2]=> 100 | float(0) 101 | [3]=> 102 | float(0) 103 | [4]=> 104 | float(326.988586) 105 | [5]=> 106 | float(21.36259) 107 | [6]=> 108 | float(21.402251) 109 | [7]=> 110 | float(0.53016) 111 | [8]=> 112 | float(0.807612) 113 | [9]=> 114 | float(138) 115 | [10]=> 116 | float(28) 117 | } 118 | swe_lun_eclipse_how(2454695.3820517, SEFLG_SWIEPH, 12.1, 49, 330) 119 | 2454695.382052 2008 8 16 21:10:9 UT 120 | array(3) { 121 | [0]=> 122 | float(12.1) 123 | [1]=> 124 | float(49) 125 | [2]=> 126 | int(330) 127 | } 128 | array(11) { 129 | [0]=> 130 | float(0.807612) 131 | [1]=> 132 | float(1.836649) 133 | [2]=> 134 | float(0) 135 | [3]=> 136 | float(0) 137 | [4]=> 138 | float(326.988586) 139 | [5]=> 140 | float(21.36259) 141 | [6]=> 142 | float(21.402251) 143 | [7]=> 144 | float(0.53016) 145 | [8]=> 146 | float(0.807612) 147 | [9]=> 148 | float(138) 149 | [10]=> 150 | float(28) 151 | } 152 | -------------------------------------------------------------------------------- /tests/swe_lun_occult.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 28 | --EXPECT-- 29 | swe_lun_occult_when_glob for Venus 30 | array(2) { 31 | ["retflag"]=> 32 | int(5) 33 | ["tret"]=> 34 | array(10) { 35 | [0]=> 36 | float(2454531.296) 37 | [1]=> 38 | float(2454531.305) 39 | [2]=> 40 | float(2454531.198) 41 | [3]=> 42 | float(2454531.395) 43 | [4]=> 44 | float(2454531.198) 45 | [5]=> 46 | float(2454531.394) 47 | [6]=> 48 | float(2454531.22) 49 | [7]=> 50 | float(2454531.373) 51 | [8]=> 52 | float(0) 53 | [9]=> 54 | float(0) 55 | } 56 | } 57 | array(1) { 58 | [0]=> 59 | float(2454531.296) 60 | } 61 | string(20) "2008 3 5 19:7:36 UT" 62 | swe_lun_occult_where for Venus 63 | array(3) { 64 | ["retflag"]=> 65 | int(5) 66 | ["geopos"]=> 67 | array(2) { 68 | [0]=> 69 | float(-132.448) 70 | [1]=> 71 | float(-3.223) 72 | } 73 | ["attr"]=> 74 | array(8) { 75 | [0]=> 76 | float(86.757) 77 | [1]=> 78 | float(172.526) 79 | [2]=> 80 | float(29765.456) 81 | [3]=> 82 | float(-3461.913) 83 | [4]=> 84 | float(336.207) 85 | [5]=> 86 | float(76.844) 87 | [6]=> 88 | float(76.848) 89 | [7]=> 90 | float(0) 91 | } 92 | } 93 | swe_lun_occult_when_loc for Venus 94 | array(3) { 95 | ["retflag"]=> 96 | int(8070) 97 | ["tret"]=> 98 | array(8) { 99 | [0]=> 100 | float(2454802.2) 101 | [1]=> 102 | float(2454802.173) 103 | [2]=> 104 | float(2454802.173) 105 | [3]=> 106 | float(2454802.226) 107 | [4]=> 108 | float(2454802.226) 109 | [5]=> 110 | float(0) 111 | [6]=> 112 | float(0) 113 | [7]=> 114 | float(0) 115 | } 116 | ["attr"]=> 117 | array(10) { 118 | [0]=> 119 | float(30.827) 120 | [1]=> 121 | float(106.805) 122 | [2]=> 123 | float(11407.445) 124 | [3]=> 125 | float(-3452.982) 126 | [4]=> 127 | float(36.788) 128 | [5]=> 129 | float(8.705) 130 | [6]=> 131 | float(8.801) 132 | [7]=> 133 | float(0.106) 134 | [8]=> 135 | float(0) 136 | [9]=> 137 | float(0) 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /tests/swe_mooncross.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(3) { 18 | ["serr"]=> 19 | string(0) "" 20 | ["rc"]=> 21 | int(0) 22 | ["jx"]=> 23 | float(2455356.154088) 24 | } 25 | array(3) { 26 | ["serr"]=> 27 | string(0) "" 28 | ["rc"]=> 29 | int(0) 30 | ["jx"]=> 31 | float(2455356.153322) 32 | } 33 | -------------------------------------------------------------------------------- /tests/swe_mooncross_node.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(5) { 18 | ["serr"]=> 19 | string(0) "" 20 | ["rc"]=> 21 | int(0) 22 | ["jx"]=> 23 | float(2455334.152596) 24 | ["xlon"]=> 25 | float(102.733392) 26 | ["xlat"]=> 27 | float(0) 28 | } 29 | array(5) { 30 | ["serr"]=> 31 | string(0) "" 32 | ["rc"]=> 33 | int(0) 34 | ["jx"]=> 35 | float(2455334.15183) 36 | ["xlon"]=> 37 | float(102.733392) 38 | ["xlat"]=> 39 | float(0) 40 | } 41 | -------------------------------------------------------------------------------- /tests/swe_nod_aps.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | $values) { 20 | $out[$key] = $values; 21 | 22 | if (is_array($values)) { 23 | $out[$key] = Format::round($values); 24 | } 25 | } 26 | 27 | return $out; 28 | }; 29 | 30 | var_dump($out(swe_nod_aps(2452275.5, 2, SEFLG_SWIEPH|SEFLG_SPEED, SE_NODBIT_MEAN))); 31 | var_dump($out(swe_nod_aps(2452275.499256, 2, SEFLG_SWIEPH|SEFLG_SPEED, SE_NODBIT_MEAN))); 32 | 33 | ?> 34 | --EXPECT-- 35 | array(5) { 36 | ["retflag"]=> 37 | int(0) 38 | ["xnasc"]=> 39 | array(6) { 40 | [0]=> 41 | float(297.797963) 42 | [1]=> 43 | float(0.000176) 44 | [2]=> 45 | float(0.827924) 46 | [3]=> 47 | float(1.154826) 48 | [4]=> 49 | float(2.4E-5) 50 | [5]=> 51 | float(0.005224) 52 | } 53 | ["xndsc"]=> 54 | array(6) { 55 | [0]=> 56 | float(264.609052) 57 | [1]=> 58 | float(0.000111) 59 | [2]=> 60 | float(1.310631) 61 | [3]=> 62 | float(0.735528) 63 | [4]=> 64 | float(9.0E-6) 65 | [5]=> 66 | float(-0.00476) 67 | } 68 | ["xnperi"]=> 69 | array(6) { 70 | [0]=> 71 | float(290.12756) 72 | [1]=> 73 | float(1.470745) 74 | [2]=> 75 | float(0.711423) 76 | [3]=> 77 | float(1.341121) 78 | [4]=> 79 | float(1.460216) 80 | [5]=> 81 | float(0.004328) 82 | } 83 | ["xnaphe"]=> 84 | array(6) { 85 | [0]=> 86 | float(273.009983) 87 | [1]=> 88 | float(-1.114926) 89 | [2]=> 90 | float(1.423897) 91 | [3]=> 92 | float(0.715837) 93 | [4]=> 94 | float(-1.116434) 95 | [5]=> 96 | float(-0.003296) 97 | } 98 | } 99 | array(5) { 100 | ["retflag"]=> 101 | int(0) 102 | ["xnasc"]=> 103 | array(6) { 104 | [0]=> 105 | float(297.797104) 106 | [1]=> 107 | float(0.000176) 108 | [2]=> 109 | float(0.82792) 110 | [3]=> 111 | float(1.154832) 112 | [4]=> 113 | float(2.4E-5) 114 | [5]=> 115 | float(0.005224) 116 | } 117 | ["xndsc"]=> 118 | array(6) { 119 | [0]=> 120 | float(264.608504) 121 | [1]=> 122 | float(0.000111) 123 | [2]=> 124 | float(1.310635) 125 | [3]=> 126 | float(0.735527) 127 | [4]=> 128 | float(9.0E-6) 129 | [5]=> 130 | float(-0.00476) 131 | } 132 | ["xnperi"]=> 133 | array(6) { 134 | [0]=> 135 | float(290.126527) 136 | [1]=> 137 | float(1.470749) 138 | [2]=> 139 | float(0.711421) 140 | [3]=> 141 | float(1.341128) 142 | [4]=> 143 | float(1.46022) 144 | [5]=> 145 | float(0.004328) 146 | } 147 | ["xnaphe"]=> 148 | array(6) { 149 | [0]=> 150 | float(273.009464) 151 | [1]=> 152 | float(-1.114925) 153 | [2]=> 154 | float(1.423899) 155 | [3]=> 156 | float(0.715836) 157 | [4]=> 158 | float(-1.116433) 159 | [5]=> 160 | float(-0.003296) 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /tests/swe_pheno.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 32 | --EXPECT-- 33 | swe_pheno(2454503.6, 0, SEFLG_SWIEPH) 34 | Sun retflag = 2 10 35 | array(6) { 36 | [0]=> 37 | float(0) 38 | [1]=> 39 | float(0) 40 | [2]=> 41 | float(0) 42 | [3]=> 43 | float(0.540611) 44 | [4]=> 45 | float(-26.890234) 46 | [5]=> 47 | float(0) 48 | } 49 | swe_pheno(2454503.6, 1, SEFLG_SWIEPH) 50 | Moon retflag = 2 10 51 | array(6) { 52 | [0]=> 53 | float(178.794516) 54 | [1]=> 55 | float(0.00011) 56 | [2]=> 57 | float(1.202222) 58 | [3]=> 59 | float(0.519086) 60 | [4]=> 61 | float(3.706731) 62 | [5]=> 63 | float(0.952789) 64 | } 65 | swe_pheno(2454503.6, 2, SEFLG_SWIEPH) 66 | Mercury retflag = 2 10 67 | array(6) { 68 | [0]=> 69 | float(169.154362) 70 | [1]=> 71 | float(0.008931) 72 | [2]=> 73 | float(3.694023) 74 | [3]=> 75 | float(0.002863) 76 | [4]=> 77 | float(5.25881) 78 | [5]=> 79 | float(0) 80 | } 81 | swe_pheno(2454503.6, 3, SEFLG_SWIEPH) 82 | Venus retflag = 2 10 83 | array(6) { 84 | [0]=> 85 | float(44.050207) 86 | [1]=> 87 | float(0.859365) 88 | [2]=> 89 | float(30.741318) 90 | [3]=> 91 | float(0.003386) 92 | [4]=> 93 | float(-3.937999) 94 | [5]=> 95 | float(0) 96 | } 97 | swe_pheno(2454503.6, 4, SEFLG_SWIEPH) 98 | Mars retflag = 2 10 99 | array(6) { 100 | [0]=> 101 | float(29.198517) 102 | [1]=> 103 | float(0.936467) 104 | [2]=> 105 | float(126.645368) 106 | [3]=> 107 | float(0.003139) 108 | [4]=> 109 | float(-0.412361) 110 | [5]=> 111 | float(0) 112 | } 113 | swe_pheno(2454503.6, 5, SEFLG_SWIEPH) 114 | Jupiter retflag = 2 10 115 | array(6) { 116 | [0]=> 117 | float(6.430372) 118 | [1]=> 119 | float(0.996854) 120 | [2]=> 121 | float(36.485707) 122 | [3]=> 123 | float(0.008933) 124 | [4]=> 125 | float(-1.888969) 126 | [5]=> 127 | float(0) 128 | } 129 | swe_pheno(2454503.6, 6, SEFLG_SWIEPH) 130 | Saturn retflag = 2 10 131 | array(6) { 132 | [0]=> 133 | float(1.981944) 134 | [1]=> 135 | float(0.9997) 136 | [2]=> 137 | float(161.077731) 138 | [3]=> 139 | float(0.00535) 140 | [4]=> 141 | float(0.321584) 142 | [5]=> 143 | float(0) 144 | } 145 | swe_pheno(2454503.6, 7, SEFLG_SWIEPH) 146 | Uranus retflag = 2 10 147 | array(6) { 148 | [0]=> 149 | float(1.378548) 150 | [1]=> 151 | float(0.999855) 152 | [2]=> 153 | float(29.269562) 154 | [3]=> 155 | float(0.000927) 156 | [4]=> 157 | float(5.970784) 158 | [5]=> 159 | float(0) 160 | } 161 | swe_pheno(2454503.6, 8, SEFLG_SWIEPH) 162 | Neptune retflag = 2 10 163 | array(6) { 164 | [0]=> 165 | float(0.132518) 166 | [1]=> 167 | float(0.999998) 168 | [2]=> 169 | float(3.897905) 170 | [3]=> 171 | float(0.000607) 172 | [4]=> 173 | float(7.847211) 174 | [5]=> 175 | float(0) 176 | } 177 | swe_pheno(2454503.6, 9, SEFLG_SWIEPH) 178 | Pluto retflag = 2 10 179 | array(6) { 180 | [0]=> 181 | float(1.326519) 182 | [1]=> 183 | float(0.999866) 184 | [2]=> 185 | float(47.641525) 186 | [3]=> 187 | float(2.8E-5) 188 | [4]=> 189 | float(14.015977) 190 | [5]=> 191 | float(0) 192 | } 193 | swe_pheno_ut(2453503.6, 0, SEFLG_SWIEPH) 194 | Sun retflag = 2 10 195 | array(6) { 196 | [0]=> 197 | float(0) 198 | [1]=> 199 | float(0) 200 | [2]=> 201 | float(0) 202 | [3]=> 203 | float(0.527608) 204 | [4]=> 205 | float(-26.837369) 206 | [5]=> 207 | float(0) 208 | } 209 | swe_pheno_ut(2453503.6, 1, SEFLG_SWIEPH) 210 | Moon retflag = 2 10 211 | array(6) { 212 | [0]=> 213 | float(125.504319) 214 | [1]=> 215 | float(0.209617) 216 | [2]=> 217 | float(54.371336) 218 | [3]=> 219 | float(0.493609) 220 | [4]=> 221 | float(-8.340213) 222 | [5]=> 223 | float(0.906096) 224 | } 225 | swe_pheno_ut(2453503.6, 2, SEFLG_SWIEPH) 226 | Mercury retflag = 2 10 227 | array(6) { 228 | [0]=> 229 | float(66.367253) 230 | [1]=> 231 | float(0.700436) 232 | [2]=> 233 | float(21.429813) 234 | [3]=> 235 | float(0.001695) 236 | [4]=> 237 | float(-0.267627) 238 | [5]=> 239 | float(0) 240 | } 241 | swe_pheno_ut(2453503.6, 3, SEFLG_SWIEPH) 242 | Venus retflag = 2 10 243 | array(6) { 244 | [0]=> 245 | float(15.751581) 246 | [1]=> 247 | float(0.981223) 248 | [2]=> 249 | float(11.15905) 250 | [3]=> 251 | float(0.002751) 252 | [4]=> 253 | float(-3.899239) 254 | [5]=> 255 | float(0) 256 | } 257 | swe_pheno_ut(2453503.6, 4, SEFLG_SWIEPH) 258 | Mars retflag = 2 10 259 | array(6) { 260 | [0]=> 261 | float(43.451203) 262 | [1]=> 263 | float(0.86298) 264 | [2]=> 265 | float(73.779833) 266 | [3]=> 267 | float(0.001987) 268 | [4]=> 269 | float(0.466286) 270 | [5]=> 271 | float(0) 272 | } 273 | swe_pheno_ut(2453503.6, 5, SEFLG_SWIEPH) 274 | Jupiter retflag = 2 10 275 | array(6) { 276 | [0]=> 277 | float(7.213334) 278 | [1]=> 279 | float(0.996042) 280 | [2]=> 281 | float(137.273177) 282 | [3]=> 283 | float(0.011464) 284 | [4]=> 285 | float(-2.334114) 286 | [5]=> 287 | float(0) 288 | } 289 | swe_pheno_ut(2453503.6, 6, SEFLG_SWIEPH) 290 | Saturn retflag = 2 10 291 | array(6) { 292 | [0]=> 293 | float(5.552011) 294 | [1]=> 295 | float(0.997654) 296 | [2]=> 297 | float(60.297034) 298 | [3]=> 299 | float(0.004679) 300 | [4]=> 301 | float(0.214602) 302 | [5]=> 303 | float(0) 304 | } 305 | swe_pheno_ut(2453503.6, 7, SEFLG_SWIEPH) 306 | Uranus retflag = 2 10 307 | array(6) { 308 | [0]=> 309 | float(2.74648) 310 | [1]=> 311 | float(0.999425) 312 | [2]=> 313 | float(72.107567) 314 | [3]=> 315 | float(0.000954) 316 | [4]=> 317 | float(5.914068) 318 | [5]=> 319 | float(0) 320 | } 321 | swe_pheno_ut(2453503.6, 8, SEFLG_SWIEPH) 322 | Neptune retflag = 2 10 323 | array(6) { 324 | [0]=> 325 | float(1.920723) 326 | [1]=> 327 | float(0.999719) 328 | [2]=> 329 | float(94.84599) 330 | [3]=> 331 | float(0.000629) 332 | [4]=> 333 | float(7.772944) 334 | [5]=> 335 | float(0) 336 | } 337 | swe_pheno_ut(2453503.6, 9, SEFLG_SWIEPH) 338 | Pluto retflag = 2 10 339 | array(6) { 340 | [0]=> 341 | float(1.010404) 342 | [1]=> 343 | float(0.999922) 344 | [2]=> 345 | float(147.501315) 346 | [3]=> 347 | float(3.0E-5) 348 | [4]=> 349 | float(13.845448) 350 | [5]=> 351 | float(0) 352 | } 353 | -------------------------------------------------------------------------------- /tests/swe_rad_midp.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(1.570795) 16 | float(1.570795) 17 | -------------------------------------------------------------------------------- /tests/swe_radnorm.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | float(0) 18 | float(0) 19 | float(6.265732) 20 | -------------------------------------------------------------------------------- /tests/swe_revjul.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 21 | --EXPECT-- 22 | array(8) { 23 | ["year"]=> 24 | int(2002) 25 | ["month"]=> 26 | int(1) 27 | ["day"]=> 28 | int(1) 29 | ["hour"]=> 30 | float(0) 31 | ["ihour"]=> 32 | int(0) 33 | ["imin"]=> 34 | int(0) 35 | ["isec"]=> 36 | int(0) 37 | ["dsec"]=> 38 | float(5.0E-5) 39 | } 40 | array(8) { 41 | ["year"]=> 42 | int(2001) 43 | ["month"]=> 44 | int(12) 45 | ["day"]=> 46 | int(31) 47 | ["hour"]=> 48 | float(19.199999) 49 | ["ihour"]=> 50 | int(19) 51 | ["imin"]=> 52 | int(12) 53 | ["isec"]=> 54 | int(0) 55 | ["dsec"]=> 56 | float(3.3E-5) 57 | } 58 | array(8) { 59 | ["year"]=> 60 | int(2001) 61 | ["month"]=> 62 | int(1) 63 | ["day"]=> 64 | int(1) 65 | ["hour"]=> 66 | float(6.999999) 67 | ["ihour"]=> 68 | int(7) 69 | ["imin"]=> 70 | int(0) 71 | ["isec"]=> 72 | int(0) 73 | ["dsec"]=> 74 | float(3.6E-5) 75 | } 76 | -------------------------------------------------------------------------------- /tests/swe_rise_trans_etc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | $xx[rc]); 28 | continue; 29 | } 30 | 31 | $planets[$i] = array( 32 | 'name' => swe_get_planet_name($i), 33 | 'lng' => $xx[0], 34 | 'lat' => $xx[1], 35 | 'speed' => $xx[3] 36 | ); 37 | } 38 | echo "planets:\n"; 39 | var_dump(Format::round($planets)); 40 | 41 | # calc house cusps 42 | define("GEO_LNG", 6.57); 43 | define("GEO_LAT", 43.21); 44 | $place = 'La Croix Valmer, France'; 45 | 46 | $yy = swe_houses($jul_ut, GEO_LAT, GEO_LNG, "P"); // P = Placidus. 47 | 48 | $houses = array(); 49 | 50 | for($i = 1; $i <= 12; $i ++) 51 | { 52 | $houses[$i] = $yy['cusps'][$i]; 53 | } 54 | 55 | echo "houses for $place:\n"; 56 | var_dump(Format::round($houses)); 57 | 58 | $flags = array(SE_CALC_RISE, SE_CALC_MTRANSIT, SE_CALC_SET, SE_CALC_ITRANSIT ); 59 | $flagnam = array('rise', 'mer_transit', 'set', 'lower_mer_transit'); 60 | $planet = SE_MOON; 61 | $pnam = swe_get_planet_name($planet); 62 | for($i = 0; $i < 4; $i++) { 63 | $rv = swe_rise_trans($jul_ut, $planet, "", 0, $flags[$i], GEO_LNG, GEO_LAT, 0, 0, 0); 64 | if ($rv['rc'] < 0) 65 | $tr = 'never'; 66 | else 67 | $tr = $rv['tret'][0]; 68 | $ptrans[$i] = array( 69 | 'what' => $flagnam[$i], 70 | 'tr' => $tr, 71 | 'when' => Format::asUtc($tr) 72 | ); 73 | } 74 | echo "rise $pnam:\n"; 75 | var_dump(Format::round($ptrans)); 76 | 77 | $starname = 'Aldebaran'; 78 | for($i = 0; $i < 4; $i++) { 79 | $rv = swe_rise_trans($jul_ut, $planet, $starname, 0, $flags[$i], GEO_LNG, GEO_LAT, 0, 0, 0); 80 | if ($rv['rc'] < 0) 81 | $tr = 'never'; 82 | else 83 | $tr = $rv['tret'][0]; 84 | $strans['star'] = $rv['star']; 85 | $strans[$i] = array( 86 | 'what' => $flagnam[$i], 87 | 'tr' => $tr, 88 | 'when' => Format::asUtc($tr) 89 | ); 90 | } 91 | echo "rise $starname:\n"; 92 | var_dump(Format::round($strans)); 93 | 94 | ?> 95 | --EXPECT-- 96 | planets: 97 | array(12) { 98 | ["julday"]=> 99 | float(2459414.104166) 100 | ["date"]=> 101 | string(17) "2021 7 18 14:30:0" 102 | [0]=> 103 | array(4) { 104 | ["name"]=> 105 | string(3) "Sun" 106 | ["lng"]=> 107 | float(116.18535) 108 | ["lat"]=> 109 | float(0.000126) 110 | ["speed"]=> 111 | float(0.954103) 112 | } 113 | [1]=> 114 | array(4) { 115 | ["name"]=> 116 | string(4) "Moon" 117 | ["lng"]=> 118 | float(221.700161) 119 | ["lat"]=> 120 | float(2.433218) 121 | ["speed"]=> 122 | float(14.221994) 123 | } 124 | [2]=> 125 | array(4) { 126 | ["name"]=> 127 | string(7) "Mercury" 128 | ["lng"]=> 129 | float(101.038063) 130 | ["lat"]=> 131 | float(-0.15312) 132 | ["speed"]=> 133 | float(1.831599) 134 | } 135 | [3]=> 136 | array(4) { 137 | ["name"]=> 138 | string(5) "Venus" 139 | ["lng"]=> 140 | float(145.887149) 141 | ["lat"]=> 142 | float(1.606489) 143 | ["speed"]=> 144 | float(1.203191) 145 | } 146 | [4]=> 147 | array(4) { 148 | ["name"]=> 149 | string(4) "Mars" 150 | ["lng"]=> 151 | float(142.958951) 152 | ["lat"]=> 153 | float(1.15981) 154 | ["speed"]=> 155 | float(0.624285) 156 | } 157 | [5]=> 158 | array(4) { 159 | ["name"]=> 160 | string(7) "Jupiter" 161 | ["lng"]=> 162 | float(330.959482) 163 | ["lat"]=> 164 | float(-1.086721) 165 | ["speed"]=> 166 | float(-0.084815) 167 | } 168 | [6]=> 169 | array(4) { 170 | ["name"]=> 171 | string(6) "Saturn" 172 | ["lng"]=> 173 | float(311.254309) 174 | ["lat"]=> 175 | float(-0.755638) 176 | ["speed"]=> 177 | float(-0.070329) 178 | } 179 | [7]=> 180 | array(4) { 181 | ["name"]=> 182 | string(6) "Uranus" 183 | ["lng"]=> 184 | float(44.363312) 185 | ["lat"]=> 186 | float(-0.409489) 187 | ["speed"]=> 188 | float(0.025946) 189 | } 190 | [8]=> 191 | array(4) { 192 | ["name"]=> 193 | string(7) "Neptune" 194 | ["lng"]=> 195 | float(353.061322) 196 | ["lat"]=> 197 | float(-1.144519) 198 | ["speed"]=> 199 | float(-0.011878) 200 | } 201 | [9]=> 202 | array(4) { 203 | ["name"]=> 204 | string(5) "Pluto" 205 | ["lng"]=> 206 | float(295.544263) 207 | ["lat"]=> 208 | float(-1.573848) 209 | ["speed"]=> 210 | float(-0.024042) 211 | } 212 | } 213 | houses for La Croix Valmer, France: 214 | array(12) { 215 | [1]=> 216 | float(234.343461) 217 | [2]=> 218 | float(265.171191) 219 | [3]=> 220 | float(301.868576) 221 | [4]=> 222 | float(339.096638) 223 | [5]=> 224 | float(10.244718) 225 | [6]=> 226 | float(34.575604) 227 | [7]=> 228 | float(54.343461) 229 | [8]=> 230 | float(85.171191) 231 | [9]=> 232 | float(121.868576) 233 | [10]=> 234 | float(159.096638) 235 | [11]=> 236 | float(190.244718) 237 | [12]=> 238 | float(214.575604) 239 | } 240 | rise Moon: 241 | array(4) { 242 | [0]=> 243 | array(3) { 244 | ["what"]=> 245 | string(4) "rise" 246 | ["tr"]=> 247 | float(2459415.105138) 248 | ["when"]=> 249 | string(22) "2021 7 19 14:31:24 UT" 250 | } 251 | [1]=> 252 | array(3) { 253 | ["what"]=> 254 | string(11) "mer_transit" 255 | ["tr"]=> 256 | float(2459414.275003) 257 | ["when"]=> 258 | string(21) "2021 7 18 18:36:0 UT" 259 | } 260 | [2]=> 261 | array(3) { 262 | ["what"]=> 263 | string(3) "set" 264 | ["tr"]=> 265 | float(2459414.491543) 266 | ["when"]=> 267 | string(22) "2021 7 18 23:47:49 UT" 268 | } 269 | [3]=> 270 | array(3) { 271 | ["what"]=> 272 | string(17) "lower_mer_transit" 273 | ["tr"]=> 274 | float(2459414.793603) 275 | ["when"]=> 276 | string(20) "2021 7 19 7:2:47 UT" 277 | } 278 | } 279 | rise Aldebaran: 280 | array(5) { 281 | ["star"]=> 282 | string(15) "Aldebaran,alTau" 283 | [0]=> 284 | array(3) { 285 | ["what"]=> 286 | string(4) "rise" 287 | ["tr"]=> 288 | float(2459414.551462) 289 | ["when"]=> 290 | string(20) "2021 7 19 1:14:6 UT" 291 | } 292 | [1]=> 293 | array(3) { 294 | ["what"]=> 295 | string(11) "mer_transit" 296 | ["tr"]=> 297 | float(2459414.84822) 298 | ["when"]=> 299 | string(21) "2021 7 19 8:21:26 UT" 300 | } 301 | [2]=> 302 | array(3) { 303 | ["what"]=> 304 | string(3) "set" 305 | ["tr"]=> 306 | float(2459414.147709) 307 | ["when"]=> 308 | string(22) "2021 7 18 15:32:42 UT" 309 | } 310 | [3]=> 311 | array(3) { 312 | ["what"]=> 313 | string(17) "lower_mer_transit" 314 | ["tr"]=> 315 | float(2459414.349585) 316 | ["when"]=> 317 | string(22) "2021 7 18 20:23:24 UT" 318 | } 319 | } 320 | -------------------------------------------------------------------------------- /tests/swe_set_delta_t_userdef.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 17 | --EXPECT-- 18 | NULL 19 | float(0.0008) 20 | -------------------------------------------------------------------------------- /tests/swe_set_ephe_path.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | NULL 15 | -------------------------------------------------------------------------------- /tests/swe_set_ephe_path_null.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Null test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | NULL 15 | -------------------------------------------------------------------------------- /tests/swe_set_jpl_file.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | NULL 15 | -------------------------------------------------------------------------------- /tests/swe_set_sid_mode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | NULL 15 | -------------------------------------------------------------------------------- /tests/swe_set_topo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | NULL 16 | -------------------------------------------------------------------------------- /tests/swe_sidtime.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(6.698121) 16 | -------------------------------------------------------------------------------- /tests/swe_sidtime0.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | float(14.122425) 16 | -------------------------------------------------------------------------------- /tests/swe_sol_eclipse.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 64 | --EXPECT-- 65 | swe_sol_eclipse_when_glob(2454466.5, SEFLG_SWIEPH, 0, 0) 66 | bool(true) 67 | bool(true) 68 | bool(true) 69 | int(10) 70 | array(10) { 71 | [0]=> 72 | bool(true) 73 | [1]=> 74 | bool(true) 75 | [2]=> 76 | bool(true) 77 | [3]=> 78 | bool(true) 79 | [4]=> 80 | bool(true) 81 | [5]=> 82 | bool(true) 83 | [6]=> 84 | bool(true) 85 | [7]=> 86 | bool(true) 87 | [8]=> 88 | bool(true) 89 | [9]=> 90 | bool(true) 91 | } 92 | swe_sol_eclipse_when_glob(-1000000, SEFLG_SWIEPH, 0, 0) - with error 93 | bool(true) 94 | bool(true) 95 | swe_sol_eclipse_where(2454466.5, SEFLG_SWIEPH) 96 | bool(true) 97 | bool(true) 98 | bool(true) 99 | int(2) 100 | array(2) { 101 | [0]=> 102 | bool(true) 103 | [1]=> 104 | bool(true) 105 | } 106 | bool(true) 107 | int(20) 108 | array(20) { 109 | [0]=> 110 | bool(true) 111 | [1]=> 112 | bool(true) 113 | [2]=> 114 | bool(true) 115 | [3]=> 116 | bool(true) 117 | [4]=> 118 | bool(true) 119 | [5]=> 120 | bool(true) 121 | [6]=> 122 | bool(true) 123 | [7]=> 124 | bool(true) 125 | [8]=> 126 | bool(true) 127 | [9]=> 128 | bool(true) 129 | [10]=> 130 | bool(true) 131 | [11]=> 132 | bool(true) 133 | [12]=> 134 | bool(true) 135 | [13]=> 136 | bool(true) 137 | [14]=> 138 | bool(true) 139 | [15]=> 140 | bool(true) 141 | [16]=> 142 | bool(true) 143 | [17]=> 144 | bool(true) 145 | [18]=> 146 | bool(true) 147 | [19]=> 148 | bool(true) 149 | } 150 | swe_sol_eclipse_when_loc(2454466.5, SEFLG_SWIEPH, -153.1, -65, 0, 0) 151 | bool(true) 152 | bool(true) 153 | bool(true) 154 | int(7) 155 | array(7) { 156 | [0]=> 157 | bool(true) 158 | [1]=> 159 | bool(true) 160 | [2]=> 161 | bool(true) 162 | [3]=> 163 | bool(true) 164 | [4]=> 165 | bool(true) 166 | [5]=> 167 | bool(true) 168 | [6]=> 169 | bool(true) 170 | } 171 | bool(true) 172 | int(11) 173 | array(11) { 174 | [0]=> 175 | bool(true) 176 | [1]=> 177 | bool(true) 178 | [2]=> 179 | bool(true) 180 | [3]=> 181 | bool(true) 182 | [4]=> 183 | bool(true) 184 | [5]=> 185 | bool(true) 186 | [6]=> 187 | bool(true) 188 | [7]=> 189 | bool(true) 190 | [8]=> 191 | bool(true) 192 | [9]=> 193 | bool(true) 194 | [10]=> 195 | bool(true) 196 | } 197 | swe_sol_eclipse_how(2454466.5, SEFLG_SWIEPH, -153.1, -65, 0) 198 | bool(true) 199 | bool(true) 200 | bool(true) 201 | int(11) 202 | array(11) { 203 | [0]=> 204 | bool(true) 205 | [1]=> 206 | bool(true) 207 | [2]=> 208 | bool(true) 209 | [3]=> 210 | bool(true) 211 | [4]=> 212 | bool(true) 213 | [5]=> 214 | bool(true) 215 | [6]=> 216 | bool(true) 217 | [7]=> 218 | bool(true) 219 | [8]=> 220 | bool(true) 221 | [9]=> 222 | bool(true) 223 | [10]=> 224 | bool(true) 225 | } 226 | -------------------------------------------------------------------------------- /tests/swe_solcross.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(3) { 18 | ["serr"]=> 19 | string(0) "" 20 | ["rc"]=> 21 | int(0) 22 | ["jx"]=> 23 | float(2455671.929532) 24 | } 25 | array(3) { 26 | ["serr"]=> 27 | string(0) "" 28 | ["rc"]=> 29 | int(0) 30 | ["jx"]=> 31 | float(2455671.928764) 32 | } 33 | -------------------------------------------------------------------------------- /tests/swe_split_deg.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 23 | --EXPECT-- 24 | array(5) { 25 | ["deg"]=> 26 | int(123) 27 | ["min"]=> 28 | int(7) 29 | ["sec"]=> 30 | int(22) 31 | ["secfr"]=> 32 | float(0.8) 33 | ["sgn"]=> 34 | int(1) 35 | } 36 | array(5) { 37 | ["deg"]=> 38 | int(123) 39 | ["min"]=> 40 | int(7) 41 | ["sec"]=> 42 | int(23) 43 | ["secfr"]=> 44 | float(23) 45 | ["sgn"]=> 46 | int(1) 47 | } 48 | array(5) { 49 | ["deg"]=> 50 | int(123) 51 | ["min"]=> 52 | int(7) 53 | ["sec"]=> 54 | int(52) 55 | ["secfr"]=> 56 | float(52) 57 | ["sgn"]=> 58 | int(1) 59 | } 60 | array(5) { 61 | ["deg"]=> 62 | int(123) 63 | ["min"]=> 64 | int(37) 65 | ["sec"]=> 66 | int(22) 67 | ["secfr"]=> 68 | float(22) 69 | ["sgn"]=> 70 | int(1) 71 | } 72 | array(5) { 73 | ["deg"]=> 74 | int(3) 75 | ["min"]=> 76 | int(7) 77 | ["sec"]=> 78 | int(22) 79 | ["secfr"]=> 80 | float(0.8) 81 | ["sgn"]=> 82 | int(4) 83 | } 84 | array(5) { 85 | ["deg"]=> 86 | int(3) 87 | ["min"]=> 88 | int(7) 89 | ["sec"]=> 90 | int(22) 91 | ["secfr"]=> 92 | float(0.8) 93 | ["sgn"]=> 94 | int(9) 95 | } 96 | array(5) { 97 | ["deg"]=> 98 | int(123) 99 | ["min"]=> 100 | int(7) 101 | ["sec"]=> 102 | int(22) 103 | ["secfr"]=> 104 | float(0.8) 105 | ["sgn"]=> 106 | int(1) 107 | } 108 | array(5) { 109 | ["deg"]=> 110 | int(10) 111 | ["min"]=> 112 | int(59) 113 | ["sec"]=> 114 | int(59) 115 | ["secfr"]=> 116 | float(0.99964) 117 | ["sgn"]=> 118 | int(1) 119 | } 120 | -------------------------------------------------------------------------------- /tests/swe_tid_acc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Tidal acceleration I/O. 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 39 | --EXPECT-- 40 | float(-23.8946) 41 | float(-25.58) 42 | float(-25.58) 43 | float(-25.826) 44 | float(-25.826) 45 | float(-25.85) 46 | float(-25.85) 47 | float(-25.82) 48 | float(-25.8) 49 | float(-25.936) 50 | float(-26) 51 | float(-25.85) 52 | float(-25.8) 53 | float(-25.58) 54 | float(-25.8) 55 | float(-25.8) 56 | -------------------------------------------------------------------------------- /tests/swe_time_equ.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | array(3) { 18 | ["rc"]=> 19 | int(0) 20 | ["te"]=> 21 | float(-0.002285) 22 | ["serr"]=> 23 | string(0) "" 24 | } 25 | -------------------------------------------------------------------------------- /tests/swe_utc_time_zone.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | array(6) { 15 | ["year"]=> 16 | int(1999) 17 | ["month"]=> 18 | int(12) 19 | ["day"]=> 20 | int(31) 21 | ["hour"]=> 22 | int(17) 23 | ["min"]=> 24 | int(0) 25 | ["sec"]=> 26 | float(0) 27 | } 28 | -------------------------------------------------------------------------------- /tests/swe_utc_to_jd.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 14 | --EXPECT-- 15 | array(3) { 16 | ["rc"]=> 17 | int(0) 18 | [0]=> 19 | float(2451544.500742) 20 | [1]=> 21 | float(2451544.500004) 22 | } 23 | -------------------------------------------------------------------------------- /tests/swe_version.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | string(7) "2.10.03" 15 | -------------------------------------------------------------------------------- /tests/swe_vis_limit_mag.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Basic test 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECT-- 16 | array(9) { 17 | ["rc"]=> 18 | int(0) 19 | [0]=> 20 | float(-8.216269) 21 | [1]=> 22 | float(5.416663) 23 | [2]=> 24 | float(130.262291) 25 | [3]=> 26 | float(3.943499) 27 | [4]=> 28 | float(127.365385) 29 | [5]=> 30 | float(9.190664) 31 | [6]=> 32 | float(291.859517) 33 | [7]=> 34 | float(-3.912729) 35 | } 36 | -------------------------------------------------------------------------------- /utility/Format.php: -------------------------------------------------------------------------------- 1 | = $maxPrecision) { 93 | $string = sprintf("%.{$maxPrecision}f", $value); 94 | } 95 | 96 | // there were no decimals, put a zero back on the end 97 | if (strrchr($string, '.') === false) { 98 | $string .= '.0'; 99 | } 100 | 101 | $value = explode('.', $string); 102 | 103 | return (float)sprintf('%s.%s', $value[0], substr($value[1], 0, $precision)); 104 | } 105 | } 106 | --------------------------------------------------------------------------------