gpt4 book ai didi

c - Swiss Ephemeris 程序 swetest - Windows 和 Ubuntu 中的不同输出

转载 作者:行者123 更新时间:2023-11-30 19:26:28 26 4
gpt4 key购买 nike

我一直在使用与 Swiss Ephemeris 软件捆绑在一起的 SWETEST 程序来计算各个行星的经度位置。到目前为止,我一直在使用Windows10,并且获得了与流行商业软件相当的值(value)。

最近,我尝试将我的应用程序迁移到 Ubuntu(特别是 Google Colab 附带的 Ubuntu VM),第一个挑战是,与 Windows 不同,该站点没有可用的 Linux 可执行文件。他们提供 C 代码和 Makefile 来编译相同的代码。

我使用Colab gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0上可用的gcc和Make文件来编译该文件。有一些警告,但程序按预期编译和执行。

问题是Windows版本中生成的经度值与Ubuntu版本中生成的经度值不同。差异不大,但仍然显着。特别是对于上升点。

实际编译可以看this URL

有没有办法解决这个问题,如果可以,我该从哪里开始?

make 命令的输出如下所示

cc   -c -g -Wall -fPIC         swetest.c     
swetest.c: In function ‘main’:
swetest.c:1377:9: warning: format not a string literal and no format arguments [-Wformat-security]
printf(stimeout);
^~~~~~~~
swetest.c:1712:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (hpos_meth == 1)
^~
swetest.c:1714:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (ipl == SE_FIXSTAR)
^~
swetest.c:1833:12: warning: format not a string literal and no format arguments [-Wformat-security]
printf(smod);
^~~~
swetest.c: In function ‘print_line’:
swetest.c:2017:32: warning: format not a string literal and no format arguments [-Wformat-security]
if (is_label) { printf(slon); break; }
^~~~
swetest.c:2026:32: warning: format not a string literal and no format arguments [-Wformat-security]
if (is_label) { printf(slon); break; }
^~~~
swetest.c:2046:32: warning: format not a string literal and no format arguments [-Wformat-security]
if (is_label) { printf(slon); break; }
^~~~
cc -c -g -Wall -fPIC swedate.c
cc -c -g -Wall -fPIC swehouse.c
cc -c -g -Wall -fPIC swejpl.c
cc -c -g -Wall -fPIC swemmoon.c
cc -c -g -Wall -fPIC swemplan.c
cc -c -g -Wall -fPIC swepcalc.c
cc -c -g -Wall -fPIC sweph.c
cc -c -g -Wall -fPIC swepdate.c
cc -c -g -Wall -fPIC swephlib.c
swephlib.c: In function ‘swe_get_astro_models’:
swephlib.c:4271:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_PREC_DEFAULT) imod = 0; break;
^~
swephlib.c:4271:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_PREC_DEFAULT) imod = 0; break;
^~~~~
swephlib.c:4273:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_PREC_DEFAULT_SHORT) imod = 0; break;
^~
swephlib.c:4273:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_PREC_DEFAULT_SHORT) imod = 0; break;
^~~~~
swephlib.c:4275:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_NUT_DEFAULT) imod = 0; break;
^~
swephlib.c:4275:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_NUT_DEFAULT) imod = 0; break;
^~~~~
swephlib.c:4277:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_SIDT_DEFAULT) imod = 0; break;
^~
swephlib.c:4277:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_SIDT_DEFAULT) imod = 0; break;
^~~~~
swephlib.c:4279:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_BIAS_DEFAULT) imod = 0; break;
^~
swephlib.c:4279:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_BIAS_DEFAULT) imod = 0; break;
^~~~~
swephlib.c:4281:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_JPLHOR_DEFAULT) imod = 0; break;
^~
swephlib.c:4281:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_JPLHOR_DEFAULT) imod = 0; break;
^~~~~
swephlib.c:4283:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_JPLHORA_DEFAULT) imod = 0; break;
^~
swephlib.c:4283:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_JPLHORA_DEFAULT) imod = 0; break;
^~~~~
swephlib.c:4285:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (imod == SEMOD_DELTAT_DEFAULT) imod = 0; break;
^~
swephlib.c:4285:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (imod == SEMOD_DELTAT_DEFAULT) imod = 0; break;
^~~~~
cc -c -g -Wall -fPIC swecl.c
swecl.c: In function ‘swe_rise_trans_true_hor’:
swecl.c:4444:11: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (!do_fixstar)
^~
swecl.c:4447:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (rsmi & SE_BIT_GEOCTR_NO_ECL_LAT)
^~
cc -c -g -Wall -fPIC swehel.c
swehel.c: In function ‘calc_rise_and_set’:
swehel.c:478:1: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
else
^~~~
swehel.c:484:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
iflag = epheflag|SEFLG_SPEED|SEFLG_EQUATORIAL;
^~~~~
ar r libswe.a swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swepcalc.o sweph.o swepdate.o swephlib.o swecl.o swehel.o
ar: creating libswe.a
cc -g -Wall -fPIC -o swetest swetest.o -L. -lswe -lm -ldl

最佳答案

这项练习背后的动机——在 Ubuntu 中重新编译程序——是出于从 Windows 迁移到 Unix/Ubuntu 平台的需要或愿望,特别是在 Google Colab 等托管 VM 环境上。现在,同样的目标已经通过完全不同的途径实现了。

存在一个名为 pyswisseph 的 Python 包如果安装了,您就可以直接调用必要的相关函数以获得相同的结果。

演示如何完成此操作的示例 Colab 笔记本是 shared here .

关于c - Swiss Ephemeris 程序 swetest - Windows 和 Ubuntu 中的不同输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57230312/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com