dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14023
Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 4611: added proper validation for real/natural numbers (including support for e-notation)
> We don't really support real numbers.. we support integers, and
> decimal approximations of rational numbers.. I think the name decimal
> would be better here.
Good point and I support the change in naming. We should have seen
this earlier. However, we do also support decimal representation of
irrational/transcendental numbers. I think you mean "finite decimal
approximations of real numbers". We do not support complex numbers
(and I do not see a real use case for them!).
Not knowing the details of how Java handles floating point numbers,
but I also assume that this is a 32 bit decimal representation, which
further restricts the length of the number which the regex does not
really account for.
> Yes, I think maybe integer is the way to go, since whole numbers is
> not clearly defined. But I'm not a native speaker, so I'm not really
> sure whats best.
Natural numbers are simply positive integers but whether they include
zero is somewhat of a mathematical fine point. Not being an
authoritative source on this, I think we should stick with positive
and negative integers and be sure they are explained well in the help.
I think if we need a set of numbers, which include 0 and positive
integers, we should use "Natural numbers", or allow zero to be
included in "Positive and negative integers", but be sure it is well
explained in the manual.
>> As for the support for scientific notation, I am not necessarily
>> opposed to it, but think we need to stick to the more strict regex
>> validation.
>
> I think maybe supporting e-notation but restricting it might be more
> confusing.. ? not sure here... maybe just plain decimals is OK.
>
Well, if we support it, we need to be sure it is valid and I
personally do not trust !NaN. I see no real need for it and unless
people are asking for it, I suggest we simply not allow it.
Best regards,
Jason
Follow ups
References