Context: I'm trying to port into c++ the implementation of a hash function that uses double arithmetic from its original implementation in JavaScript. In this function, the doubles we are operating on can be very small and very large, and any differences would be magnified ( on purpose, since this is a hash function ).
More Details
- What's going wrong: the hash appears to be producing different results in the cpp version compared to the JavaScript version. What system are you using: currently I am running this on Debian using node 6.10.2 ( for JavaScript ) and g++ (Debian 4.9.2-10) 4.9.2 What have I tried: running the hash on a set of test vectors. What was the result: the hashes of the test vectors are different in the JS and C++ versions. What I want: to understand the cause so I can bring the versions into compatibility or understand that they cannot be compatible. More specifics: In JS I am using Float64Array for the doubles and in C++ I am using double type.
Question: is double arithmetic different on JS and C++ ?