Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feeder.erje.net!news.motzarella.org!motzarella.org!news.motzarella.org!not-for-mail
From: Martin Eisenberg <martin.eisenberg@udo.edu>
Newsgroups: comp.soft-sys.matlab,sci.math.num-analysis
Subject: Re: robust truncation at n decimal places
Date: Sun, 7 Dec 2008 12:24:23 +0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <ghgf9m$ds5$1@news.motzarella.org>
References: <545015a5-3f51-41e3-a40b-1cf7db531b11@35g2000pry.googlegroups.com> <ghfobu$blk$1@fred.mathworks.com> <fac1f966-62ff-427d-b67c-7cce5297f210@v5g2000prm.googlegroups.com>
X-Trace: news.motzarella.org U2FsdGVkX1+0kgYVXs88msMePHzNlaJXuJJJjou2ZiatAKJXcG7x9MjWmD9N6r7BDp+MEEAyo7KyNoOQ7LfjzEzgso/2bhH9/Y+voGk8jLanuvLj31n1nqwedmX7R2whGyArpID+lRlpsKE8g28A5g==
X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers
NNTP-Posting-Date: Sun, 7 Dec 2008 12:24:23 +0000 (UTC)
X-Auth-Sender: U2FsdGVkX1+4IIcx2qJwOB4LIVKATJEnTNhlYAnGCkxCXPrMKG0UiFThwfBpdL+yuFz8YoqW/L4=
Cancel-Lock: sha1:B92xPNGNsTk+r72MNLQZ4c9CZDI=
User-Agent: Xnews/5.04.25
Xref: news.mathworks.com comp.soft-sys.matlab:505452 sci.math.num-analysis:105696


Felipe G. Nievinski wrote:

> I could try to generalize ismember() -- in the past, I've
> generalized unique(x, tol) -- but since my input data is given at
> finite precision, I find it reasonable to expect exact equality,
> after rounding/truncation. (My time tags are given in the format
> year month day hour minute seconds -- all fields are integers
> except seconds, which has seven decimal places. I end up with
> decimals beyond the seventh place because I convert them
> through datenum()).

Narrowly construed, what you want is impossible because for any given 
number of decimal digits, many numbers thus representable don't have 
terminating (but only periodic) binary expansions. What is your 
seconds field's original representation? Does the path it takes 
warrant the idea of containing exactly seven decimal places by the 
time you get to the current point?


Martin

-- 
Quidquid latine scriptum est, altum videtur.