{"id":"decimal-sum","version":"1.0.0","description":"Add up to 10,000 decimal strings exactly and report count, smallest and largest, with optional final rounding.","supported_operations":["sum a list of decimal numbers exactly","add up invoice line amounts","total of a column of prices","exact total of many decimals","ledger column total without rounding drift","sum values and find min and max","add decimals and round the total once","exact sum of receipt amounts"],"unsupported_operations":["averages, medians or other statistics","weighted sums or sums of products","currency conversion between amounts","floating point or scientific notation input"],"semantics":["Decimal strings match ^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$: no plus sign, exponent, leading zeros, leading or trailing point, whitespace or separators. A JSON number where a decimal string is required is invalid_input (wrong type).","A decimal string longer than 62 UTF-16 code units -> limit_exceeded, checked before the grammar. Otherwise a grammar failure, more than 60 digits in total, or more than 40 fraction digits -> invalid_input.","Zero has no sign: \"-0\", \"-0.00\" and any all-zero value are zero and are emitted as \"0\" (canonical) or \"0.00\" (fixed scale), never \"-0\".","values must be a non-empty array. Not an array or empty -> invalid_input; more than 10,000 items -> limit_exceeded, checked before any item is examined.","Every item is validated (grammar, length, digit caps) even though only the total is reported; the first failing item decides the error.","The total is the exact rational sum. It is rounded once, at the very end, and only when scale and rounding are given; individual values are never rounded.","scale and rounding must appear together or not at all; exactly one of them present -> invalid_input.","min and max are the numerically smallest and largest inputs written canonically (\"9.10\" -> \"9.1\"); comparison is numeric, never textual (\"9.9\" > \"9.11\"). min_index and max_index are zero-based positions; when several items tie (for example \"1.0\" and \"1\"), the first position wins. \"-0\" and \"0\" are equal.","With no scale the sum is canonical (trailing fraction zeros stripped, integers without a point) and exact is true; with a scale the sum has exactly scale fraction digits and exact is true iff rounding changed nothing.","Rounding modes act on the exact rational result and are: half_even (ties to the even neighbour), half_up (ties away from zero), half_down (ties toward zero), half_ceiling (ties toward +infinity), half_floor (ties toward -infinity), up (away from zero), down (toward zero), ceiling (toward +infinity), floor (toward -infinity), unnecessary (any inexact result -> not_computable with details.reason \"rounding_necessary\").","rounding \"unnecessary\" with an inexact sum at the requested scale -> not_computable with details.reason \"rounding_necessary\".","Validation order (each vector carries a single fault): input not an object; unknown field; missing required field; field types, ranges and decimal-string limits; scale/rounding pairing; then domain errors (not_computable) last."],"limits":{"max_items":10000,"max_decimal_chars":62,"max_decimal_digits":60,"max_fraction_digits":40,"max_scale":40},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["values"],"properties":{"values":{"type":"array","minItems":1,"maxItems":10000,"items":{"type":"string","minLength":1,"maxLength":62,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"description":"Decimal strings to add, 1 to 10,000 items."},"scale":{"type":"integer","minimum":0,"maximum":40,"description":"Fraction digits of the reported sum. Must be given together with rounding; omit both for the exact canonical sum."},"rounding":{"type":"string","enum":["half_even","half_up","half_down","half_ceiling","half_floor","up","down","ceiling","floor","unnecessary"],"description":"Rounding mode applied once to the final exact sum. Must be given together with scale."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["sum","count","min","max","min_index","max_index","exact"],"properties":{"sum":{"type":"string","minLength":1,"maxLength":200,"description":"Total: canonical without a scale, otherwise fixed at scale fraction digits."},"count":{"type":"integer","minimum":1,"maximum":10000,"description":"Number of values added."},"min":{"type":"string","minLength":1,"maxLength":200,"description":"Smallest input value, canonical."},"max":{"type":"string","minLength":1,"maxLength":200,"description":"Largest input value, canonical."},"min_index":{"type":"integer","minimum":0,"maximum":9999,"description":"Zero-based index of the first occurrence of the smallest value."},"max_index":{"type":"integer","minimum":0,"maximum":9999,"description":"Zero-based index of the first occurrence of the largest value."},"exact":{"type":"boolean","description":"true when the reported sum equals the exact total."}}},"examples":[{"input":{"values":["0.1","0.2","0.3"]},"output":{"sum":"0.6","count":3,"min":"0.1","max":"0.3","min_index":0,"max_index":2,"exact":true}},{"input":{"values":["19.99","5.005","-2.50","9.9"],"scale":2,"rounding":"half_even"},"output":{"sum":"32.40","count":4,"min":"-2.5","max":"19.99","min_index":2,"max_index":0,"exact":false}}],"execute_url":"/v1/tools/decimal-sum/versions/1.0.0/execute"}