Hello, I found the missing information in POWER ISA /To use a multiply-add to perform an IEEE or Java// //compliant multiply, the addend must be -0.0. This// //is necessary to insure that the sign of a zero result// //will be correct when the product is -0.0 (+0.0 + -0.0// // +0.0, and -0.0 + -0.0 -0.0). When the sign of a// //resulting 0.0 is not important, then +0.0 can be// //used as an addend which may, in some cases,// //avoid the need for a second register to hold a -0.0// //in addition to the integer 0/floating-point +0.0 that// //may already be available./
so the example shows it: $ cat t2.c #include "stdio.h" #include "altivec.h" int main() { vector float X={ -1, 0, 0, 0 }; vector float Y={ -1, -1, -1, -2 }; vector float Z, V; * vector float p4f_ZERO={ 0, 0, 0, 0 };** ** vector float p4f_mZERO={ -0.0, -0.0, -0.0, -0.0 };* Z = vec_madd(X, Y, p4f_ZERO); V = vec_madd(X, Y, p4f_mZERO); printf("%f %f %f %f \n",Z[0], Z[1], Z[2], Z[3]); printf("%f %f %f %f \n",V[0], V[1], V[2], V[3]); vector float U; U= X * Y ; printf("%f %f %f %f \n",U[0], U[1], U[2], U[3]); return(0); } $ gcc t2.c debian@vm18:~$ ./a.out 1.000000 0.000000 0.000000 0.000000 *1.000000 -0.000000 -0.000000 -0.000000 * 1.000000 -0.000000 -0.000000 -0.000000 So the vector p4f_ZERO must be modified with a signed value of -0.0 in order to have that function to work. -- __________________________________________________________________________ thf - Thierry Fauck - tfa...@free.fr> /pubkey: 4096R/FCC181CE/ /fingerprint: 5CCF 6B82 DE4E E72A A40B B63E A153 BF4F FCC1 81CE/
-- debian-science-maintainers mailing list debian-science-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers