[OpenSIPS-Users] MySQL Type: FIELD_TYPE_NEWDECIMAL (246) uses DB_INT result type but should use float

Brett Nemeroff brett at nemeroff.com
Tue Mar 10 18:55:01 EST 2020


Actually, I think that may be a good idea Liviu,
Can you inspect the DB type to derive a precision for the STRING format?
Then maybe default to 8 if you can't derive it? I think that gives us the
best of everything. But it does require a column datatype inspection. What
do you think?
-Brett

On Tue, Mar 10, 2020 at 1:50 PM Calvin Ellison <calvin.ellison at voxox.com>
wrote:

> On Tue, Mar 10, 2020 at 10:31 AM Brett Nemeroff <brett at nemeroff.com>
> wrote:
>
>> Liviu,
>> My preference would be to default to 8, but make it defined in the header
>> file for those who want to recompile it. 6 is ok, it’s usually the minimum
>> precision that is acceptable.
>>
>
> My comment about significant digits was with regards to having extraneous
> trailing zeros, regardless of how many. Depending on the other value used
> in a calculation, 0.0019 versus 0.001900 might dictate rounding at a
> different number of decimal places. This is why I suggested grabbing the
> number of decimal places from the SQL response. My newbie googling of C
> printf/scanf indicates you can pass the number of decimal places via the
> ".precision" format specifier as a value or reference. There's a great
> answer on the topic here: https://stackoverflow.com/a/19897395 and some
> followup on C display precision versus mathematical precision and
> significant digits.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200310/dd8c43f1/attachment.html>


More information about the Users mailing list