MLwiN changes numbers

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
RasulGro
Posts: 3
Joined: Tue Apr 19, 2016 12:28 pm

MLwiN changes numbers

Post by RasulGro »

Hello everyone,

During my work with MLwiN I experienced that the software slightly changed the values for some of my imported variables.
I exported the values from excel. The values are the item averages from various combined item scores on a 5-point Likert scale.
So all values I imported range from 1 to 5.
What MLwiN did is slightly changing the imported values.
For example the orignial value 3.6 became 3.599999905
4.8 became 4.800000191.
I also can confirm that the original values in excel are the exact values and not just a consequence of not displaying enough decimal places.
One could argue that these changes are extremeley small and probably neglectable. Yet I'm interested what happened and how I could prevent MLwiN from changing these numbers.
It also did not happen to all of my variables, just to some of them.
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: MLwiN changes numbers

Post by ChrisCharlton »

The behaviour that you are seeing is due to MLwiN storing data as single-precision binary floating point numbers (see https://en.wikipedia.org/wiki/IEEE_floating_point). As the elements of this are stored in base-2 there are numbers that can be expressed exactly in base-10 but not here, hence the values that you are seeing. If you reduce the number of decimal places, or change to displaying significant digits (via the Options->Numbers menu) you should see the numbers as you are expecting.

Excel will have similar issues in representing numbers (https://en.wikipedia.org/wiki/Numeric_p ... soft_Excel suggests that it is using double-precision floating point numbers internally), but by default it will round the numbers when displaying them.
ghudson621
Posts: 3
Joined: Fri Jun 17, 2016 5:29 am

Re: MLwiN changes numbers

Post by ghudson621 »

That is due to the floating point numbers. They put the exact value and not approximate :)
Post Reply