Improve scientific notation formatting

This commit is contained in:
Codex Agent
2026-03-08 10:46:36 +00:00
parent 7996f31f32
commit ca7632bf25
5 changed files with 81 additions and 23 deletions

View File

@@ -5,6 +5,7 @@
import { onMount } from 'svelte';
import type { PageData } from './$types';
import { buildSeoMeta, canonicalUrl, SITE_NAME, SITE_URL, toJsonLd } from '$lib/seo';
import ScientificNotationValue from '$lib/components/ScientificNotationValue.svelte';
export let data: PageData;
@@ -105,14 +106,18 @@
<p>
The conversion between {calc.labels.in1.toLowerCase()} and {calc.labels.in2.toLowerCase()}
uses a fixed multiplication factor. One {calc.labels.in1.toLowerCase().replace(/s$/, '')} equals
{calc.factor}{calc.offset ? ` plus an offset of ${calc.offset}` : ''} {calc.labels.in2.toLowerCase()}.
<ScientificNotationValue value={calc.factor} />
{calc.offset ? ` plus an offset of ${calc.offset}` : ''} {calc.labels.in2.toLowerCase()}.
{#if calc.offset}
This offset is common in temperature conversions, where scales differ not just in magnitude but also in their zero point.
{/if}
</p>
<p>
To convert, multiply the value in {calc.labels.in1.toLowerCase()} by {calc.factor}{calc.offset ? `, then add ${calc.offset}` : ''}.
To convert in the opposite direction, {calc.offset ? `subtract ${calc.offset}, then ` : ''}divide by {calc.factor}.
To convert, multiply the value in {calc.labels.in1.toLowerCase()} by
<ScientificNotationValue value={calc.factor} />
{calc.offset ? `, then add ${calc.offset}` : ''}.
To convert in the opposite direction, {calc.offset ? `subtract ${calc.offset}, then ` : ''}divide by
<ScientificNotationValue value={calc.factor} />.
</p>
{:else if calc.type === '3col' || calc.type === '3col-mul'}
<p>