{"id":"decimal-divide","version":"1.0.0","description":"Divide two decimal strings exactly, rounding the quotient once to a fixed scale, and report the exact remainder.","supported_operations":["divide two decimals exactly","exact decimal division with rounding","quotient and remainder of decimal division","unit price from total and quantity","divide to n decimal places","split an amount by a divisor to cents","decimal division rounding mode","average price per unit exact"],"unsupported_operations":["integer euclidean division of huge numbers","evaluating formulas with several operations","currency conversion with exchange rates","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\".","All four fields are required. The exact rational quotient dividend/divisor is rounded once to scale fraction digits with the given mode.","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\").","A result rounded to scale s is written with exactly s fraction digits (no fraction and no point when s is 0); a result with no scale is canonical: trailing fraction zeros are stripped and an integer has no point.","remainder = dividend - value * divisor, exact and canonical (trailing fraction zeros stripped, \"0\" when zero). Its sign follows from the rounding direction: rounding up gives a negative remainder for a positive divisor.","A zero divisor (including \"0.00\" and \"-0\") -> not_computable with details.reason \"division_by_zero\", even when the dividend is also zero. This is checked after all input validation.","rounding \"unnecessary\" with an inexact quotient -> 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_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":["dividend","divisor","scale","rounding"],"properties":{"dividend":{"type":"string","minLength":1,"maxLength":62,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Number being divided, decimal string."},"divisor":{"type":"string","minLength":1,"maxLength":62,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Number to divide by, decimal string; must not be zero."},"scale":{"type":"integer","minimum":0,"maximum":40,"description":"Number of fraction digits in the quotient."},"rounding":{"type":"string","enum":["half_even","half_up","half_down","half_ceiling","half_floor","up","down","ceiling","floor","unnecessary"],"description":"Rounding mode applied to the exact quotient."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["value","exact","remainder"],"properties":{"value":{"type":"string","minLength":1,"maxLength":200,"description":"Quotient rounded to scale, written with exactly scale fraction digits."},"exact":{"type":"boolean","description":"true when the rounded quotient equals the exact quotient."},"remainder":{"type":"string","minLength":1,"maxLength":200,"description":"dividend - value * divisor as an exact canonical decimal; negative when the quotient was rounded up past the exact value."}}},"examples":[{"input":{"dividend":"10","divisor":"3","scale":2,"rounding":"half_even"},"output":{"value":"3.33","exact":false,"remainder":"0.01"}},{"input":{"dividend":"100.50","divisor":"4","scale":1,"rounding":"down"},"output":{"value":"25.1","exact":false,"remainder":"0.1"}}],"execute_url":"/v1/tools/decimal-divide/versions/1.0.0/execute"}