{"id":"decimal-power","version":"1.0.0","description":"Raise a decimal string to an integer power exactly, with optional single rounding to a fixed scale.","supported_operations":["raise a decimal to a power exactly","exact integer power of a decimal number","1.05 to the power of 10","compound interest growth factor exact","decimal exponentiation with rounding","reciprocal power to n decimal places","power of a decimal with negative exponent","square or cube a decimal exactly"],"unsupported_operations":["fractional or decimal exponents","roots of numbers","logarithms or exponentials with base e","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\".","exponent is a JSON integer in -1000..1000; a string, a float, NaN, Infinity or out of range -> invalid_input.","The power is computed exactly as a rational: base^e for e >= 0, and 1/base^|e| for e < 0. 0^0 is 1; x^0 is 1 for every x; 0^n is 0 for n > 0.","A negative exponent without scale and rounding -> invalid_input (the reciprocal is generally not a finite decimal).","Size estimate, checked after the field checks and the scale/rounding pairing and before any arithmetic: let k be the number of digits of the canonical significand of base (fraction digits and the decimal point written out as one integer after stripping trailing FRACTION zeros; integer trailing zeros stay; zero counts as 1 digit). k * |exponent| > 20,000 -> limit_exceeded. Example: \"10000000000000000000\" (k = 20) with exponent 1000 is allowed, a 21-digit base with exponent 1000 is not.","0 to a negative exponent -> not_computable with details.reason \"zero_to_negative_power\" (checked after the size estimate).","With no scale, a non-negative exponent must produce a result whose significand power (significand^e) has at most 120 digits; otherwise invalid_input (give a scale). 2^398 (120 digits) succeeds without a scale, 2^399 needs one. The result is canonical (trailing fraction zeros stripped) and exact is true.","With scale and rounding the exact power is rounded once to scale fraction digits and exact is true iff that changed nothing. A tiny reciprocal such as 10^-1000 at scale 40 is \"0.000...0\" (40 zeros) with exact false.","scale and rounding must appear together or not at all; exactly one of them present -> invalid_input.","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.","rounding \"unnecessary\" with an inexact power -> not_computable with details.reason \"rounding_necessary\".","Result size: the written value (sign, digits and point) is at most 20,100 characters. The size estimate bounds a positive-exponent result to about 20,000 integer digits, but a base with fraction digits can still give a longer text, so a result whose written value would exceed 20,100 characters -> limit_exceeded, decided from the size of the exact result (scale digits times |exponent| for an unscaled result, integer digits of the reciprocal for a negative exponent) before the text is built. With the 40-fraction-digit base \"0.0000000000000000000000000000000000000001\" (k = 1): exponent 502 without a scale is \"0.\" followed by 20,080 fraction digits (20,082 characters) and succeeds; exponent 503 without a scale (20,122 characters) -> limit_exceeded; exponent -502 at scale 0 is 1 followed by 20,080 zeros (20,081 characters) and succeeds; exponent -503 at scale 0 (20,121 characters) -> limit_exceeded.","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,"max_abs_exponent":1000,"max_significand_digits_times_exponent":20000,"max_unscaled_exact_digits":120,"max_result_chars":20100},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["base","exponent"],"properties":{"base":{"type":"string","minLength":1,"maxLength":62,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Base as a decimal string."},"exponent":{"type":"integer","minimum":-1000,"maximum":1000,"description":"Integer exponent, -1000 to 1000. A negative exponent requires scale and rounding."},"scale":{"type":"integer","minimum":0,"maximum":40,"description":"Fraction digits of the result. Must be given together with rounding. Required when the exponent is negative or the exact result would exceed 120 digits."},"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 power. Must be given together with scale."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["value","exact"],"properties":{"value":{"type":"string","minLength":1,"maxLength":20100,"description":"The power: canonical when no scale was given, otherwise fixed at scale fraction digits."},"exact":{"type":"boolean","description":"true when the reported value equals the exact power."}}},"examples":[{"input":{"base":"1.05","exponent":10},"output":{"value":"1.62889462677744140625","exact":true}},{"input":{"base":"1.05","exponent":10,"scale":6,"rounding":"half_even"},"output":{"value":"1.628895","exact":false}},{"input":{"base":"3","exponent":-2,"scale":4,"rounding":"half_up"},"output":{"value":"0.1111","exact":false}}],"execute_url":"/v1/tools/decimal-power/versions/1.0.0/execute"}