Sunset, sunrise, twilight calculations in LC?

William Prothero prothero at earthednet.org
Tue Aug 26 18:24:14 EDT 2014


Charles:
Your function misses a special case. If the negative number is an integer, you wouldn’t want to subtract 1 from trunc(theNegativeNumber).
Best,
Bill
On Aug 23, 2014, at 1:22 PM, Charles E Buchwald <charles at buchwald.ca> wrote:

> Jacquie, I tested my script before I posted it, and it works for negative integers.
> Colin, just for fun, I've consolidated mine to one line.
> Richmond, maybe you'd like to add "ceiling" to your sample stack?
> 
> function Floor pValue
>  if pValue < 0 then return trunc(pValue) - 1 else return trunc(pValue)
> end Floor
> 
> I know this is trivial, but here's a ceiling function, just to kind of fill out the thread:
> 
> function Ceiling pValue
>  if pValue < 0 then return trunc(pValue) else return trunc(pValue) + 1
> end Ceiling
> 
> P.S. I suppose this is the kind of situation where the Open Language thing would be very nice. If the bunch of us have created a new, valuable and effective, if esoteric, function, then it would be nice to include it somewhere so that it doesn't have to be recreated every few months... Or maybe it should be en enhancement request? I guess I'm not clear on that.
> 
> 
> On 23 Aug 2014, at 2:03 PM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> 
>> Charles' function works except for negative integers. I think it needs to check for that.
> 
> --
> Charles E. Buchwald
> CEO/Director General
> Museografica Digital
> http://digital.museografica.com
> 
> Mac OSX 10.9.4, LC 6.6.2 Commercial
> 
> LC Developer Tools: http://buchwald.ca/developer-tools/
> 
> Email Notice: http://wp.me/P3aT4d-33
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list