Anyone got a date math routine?
Kenneth Brody
kenbrody at bestweb.net
Wed Dec 5 11:53:46 PST 2007
Quoting Jay R. Ashworth (Wed, 5 Dec 2007 12:57:37 -0500):
> 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):
[... rounding rather than truncating ...]
>> >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.
Correct.
> 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_
Correct again.
> 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.
Once more, correct, as a (1,.0) field can only hold 0 through 9.
> 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*.
Here's where I don't follow, however. What problems do you envision in
using, for example, an (8,.0) field instead of (1,.0) ?
--
KenBrody at BestWeb dot net spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com
More information about the Filepro-list
mailing list