Float variable

<< Click to Display Table of Contents >>

Navigation:  Reference Manual > Variables >

Float variable

A float variable is one to which the answer is not necessarily a whole number (it may contain a decimal point).

The value for each respondent is calculated using an arithmetic definition.

All calculations are computed using double precision floating point arithmetic.

Variables can be stored in the data. You can fix the number of decimal places which are used when displaying, saving or exporting data.

If stored, you will need to set the width to the number of characters necessary to hold the largest answer you expect.  You must always allow room for the decimal places (at least one if not set), for example the number 100 will always needs a width of 5 because it will be stored as "100.0".  If set to 2 decimal places then 100 will need a width of 6 because it will be stored as "100.00".  If negative values are allowed, you should include an extra location to hold the minus sign.

If stored and the decimal places has not been set, it will not include trailing zero decimal places which means the decimal point will not always be in the same place (floating).  Some decimal places may also be removed if there is not enough space for the digits before the decimal point.

If stored and decimal places has been set then this will always be the number of decimal places used when storing the data.

A float question may occupy a width of up to 20 data locations.

TIP: float variables that are filtered will be treated as "undefined" in arithmetic calculations  unless "Treat undefined as zero" is set.