[QGIS-Developer] Strange Behavior with QgsProcessingParameterNumber - Bug?

C Hamilton adenaculture at gmail.com
Mon Mar 15 07:50:23 PDT 2021


In a processing algorithm I have a double QgsProcessingParameterNumber
where I have set the number of decimals metadata to be 20.

param = QgsProcessingParameterNumber(
            'NUMBER',
            tr('Number'),
            QgsProcessingParameterNumber.Double,
            defaultValue=0,
            optional=False)
        param.setMetadata({'widget_wrapper': { 'decimals': 20 }})
        self.addParameter(param)

In the processing popup, if I enter a number with less than 20 digits then
the rest of the digits become some random number. For example if I enter

-0.1556640799496235

the displayed result is

-0.15566407994962350170

I would think that if it pads with extra digits to fill out to 20, the
digits should be 0. Have I exceeded the number of acceptable decimal
digits, or is this a bug?

Thanks,

Calvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210315/1153ad84/attachment.html>


More information about the QGIS-Developer mailing list