Hi OneDreamCloser. Integers in E-Series are 32 bits, and it appears that the macro language, at least in your example, is treating them as signed.
Here is a solution you might find handy. I suggest that you save this as a utility macro -- you can invoke macros from other macros, even if they are in different .mac files. Please let me know if you have questions about that.
The following contains two macros, although one is used only for testing the other.
The real macro of interest is xmToString, for "multiply by m and return the string". (We cannot return the integer value, if the value is larger than 32 bits will hold, but we can return a string that looks like the integer ).
I have attached the .mac file (but you'll have to remove the ".txt" extension), but its contents are listed below, too.
Uncomment the setoutput line below, if you want to watch the inner-workings.
Use this like tmpl.xmToString(3201234, 8). Note that you really should only use positive integers for both parameters; any other use will not work as intended.
So, in your specific case, change this line:
<# output_rate := env.atoi(output_rate) *8 #>
to
<# output_rate := tmpl.xmToString(output_rate, 😎 #>
Just remember that you should not use output_rate as a number after the above, because you'll be back where you started. In your case, though, you're just looking to display it as a string, so you'll be fine.
<# xmToString(i, m) #>
<# n := i #>
<# r := "" >
<# #>
<# // This macro will take an integer i and return a #>
<# // string that looks like i * m. This #>
<# // might be useful if i * m is a number larger #>
<# // than 32 bits can hold. #>
<# #>
<# // The "trick" is to do the multiplication "by hand" #>
<# // one digit at a time, managing the carry, etc. #>
<# #>
<# while(n > 0 || carry > 0) #>
<# n_lsd := n%10 #>
<# d := n_lsd * m + carry #>
<# if (d > 9) #>
<# unit := d%10; carry := d - unit; carry := carry/10; d := unit #>
<# else #>
<# carry := 0 #>
<# endif #>
<# r := d $ r #>
<# // setoutput console; "(n, n_lsd, d, carry, r): " $ n $ " " $ n_lsd $ " " $ d $ " " $ carry $ " " $ r $ "\n"; endsetoutput #>
<# n := n - n_lsd; n := n/10 #>
<# endwhile #>
<# #>
<# return(r) #>
<# #>
<# endtmpl #>
<# _xmToString(i, m) #>
<# // Tester macro #>
<# #>
<# setoutput console #>
<# r := tmpl.xmToString(i, m); r $ "\n" #>
<# endsetoutput #>
<# #>
<# endtmpl #>