what is the PHP equivalent of Javascript Number.MIN_VALUE? -


what php equivalent of number.min_value?

i able find php constants, unable spot php_ini_min. http://php.net/manual/en/reserved.constants.php such constant exist?

any idea?

here numbers getting javascript:

number.max_value=1.7976931348623157e+308 number.min_value=5e-324 

here numbers php:

define("php_int_min", -1 - ( pow(2, 8*php_int_size - 1) - 1) ); php_int_max = 2147483647  php_int_min = -2147483648 

they not coincide

well, easy calculate. divide 1.0 2.0 until reaching zero, number right before 0 equals number.min_value. see this codepad

php

<?php $a = 1.0; while (1) {     $b = $a;     $a /= 2.0;     if ($a == 0.0)         break; } var_dump($b); ?> 

output

float(4.9406564584125e-324) 

but remember give smallest positive number on server not client. if want interpret number coming client-side, better send number.min_value client server through or post request.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -