Quantcast
Channel: Lucee Dev - Latest topics
Viewing all articles
Browse latest Browse all 425

Validate Integer

$
0
0

This is the scenario, on Lucee 5.4.6.9:

var startingFloat = 76.0426;

var twoFloatNumber = DecimalFormat( startingFloat );
dump( twoFloatNumber );
// write: 76.04

var thisInteger = twoFloatNumber*100;
dump( thisInteger );
// write: 7604

dump( isValid( 'integer', thisInteger ) );
// FALSE (!)

I don’t understand because 7604 is not Integer.
I have to use Val() or Int() function around moltiplication to obtain TRUE.

var thisInteger = Val( twoFloatNumber*100 );

Any hint?

6 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 425

Trending Articles