Sunset, sunrise, twilight calculations in LC?

Charles E Buchwald charles at buchwald.ca
Sat Aug 23 16:22:04 EDT 2014


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





More information about the use-livecode mailing list