3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lat1 = 35.697959; $lat2 = 35.697959; $lon1 = 139.707085; $lon2 = 139.707085; $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); var_dump($dist); // returns 1 $dist = acos($dist); var_dump($dist); // returns NAN $x = 1; $x = acos($x); var_dump($x); // doesn't return NAN
based on BWsO8
Output for 5.5.0 - 5.6.38, 7.0.0 - 7.3.2
float(1) float(NAN) float(0)
Output for hhvm-3.12.14 - 3.22.0
float(1) float(0) float(0)