Sunset, sunrise, twilight calculations in LC?

Charles E Buchwald charles at buchwald.ca
Wed Aug 27 14:26:09 EDT 2014


My apologies... I tested this when I first wrote it, and I thought I had everything covered. As others have pointed out, it requires a test for negative integers, so it should be:

function Floor pValue
   if pValue is an integer OR pValue < 0 then return trunc(pValue) - 1
   else return trunc(pValue)
end Floor

function Ceiling pValue
   if pValue is an integer OR pValue > 0 then return trunc(pValue) + 1
   else return trunc(pValue)
end Ceiling

- Charles

On 27 Aug 2014, at 11:11 AM, Bob Sneidar <bobsneidar at iotecdigital.com> wrote:

> Nicely done! I love this list!!
> 
> Bob S
> 
> 
> On Aug 23, 2014, at 13:22 , Charles E Buchwald <charles at buchwald.ca<mailto:charles at buchwald.ca>> wrote:
> 
> 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
> 
> _______________________________________________
> 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

--
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





More information about the use-livecode mailing list