wtfpl

php, var_export fails with float [duplicate]

被刻印的时光 ゝ 提交于 2021-02-05 05:26:56
问题 This question already has answers here : Is floating point math broken? (31 answers) Closed 5 years ago . very simple. Consider this code: var_export (11.2); this returns with 11.199999999999999 with Php 5.6 wtf? 回答1: From the comments on the man page of php.net: Looks like since version 5.4.22 var_export uses the serialize_precision ini setting, rather than the precision one used for normal output of floating-point numbers. As a consequence since version 5.4.22 for example var_export(1.1)

php, var_export fails with float [duplicate]

≡放荡痞女 提交于 2021-02-05 05:25:45
问题 This question already has answers here : Is floating point math broken? (31 answers) Closed 5 years ago . very simple. Consider this code: var_export (11.2); this returns with 11.199999999999999 with Php 5.6 wtf? 回答1: From the comments on the man page of php.net: Looks like since version 5.4.22 var_export uses the serialize_precision ini setting, rather than the precision one used for normal output of floating-point numbers. As a consequence since version 5.4.22 for example var_export(1.1)