ID: 38374 User updated by: liyanbj at cn dot ibm dot com Reported By: liyanbj at cn dot ibm dot com -Status: Feedback +Status: Closed Bug Type: Date/time related Operating System: Linux PHP Version: 5.1.4 New Comment:
That's fine. The solution is better than mine. :) Previous Comments: ------------------------------------------------------------------------ [2006-08-08 12:08:30] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip ------------------------------------------------------------------------ [2006-08-08 07:45:14] liyanbj at cn dot ibm dot com My idea on this kind of problem is that we should make a tiny modification to the testcase itself to make it more general. My solution is to use substr() to truncate the floating point number output and keeps only those digits that precise enough and are identical on all architectures. I can post my patch if you need it. ------------------------------------------------------------------------ [2006-08-08 07:38:25] liyanbj at cn dot ibm dot com Description: ------------ PROBLEM DESCRIPTION =================== This problem happens on IBM PowerPC 64bit machine (PPC64) only, and is a testing related problem (i.e. not a problem of php base). The result of test "ext/standard/tests/general_functions/sunfuncts.phpt" on PPC64 differ from the result from other architectures slightly. For example: ~~~~ SNIP FROM TEST OUTPUT ~~~~ 003+ 1044073855 06:30 6.515408927984 003- 1044073855 06:30 6.515408927982 ...... ~~~~ SNIP FROM TEST OUTPUT ~~~~ The first line is the result seen on any architecture other than PPC64, while the second line is the result from PPC64 machines. I think it's due to the nuance between the implementation of PPC64 floating point related hardware and that of IA32. According to common knowledge, two floating point numbers should never be compared for equality. So I think we should just compare part of the result floating point numbers, say, a few digits from the beginning and ignore the trailing digits. HARDWARE ENVIRONMENT ==================== /proc/cpuinfo: processor : 0 cpu : POWER5 (gr) clock : 1498.500000MHz revision : 2.2 (pvr 003a 0202) processor : 1 cpu : POWER5 (gr) clock : 1498.500000MHz revision : 2.2 (pvr 003a 0202) timebase : 187548000 machine : CHRP IBM,9111-520 SOFTWARE ENVIRONMENT ==================== SUSE Linux Enterprise Server (SLES) 10. Reproduce code: --------------- On PPC64 machine, compile php and run all test, then check: /ext/standard/tests/general_functions/sunfuncts.diff ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38374&edit=1