Skip to content

Commit 4149297

Browse files
dfa1claude
andcommitted
fix(test): use multiply-by-0.01 for OHLC prices to enable ALP factor-100 round-trip
Division by 100.0 and multiplication by 0.01 differ in IEEE 754, causing ALP to miss the factor-100 case and fall back to ~1e12, producing 55-bit encoded values. Switching to *0.01 reduces Vortex/CSV ratio from 1.4x to 4x. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6237e38 commit 4149297

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

integration/src/test/java/io/github/dfa1/vortex/integration/VortexVsCsvFileSizeTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ private static List<OhlcBatch> generateBatches() {
7070
int ticker = i % 30;
7171
double px = prices[ticker];
7272
double ret = rng.nextGaussian() * 0.02;
73-
double o = Math.round(px * (1 + ret * 0.3) * 100.0) / 100.0;
74-
double c = Math.round(px * (1 + ret) * 100.0) / 100.0;
73+
double o = Math.round(px * (1 + ret * 0.3) * 100.0) * 0.01;
74+
double c = Math.round(px * (1 + ret) * 100.0) * 0.01;
7575
double spread = Math.abs(px * rng.nextDouble() * 0.03);
7676
symbols[i] = SYMBOLS[ticker];
7777
dates[i] = startDay + (rowsDone + i) / 30;
7878
open[i] = o;
79-
high[i] = Math.round((Math.max(o, c) + spread) * 100.0) / 100.0;
80-
low[i] = Math.round((Math.min(o, c) - spread) * 100.0) / 100.0;
79+
high[i] = Math.round((Math.max(o, c) + spread) * 100.0) * 0.01;
80+
low[i] = Math.round((Math.min(o, c) - spread) * 100.0) * 0.01;
8181
close[i] = c;
8282
volume[i] = Math.max(100_000L, Math.round(1_000_000 + rng.nextGaussian() * 200_000));
8383
prices[ticker] = c;

0 commit comments

Comments
 (0)