Nirmal
Nirmal

Reputation: 4829

Handle large numerical value in Flex

I have few Number textbox (with data type Number) in which user can add large numerical values (approx of 12 to 15 digits like 12345678901234).

Now when I am storing it into a number and passing it to Java (using BlazeDS) it is actually going in an exponential format like 1.79769313486231e+308.

How can I handle this in such a way that flex will pass a proper numerical value to Java instead of exponential format?

Upvotes: 0

Views: 353

Answers (2)

user1875642
user1875642

Reputation: 1313

1.7+e308 is no way a 15-digit number. 15 digits fit well into 2^64, so Number type is ok for it. It is naturally converted to Java's double type.

Exponential form is just a way to convert internal value to human-readable string, so you shall just use different formatting when converting double to string.

Upvotes: 0

pseudopeach
pseudopeach

Reputation: 1475

Unfortunately ActionScript's uint only goes up to 4,294,967,295. Sounds like that's not high enough for you. There's no way for Java to tell that you meant the Number as a uint instead of a floating point. You could fix it on the Java side.

Maybe consider just treating these values as strings. I know it's a bummer, but String would seem to be ActionScript's best fit data type for your huge numbers.

Are they serial numbers or something?

Upvotes: 0

Related Questions