Number engineering format
number-engineering-format · version 1.0.0 · Numbers & math · free, no key needed
Format an exact decimal in scientific or engineering notation with explicit precision and rounding.
Use when you need to: format an exact decimal in engineering notation · format a number in scientific notation · round a decimal to significant digits for engineering display.
Decide before calling
Read the versioned contract and the supported scope below. Reuse number-engineering-format@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use number-engineering-format@1.0.0 for format an exact decimal in engineering notation. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- format an exact decimal in engineering notation
- format a number in scientific notation
- round a decimal to significant digits for engineering display
- convert decimal text to normalized exponent notation
- show an SI prefix for an engineering exponent
- format extreme decimal exponents without floating point
- עיצוב מספר בכתיב הנדסי
Not supported
- locale-aware number formatting or digit grouping
- unit conversion or dimensional analysis
- parsing non-decimal numeric bases
Behavior
- Decimal input is parsed from text and all significand arithmetic uses strings and BigInt; binary floating point never represents the decimal value.
- Scientific notation has one coefficient digit before the point; engineering notation has one to three and an exponent divisible by three.
- The coefficient contains exactly significant_digits significant digits, including trailing zeros; zero is unsigned with exponent zero.
- half_even breaks exact ties toward an even final retained digit; half_up breaks ties away from zero; directed modes follow their named direction.
- include_si_prefix defaults to false. A prefix is returned only for engineering notation and a nonzero exponent with one NIST SI prefix symbol from -30 through 30.
- Canonical rendered notation is coefficient followed by lowercase e and an exponent with no plus sign or leading zeros.
Input
value(string, required): min length 1; max length 1024; pattern^[+-]?(?:(?:[0-9]+)(?:\.[0-9]+)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$; Exact decimal text, optionally with a base-ten exponent.notation(one of "scientific", "engineering", required): Normalized scientific or engineering notation.significant_digits(integer, required): min 1; max 100; Exact count of significant digits in the coefficient.rounding_mode(one of "half_even", "half_up", "toward_zero", "away_from_zero", "floor", "ceiling", required): Explicit rule used when discarded digits are nonzero.include_si_prefix(boolean, optional): Request an SI prefix when the engineering exponent has one unambiguous symbol.
Output
coefficient(string, required): min length 1; max length 102; pattern^-?(?:0|[1-9][0-9]{0,2})(?:\.[0-9]+)?$; Normalized coefficient with exactly the requested significant digits.exponent(integer, required): min -1000000; max 1000000; Base-ten exponent.rendered(string, required): min length 3; max length 112; pattern^-?(?:0|[1-9][0-9]{0,2})(?:\.[0-9]+)?e-?[0-9]+$; Canonical coefficient followed by e and the base-ten exponent.si_prefix(one of "q", "r", "y", "z", "a", "f", "p", "n", "µ", "m", "k", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q", optional): Unambiguous SI prefix symbol for a nonzero engineering exponent.
Limits
- max input bytes: 1024
- max significant digits: 100
- max abs exponent: 1000000
Example
Request input:
{
"value": "12345",
"notation": "engineering",
"significant_digits": 4,
"rounding_mode": "half_even",
"include_si_prefix": true
}
Response:
{
"result": {
"coefficient": "12.34",
"exponent": 3,
"rendered": "12.34e3",
"si_prefix": "k"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "number-engineering-format",
"version": "1.0.0",
"input": {
"value": "12345",
"notation": "engineering",
"significant_digits": 4,
"rounding_mode": "half_even",
"include_si_prefix": true
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/number-engineering-format/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"value":"12345","notation":"engineering","significant_digits":4,"rounding_mode":"half_even","include_si_prefix":true}'
The machine-readable contract is at /v1/tools/number-engineering-format/versions/1.0.0.
CLI
node cli.mjs run number-engineering-format 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Roman numeral convert: Convert integers 1–3999 to canonical Roman numerals and strictly parse canonical numerals back to integers.
- Integer digit sum: Sum the base-b digits of the magnitude of an integer string.
- Mixed number to rational: Convert a mixed number (sign, whole part, proper-fraction numerator and denominator) into a single reduced rational.
- Rational power: Raise a rational number to an integer exponent and return the exact reduced result.
- Rational to mixed number: Convert a rational number into a sign, whole part, and proper-fraction numerator/denominator.
- Array integer GCD: Compute the non-negative greatest common divisor of an array of canonical integer strings.