Revert "Improve scientific notation formatting"

This reverts commit ca7632bf25.
This commit is contained in:
Codex Agent
2026-03-08 18:41:14 +00:00
parent cf0b72269c
commit f315ff1dc1
5 changed files with 23 additions and 81 deletions
@@ -1,7 +1,6 @@
<script lang="ts">
import { solve } from '$lib/engine';
import type { CalculatorDef } from '$lib/data/calculators';
import ScientificNotationValue from '$lib/components/ScientificNotationValue.svelte';
export let config: CalculatorDef;
@@ -18,6 +17,10 @@
? solve(config, 1, exampleInput.toString(), '', '')
: null;
$: offset = config.offset ?? 0;
$: formulaExpression = supportsExample
? `${exampleInput} × ${config.factor}${offset ? ` + ${offset}` : ''}`
: '';
const formatExampleValue = (value: number | null): string => {
if (value === null || Number.isNaN(value)) {
return '—';
@@ -47,27 +50,17 @@
<section class="example-card">
<h3>How to convert {config.labels.in1} to {config.labels.in2}</h3>
<p class="example-note">
1 {config.labels.in1} =
<ScientificNotationValue value={config.factor} />
{config.offset ? ` + ${config.offset}` : ''} {config.labels.in2}
1 {config.labels.in1} = {config.factor}{config.offset ? ` + ${config.offset}` : ''} {config.labels.in2}
</p>
<p class="example-note">
1 {config.labels.in2} =
<ScientificNotationValue value={formattedReverseValue} fallback="—" />
{config.labels.in1}
1 {config.labels.in2} = {formattedReverseValue} {config.labels.in1}
</p>
<p class="example-line">
Example: convert {exampleInput} {config.labels.in1} to {config.labels.in2}
</p>
<p class="example-line">
{exampleInput}
<span class="example-operator">×</span>
<ScientificNotationValue value={config.factor} />
{config.offset ? ` + ${config.offset}` : ''}
=
<span class="example-result">
<ScientificNotationValue value={result.val2} fallback="—" /> {config.labels.in2}
</span>
{formulaExpression} =
<span class="example-result">{result.val2} {config.labels.in2}</span>
</p>
</section>
{/if}
@@ -100,11 +93,6 @@
color: var(--text);
}
.example-operator {
margin: 0 0.25rem;
font-weight: 600;
}
.example-result {
font-weight: 600;
margin-left: 0.35rem;