AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Scientific Notation Converter Agent Guide

Agent guide for converting decimal and e-notation input into coefficient, exponent, e-notation, display, and decimal strings.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Scientific Notation Converter in the alexandrai-tools project.

Project overview

This guide covers src/tools/scientific-notation-converter/index.ts. The tool trims input, returns an empty non-ok result for blank input, rejects non-finite values, uses toExponential with fifteen significant digits, trims coefficient zeros, builds e-notation and a Unicode display string, and derives a plain decimal string with trailing decimal zeros removed.

Primary source files

  • src/tools/scientific-notation-converter/index.ts defines meta, ScientificResult, SUPERSCRIPT_MAP, toSuperscript, EMPTY, and convert.
  • src/tools/scientific-notation-converter/index.test.ts covers blank input, small decimals, e-notation input, positive integers, negative numbers, one, zero, large numbers, non-numeric input, and Infinity.
  • src/tools/scientific-notation-converter/Body.astro owns browser controls.
  • src/tools/scientific-notation-converter/i18n.ts owns localized copy.
  • src/lib/tools.ts registers metadata.

Setup commands

npm install npm test npm run typecheck npm run build npm run dev

Change rules

  • Return EMPTY for blank input with no error text.
  • Reject non-finite or NaN parsed values.
  • Use Number parsing for decimal and e-notation input.
  • Use toExponential with fifteen significant digits.
  • Trim coefficient trailing zeros through parseFloat.
  • Keep eNotation as coefficient followed by e and exponent.
  • If precision support improves, add tests for very large and very small values before changing decimal generation.

Testing

Test blank input, invalid input, Infinity, zero, one, small decimals, large integers, negative numbers, e-notation input, coefficient trimming, exponent signs, decimal string generation, Unicode display, and precision edge cases.

PR checklist

  • npm test passes for scientific-notation-converter.
  • Validation, formatting, and numeric precision behavior remain documented.
  • Pure helpers stay browser-local and side-effect free.
  • UI labels, metadata, and tests update together for behavior changes.