0

I have an array of floats similar to 4.0157725356416E+24 that are not being rounded with round(). (watchdog is a drupal logging tool)

$score = ($results['results'][0]['score']); watchdog( 'multi', "float: $score"); $score = ($score * 100); watchdog( 'multi', "percent (". gettype($score) . "): $score"); $score = round( $score ); watchdog( 'multi', "round: $score"); 

and the out put of this is:

> float: 1.9532660466727E+25 > percent (double): 1.9532660466727E+27 > round: 1.9532660466727E+27 

I'm missing something here...

0

1 Answer 1

3

You're looking at exponential numbers (i.e. 1.9532660466727 * 10 ^ 27). They are still being rounded to the nearest integer, they're just HUGE.

It's the same as 1,953,266,046,672,700,000,000,000,000

Sign up to request clarification or add additional context in comments.

1 Comment

You're absolutely right. That data is supposed to be a fraction so my mind made that exponent negative. Thanks for the reality check :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.