Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Stas Kolenikov <skolenik@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Mata buffered read 64-bit integer (8 byte/int64), how? |
Date | Thu, 13 Jun 2013 16:20:47 -0500 |
I guess at least a part of Sergiy's question is, "Can the mere mortals like himself use the quad type that is obviously out there in Mata, as all of the -quadsum()- and the like functions provide at least some interface to this type?" -- Stas Kolenikov, PhD, PStat (SSC) -- Senior Survey Statistician, Abt SRBI -- Opinions stated in this email are mine only, and do not reflect the position of my employer -- http://stas.kolenikov.name On Thu, Jun 13, 2013 at 3:55 PM, Sergiy Radyakin <serjradyakin@gmail.com> wrote: > Thank you, Stas, > this is what I am doing now. Storage in a struct (or in my case simply > in two real variables) is not a problem. The problem starts when you > need one (LARGE) value, then x=x1*2^32+x2 becomes already lossy, since > (as the manual says) : "Doubles can store up to 9,007,199,254,740,991 > exactly". Not that I would expect anyone to have files that big :) > but formally I want to be on the safe side and I didn't expect a > problem having 64-bit integers in (at least) 64-bit Stata. > > Sergiy > > On Thu, Jun 13, 2013 at 4:48 PM, Stas Kolenikov <skolenik@gmail.com> wrote: >> You can probably define the -struct-ure that could store such strings, >> and convert them into numbers for arithmetic operations. Bill Gould >> may have had an article on this in Stata Journal -- the generic use of >> structures is described in >> http://www.stata-journal.com/sjpdf.html?articlenum=pr0035. Coding >> matrix multiplication with these elements will quickly become an >> overkill :-\. >> >> -- Stas Kolenikov, PhD, PStat (SSC) >> -- Senior Survey Statistician, Abt SRBI >> -- Opinions stated in this email are mine only, and do not reflect the >> position of my employer >> -- http://stas.kolenikov.name >> >> >> >> On Thu, Jun 13, 2013 at 3:12 PM, Sergiy Radyakin <serjradyakin@gmail.com> wrote: >>> I read a 32-bit integer value from a buffered file with d=fbufget(C,fh,"%4bu"). >>> >>> How do I read a 64-bit integer from the same file when Mata does not >>> support format "%8bu"? And what can be the type of the LHS (type of >>> variable d above) to accommodate the result of the read without the >>> loss of information (double is not good, not sure about quad >>> precision). >>> >>> I can read it as 8-bytes string, or 8 individual bytes, but I also >>> need to work with the result as a value in Mata. So looking for a >>> convenient solution. >>> >>> Thank you, >>> Sergiy >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/statalist-faq/ >>> * http://www.ats.ucla.edu/stat/stata/ >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/