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

Calvin Ellison calvin.ellison at voxox.com
Tue Mar 10 18:47:55 EST 2020


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.

It's probably a corner case. This stuff was pounded into me during high
school chemistry class :)

Regards,

*Calvin Ellison*
Senior Voice Operations Engineer
calvin.ellison at voxox.com

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200310/95fad9d5/attachment-0001.html>


More information about the Users mailing list