Root cause of "why CH-style endless pacing failed": our numbers are float64 (max ~1e308), but CH's endless curve reaches 1e25409+ via a 336-line BigValue class (mantissa * 10^exponent). Without it, exponential growth overflows. Ported CH big_value.gd's game-growth core to Python + GDScript: - normalize, plus/minus/times/scale/divided_by, power, pow_int, square_root, compare, floored/ceiled/rounded, to_float, encoded/from_text (save). - Exact CH constants (LN10, FLOOR_BIAS, 10000-divide threshold, normalize window). - GDScript uses self-preload (no class_name) to avoid duplicate-name conflict. - BIGVALUE_PARITY_PASS 9 cases py==gd; BIGVALUE_PASS 4 checks prove 1e600 and 1.55^100000 (exponent ~18000) representable -- far beyond float64. This is the technical foundation. With BigValue, the CH endless curve (1.55^zone, per-25-level x4 DPS, rebuild souls) can finally be implemented without overflow. Full P2_CHECKS_PASS 98 gates, identity preserved. Owner gates (human feel/device/release) remain open. prototype/ untracked.
41 lines
1.5 KiB
GDScript
41 lines
1.5 KiB
GDScript
extends SceneTree
|
|
|
|
const BigValue = preload("res://scripts/big_value.gd")
|
|
const OUTPUT_PATH := "res://artifacts/big_value_parity_gd.json"
|
|
|
|
|
|
func _emit(op: String, b: BigValue, other: BigValue = BigValue.new()) -> Dictionary:
|
|
return {"op": op, "m": b.mantissa, "e": b.exponent,
|
|
"f": b.to_float() if b.exponent < 300 else 0.0,
|
|
"om": other.mantissa, "oe": other.exponent}
|
|
|
|
|
|
func _init() -> void:
|
|
print("BV_TEST start")
|
|
_run.call_deferred()
|
|
|
|
|
|
func _run() -> void:
|
|
var results: Array = []
|
|
var a := BigValue.new(1.5, 20)
|
|
var b := BigValue.new(3.0, 20)
|
|
results.append(_emit("plus", a.plus(b)))
|
|
results.append(_emit("minus", BigValue.new(5.0).minus(BigValue.new(3.0))))
|
|
results.append(_emit("times", a.times(b)))
|
|
results.append(_emit("divided", BigValue.new(1.0).divided_by(BigValue.new(4.0))))
|
|
results.append(_emit("pow_i", BigValue.new(2.0).pow_int(30)))
|
|
results.append(_emit("pow_f", BigValue.power(1.55, 1000)))
|
|
results.append(_emit("sqrt", BigValue.new(16.0).square_root()))
|
|
results.append(_emit("scale", BigValue.new(2.5, 50).scale(3.0)))
|
|
var encoded: String = BigValue.power(1.55, 500).encoded()
|
|
results.append({"op": "encoded", "text": encoded,
|
|
"roundtrip": BigValue.from_text(encoded).exponent})
|
|
var dir := ProjectSettings.globalize_path("res://artifacts")
|
|
DirAccess.make_dir_recursive_absolute(dir)
|
|
var f := FileAccess.open(OUTPUT_PATH, FileAccess.WRITE)
|
|
if f != null:
|
|
f.store_string(JSON.stringify({"results": results}, "\t", true))
|
|
f.close()
|
|
print("BIGVALUE_PARITY_GD cases=%d" % results.size())
|
|
quit(0)
|