In looking at the source code, I see that this function has the following signature:
{-----------------------------------------------------------------------
RW_ConvertToWordsAndNumbers
Convert currency value to Words and Numbers, using descriptive terms from the Currency ID supplied.
-----------------------------------------------------------------------}
function returns string OUT_string;
in currency IN_Value; { Value of Currency }
in string IN_Currency; { Currency ID of Currency - Leave Blank for Functional }
in integer IN_Mode; { 0 = Whole Number in words, Parts in numbers }
{ 1 = Whole Number in numbers, Parts in numbers }
{ 2 = Whole Number in words, Parts in words }
This is, you will pass in the amount to be converted, the actual currency ID as a string, and the mode. There's a section of the code that takes the currency amount you are trying to convert and subtracts the integer part of that value part of that value, then multiplies it to 10 to the power of the number of decimal places. I suspect this is the section that's failing, since you are getting a value out of range when that particular operation is executed (EXCEPTION_CLASS_SCRIPT_OUT_OF_RANGE. SCRIPT_CMD_POWER), a simple example is as follows:
Let's say you want to convert 273.44. Based on what I am seeing here, the calculation done will be:
l_Value = (273.44 - 273) * 10 ^ 2;
This yields .44 * 100, which is 44 -- as in 44 cents.
Now, the 2 decimals used to elevate 10 ^ 2 is obtained by calling the Dexterity function, Currency_GetNumberOfDecimals(), by passing in the Currency Index stored in the MC_Currency_SETP table or otherwise uses the Functional Currency Decimals if Multicurrency is registered.
So 4 things come to mind:
1) Either Multicurrency is registered and you don't have decimal places in place for the currency in question, or
2) A functional currency has not been defined for the company, or
3) The values you are passing in to convert exceed the capacity of Dexterity (unlikely), or
4) Your multicurrency table records are damaged or non-existent.
I would personally backup the entire system and run a check links in against the Multicurrency tables to ensure all is OK. Step 9 of this support article describes how to do this: https://support.microsoft.com/en-us/help/861642/how-to-assign-a-functional-currency-when-multicurrency-management-is-n