fix: 兼容 TinyGo wasm 编译行星星历初始化

- 将 planetViews 从包级初始化改为 sync.Once 懒加载,避免 TinyGo interp 在编译期处理大型 float64 表切片索引时触发 unsupported fcmp
- 将行星视图构建失败改为内部返回 error,并由兼容层统一 panic
- 补充无效行星数据切片边界测试
This commit is contained in:
2026-05-17 21:19:23 +08:00
parent bec7b8a0d8
commit d40c4dfcd9
3 changed files with 38 additions and 8 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ func WherePlanetN(xt, zn int, jd float64, n int) float64 {
t := (jd - 2451545) / 36525.0000
t /= 10 // 转为儒略千年数
body := planetViews[xt]
body := planetViews()[xt]
coord := body.coords[zn]
baseOrderTerms := len(coord.orders[0])