
drop table modtest;
create table modtest (name text, arg1 numeric, arg2 numeric);
copy modtest from stdin;
uno	4385200147210375820	123
dos	12345678901234567934	123
tres	539379618106876228181	122
cuatro	539379618106876228319	123
cinco	66343693027145776082375	123
seis	8160274242338930458142210	123
siete	1003713731807688446351500562	123
ocho	123456789012345678901234567895	123
nueve	1234567890123456789012345678901234567856	123
diez	12345678901234567890123456789012345678901234567817	123
once	123456789012345678901234567890123456789012345678901234567901	123
doce	1234567890123456789012345678901234567890123456789012345678901234567859	12
trece	1234567890123456789012345678901234567890123456789012345678901234567862	123
catorce	1234567890123456789012345678901234567890123456789012345678901234566713	1234
quince	1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567321	1234
dieciseis	1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234558889	12345
\.

select name, arg1 % arg2 from modtest;
\echo 0
select name, arg2, arg1 % arg2::numeric(10,0), log(arg2)::int from modtest;
\echo 1
select name, arg2, arg1 % arg2::numeric(10,1), log(arg2)::int from modtest;
\echo 2
select name, arg2, arg1 % arg2::numeric(10,2), log(arg2)::int from modtest;
\echo 3
select name, arg2, arg1 % arg2::numeric(10,3), log(arg2)::int from modtest;
\echo 4
select name, arg2, arg1 % arg2::numeric(10,4), log(arg2)::int from modtest;
