Anyone got a date math routine?
Jay R. Ashworth
jra at baylink.com
Wed Dec 5 09:57:37 PST 2007
On Wed, Dec 05, 2007 at 12:13:04PM -0500, Kenneth Brody wrote:
> Quoting Jay R. Ashworth (Wed, 5 Dec 2007 10:17:33 -0500):
> >On Wed, Dec 05, 2007 at 09:32:45AM -0500, Kenneth Brody wrote:
> [...]
> >>There is no "round function" because none is needed. It's done for you
> >>automatically. For example, put "1.666" into a .2 field and you get
> >>"1.67".
> >>Store "125"/"100" into a .0 field and you get "1".
> >
> >This *seems* like a Really Neat Idea... but in my case here, what it
> >means is that I need to know the length of the integer part of the
> >result of dividing by 57 million *before I declare the length of the
> >target field*.
> >
> >I'm not sure I can do that.
>
> I'm not sure what problem you are envisioning. Can you give a specific
> example of what problem you see?
You are suggesting that the way to round the results of my dividing
(frex) 123,594 seconds by the 86,400 seconds in a day, to find out that
it's 1.43 days, which I'll round to 1 day, is by assigning the results
of that division to a 1,.0 field, since 1.43 assigned to that field
will result in 1, and 1.52 would result in 2.
Assuming I've understood you correctly, the question is:
What happens when what I am dividing by 86,400 is 935,292?
The result of that is 10.825138_
10 days is a valid answer. (Though it *might* get clipped earlier, to
weeks, it might not)
But I can't round it in a 1,.0 field.
Using numeric fields to do rounding requires you to count from the left
side of *the entire number*, and worse, to do it at compile time. When
I need to round, I need to do it *from the decimal point rightward*.
Cheers,
-- jra
--
Jay R. Ashworth Baylink jra at baylink.com
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274
Witty slogan redacted until AMPTP stop screwing WGA
More information about the Filepro-list
mailing list