dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14025
Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 4611: added proper validation for real/natural numbers (including support for e-notation)
> 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!).
Yes, the point was that we don't support real numbers.
> 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.
This is not a problem, we store them as strings. There are 64 bit
value types that can be used, and there are also libraries that would
support any number of bits.
> 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.
>
I opted for simplicity, and simply used what we have.
Numbers (uses isRealnumber())
Integer (uses isInt())
Positive Integer (uses isPositiveInt())
Negative Integer (uses isNegativeInt())
At some point I think number should be renamed, but this is not the
time for that. :)
--
Morten
> Best regards,
> Jason
>
Follow ups
References