Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Generate puzzle

From   "Michael Blasnik" <>
To   <>
Subject   st: Re: Generate puzzle
Date   Sat, 28 Jan 2006 14:54:07 -0500

This comes up on Statalist about once per week. It is an issue of precision. If you want x to contain more than 7.5 digits of precision, then generate a double or long, not a float (gen double x=...). see

Michael Blasnik

----- Original Message ----- From: "Andrzej Niemierko" <aniemierko@PARTNERS.ORG>
To: "Stata" <>
Sent: Saturday, January 28, 2006 2:34 PM
Subject: st: Generate puzzle

Could someone please explain to me the following strange behaviour? When I
generate a new variable:
gen x=3366161 and then:
gen x2=10*x1
the number that I get for x2 is 33661608 (not the correct number 33661610).
When the initial x1 number is 3366162 the x2 is correct, that is 33661620.
Any help?
*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index