Both directions
When From equals to-roman, field A is read as a number, rounded with Math.round, then encoded with the standard subtractive table (CM, CD, XC, XL, IX, IV, etc.). Integers outside 1–3999 return Invalid.
Otherwise A is Roman text (letters I V X L C D M). Parsing is case-insensitive, rejects characters outside that set, and walks left to right subtracting when a symbol is smaller than the next.
Classic limits
There is no zero or negative representation. Values above 3999 are not supported — extended vinculum notation is not implemented.
Questions
Is IIII accepted for 4?
Output always uses subtractive IV. Input must be valid letters; non-standard forms may fail validation.