[Freeipa-devel] [PATCH] 192 Replace float with Decimal

Martin Kosek mkosek at redhat.com
Tue Jan 17 11:38:37 UTC 2012


On Tue, 2012-01-17 at 11:27 +0100, Martin Kosek wrote:
> On Fri, 2012-01-13 at 21:02 +0100, Martin Kosek wrote:
> > This patch fixes RHEL 6.2 build issue.
> > ----
> > Having float type as a base type for floating point parameter in
> > ipalib introduces several issues, e.g. problem with representation
> > or value comparison. Python language provides Decimal type which
> > help overcome these issue.
> > 
> > This patch replaces a float type with Decimal type in Float
> > parameter. A precision attribute was added to Float parameter that
> > can be used to limit a number of decimal places in parameter
> > representation. This approach fixes a problem with API.txt
> > validation where comparison of float values may fail on different
> > architectures due to float representation error.
> > 
> > In order to safely transfer the parameter value over RPC it is
> > being converted to string which is then converted back to Decimal
> > number on server side.
> > 
> > https://fedorahosted.org/freeipa/ticket/2260
> > 
> 
> Sending an improved version of the patch with following major changes:
> 
> 1) Float parameter was renamed to Decimal as it base type is different
> and would confuse users otherwise.
> 
> 2) Parameter maxvalue, minvalue and default can be also passed as a
> string and not just as a decimal.Decimal value. Parameter definition is
> then much simpler.
> 
> 3) LDAP backend encoder was enhanced to support this new type (it
> converts it to string just like a float value).
> 
> Martin

I forgot to add an encoding rule to JSON xmlrpc server. This can be
useful in a future when Decimal type is actually used for a real LDAP
attribute.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mkosek-192-3-replace-float-with-decimal.patch
Type: text/x-patch
Size: 34560 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120117/4d8628ac/attachment.bin>


More information about the Freeipa-devel mailing list