From 8f99335baea302963173659800bd02667c48989d Mon Sep 17 00:00:00 2001 From: Senrokai Date: Wed, 30 Sep 2026 00:04:47 +0200 Subject: [PATCH] =?UTF-8?q?Give=20a=20luminosity=20below=20a=20hundredth?= =?UTF-8?q?=20of=20the=20Sun's=20two=20figures,=20so=20Proxima=20reads=200?= =?UTF-8?q?.0015=20L=E2=98=89=20not=200.002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formatLuminosity printed three decimals from a thousandth to 1 L☉, which leaves one figure below a hundredth. d94451e put the archive's own luminosity on the card, and Proxima's 1.51×10⁻³ L☉ (st_lum −2.821 ± 0.02 dex) read 0.002, 32 % over and six times the archive's error bar, while 8.9×10⁻⁴ just below the cut kept its two figures. Below 0.01 it is now two significant figures. Over the 4 440 hosts exoplanets.json gives a luminosity for: 23 printed more than 10 % off it and 43 more than 5 % before (worst 32.5 %); none more than 5 % after (worst 4.4 %). In the app on :4302, Proxima's card reads "Luminosity 0.0015 L☉". Tests: quantity.spec now expects 0.0017 → "0.0017 L☉" and Proxima's figure → "0.0015 L☉", and keeps 0.0523 and 0.523 at three decimals; star-readouts.spec and the scene spec now expect "0.0015 L☉" where they pinned "0.002". Controls: three decimals below a hundredth, and two figures reaching up to 1, each fail the named test. Co-Authored-By: Claude Opus 5.5 (1M context) --- .../galaxy-system/galaxy-system-scene.component.spec.ts | 2 +- src/app/features/galaxy-system/star-readouts.spec.ts | 2 +- src/app/shared/format/quantity.spec.ts | 6 +++++- src/app/shared/format/quantity.ts | 9 +++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts b/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts index d093944..58c7cd8 100644 --- a/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts +++ b/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts @@ -1010,7 +1010,7 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => { expectColour(scene.starTint.value, blackbodyColor(2900)); const light = scene.systemRenderer.object.children.find((child): child is THREE.PointLight => child instanceof THREE.PointLight)!; expectColour(light.color, blackbodyColor(2900, SOLAR_EFFECTIVE_TEMPERATURE_K)); - expect(scene.hudReadouts().find((readout) => readout.label === 'Luminosity')).toEqual({ label: 'Luminosity', value: '0.002 L☉' }); + expect(scene.hudReadouts().find((readout) => readout.label === 'Luminosity')).toEqual({ label: 'Luminosity', value: '0.0015 L☉' }); expect(scene.hudReadouts().find((readout) => readout.label === 'Radius')?.value).toBe('0.141 solar radii'); }); diff --git a/src/app/features/galaxy-system/star-readouts.spec.ts b/src/app/features/galaxy-system/star-readouts.spec.ts index 2fffbcb..1176833 100644 --- a/src/app/features/galaxy-system/star-readouts.spec.ts +++ b/src/app/features/galaxy-system/star-readouts.spec.ts @@ -96,7 +96,7 @@ describe('starReadouts', () => { it('marks a derived luminosity so, and a published one not', () => { const surface = { radiusSolar: null, radiusDerived: true, temperatureK: null }; expect(starReadouts(HYG_STAR, { ...surface, luminositySolar: 25.4, luminosityDerived: true }).find((readout) => readout.label === 'Luminosity')).toEqual({ label: 'Luminosity', value: '25.40 L☉', derived: true }); - expect(starReadouts(PLACED_BY_GAIA, { ...surface, luminositySolar: 0.00151, luminosityDerived: false }).find((readout) => readout.label === 'Luminosity')).toEqual({ label: 'Luminosity', value: '0.002 L☉' }); + expect(starReadouts(PLACED_BY_GAIA, { ...surface, luminositySolar: 0.00151, luminosityDerived: false }).find((readout) => readout.label === 'Luminosity')).toEqual({ label: 'Luminosity', value: '0.0015 L☉' }); expect(starReadouts(HYG_STAR, { ...surface, luminositySolar: null, luminosityDerived: true }).some((readout) => readout.label === 'Luminosity')).toBe(false); }); }); diff --git a/src/app/shared/format/quantity.spec.ts b/src/app/shared/format/quantity.spec.ts index 94d334b..1e4137f 100644 --- a/src/app/shared/format/quantity.spec.ts +++ b/src/app/shared/format/quantity.spec.ts @@ -103,7 +103,11 @@ describe('formatTemperature and formatDensity', () => { describe('formatLuminosity', () => { it('stays decimal across the ordinary range', () => { expect(formatLuminosity(1)).toBe('1.00 L☉'); - expect(formatLuminosity(0.0017)).toBe('0.002 L☉'); + expect(formatLuminosity(0.0017)).toBe('0.0017 L☉'); + // Proxima's archive figure, which three decimals read as 0.002, a third over. + expect(formatLuminosity(0.0015100106)).toBe('0.0015 L☉'); + expect(formatLuminosity(0.0523)).toBe('0.052 L☉'); + expect(formatLuminosity(0.523)).toBe('0.523 L☉'); }); it('goes to powers of ten at the extremes', () => { diff --git a/src/app/shared/format/quantity.ts b/src/app/shared/format/quantity.ts index 6eb36a4..8179595 100644 --- a/src/app/shared/format/quantity.ts +++ b/src/app/shared/format/quantity.ts @@ -96,13 +96,18 @@ export function formatDensity(gramsPerCm3: number): string { return `${gramsPerCm3.toFixed(2)} g/cm³`; } -/** Bolometric luminosity in solar units, which spans many orders of magnitude. */ +/** + * Bolometric luminosity in solar units, which spans many orders of magnitude. Two figures below a + * hundredth, as in the ×10ⁿ form below a thousandth: three decimals left one there, and Proxima's + * archive luminosity, 1.51×10⁻³ L☉, read 0.002, a third over; 23 of the 4 440 hosts the archive + * gives one for read more than 10 % off it. + */ export function formatLuminosity(solar: number): string { if (solar >= 1000 || (solar > 0 && solar < 0.001)) { const exponent = Math.floor(Math.log10(solar)); return `${(solar / Math.pow(10, exponent)).toFixed(1)}×10${superscript(exponent)} L☉`; } - return `${solar.toFixed(solar < 1 ? 3 : 2)} L☉`; + return `${solar < 0.01 ? solar.toPrecision(2) : solar.toFixed(solar < 1 ? 3 : 2)} L☉`; } function superscript(value: number): string {