PHP Floating point precision
Floating point precision
It is typical that simple decimal fractions like 0.1
or
0.7
cannot be converted into their internal binary
counterparts without a small loss of precision. This can lead to
confusing
results: for example, floor((0.1+0.7)*10)
will usually
return 7
instead of the expected 8
,
since the internal representation will be something like
7.9
.
This is due to the fact that it is impossible to express some
fractions in decimal notation with a finite number of digits. For
instance,
1/3
in decimal form becomes
0.3
.
So never trust floating number results to the last digit, and never
compare
floating point numbers for equality. If higher precision is
necessary,
the arbitrary
precision math functions
and
gmp
functions are available.
相关文档:
步骤:
1.运行命令:./ext_skel --extname=sharemem
2.运行命令:./configure --with-php-config=/usr/local/lnmp/php/bin/php-config
3.make clean
make
make install
/usr/local/lnmp/php/sbin/php-fpm restart
/usr/local/lnmp/php/bin/php-cgi /data0/htdocs/blog/sharemem.php
代码如下:
1.config.m4
PHP_A ......
http://hi.baidu.com/fish124423/blog/item/c6f9f310190dd779ca80c456.html解决error trying access httpd. conf file.you will need to manually configure the的配置问题
Apache+mysql+php在windows下的配置(成功)
2008-12-16 14:49
Apche下载地点:http://www.apache/org
Or http://www.51cto.com/html/ ......
通讯录已经大致完成了,但如果记录数多时,查找起来很不方便,如果加一个搜索功能就好了。今天我们就来制作一个搜索功能
在Index.php合适的地方加入搜索框
<!---搜索框--->
<!--这里的所有值前面加前缀“S_”以区分-->
<form id="form1" name="form1" method="post" action="Search.php ......
PHP在运行的时候,直接kill掉,有肯能造成数据的丢失。幸好php模块,有针对signal的处理。
处理方式,首先检查有没有安装 PCNTL 模块
然后可以在一个包含文件中,添加以下代码
global $exitFlag;
$exitFlag = false;
// 增加linux信号量处理
if (DIRECTORY_SEPARATOR != '\\') {
pcntl_signal(SI ......