I would like to append this to what may be a record number of incorrect scripts on my part. Hugh pointed out in the forums that the floor of 5 is 5, and the ceiling of -5 is -5. These scripts might actually be correct, but I'm not guaranteeing anything at this point... My apologies for the noise, and thank you, list members, for your patience and persistence.
function Floor pValue if pValue is an integer OR pValue > 0 then return trunc(pValue) else return trunc(pValue) - 1 end Floor function Ceiling pValue if pValue is an integer OR pValue < 0 then return trunc(pValue) else return trunc(pValue) + 1 end Ceiling On 27 Aug 2014, at 12:20 PM, Earthednet-wp <proth...@earthednet.org> wrote: > Beware: > This function fails when the number is a negative integer. > Bill > >> function Floor pValue >> if pValue < 0 then return trunc(pValue) - 1 else return trunc(pValue) >> end Floor > > William Prothero > http://es.earthednet.org > >> On Aug 27, 2014, at 9:11 AM, Bob Sneidar <bobsnei...@iotecdigital.com> wrote: >> >> Nicely done! I love this list!! >> >> Bob S >> >> >> On Aug 23, 2014, at 13:22 , Charles E Buchwald >> <char...@buchwald.ca<mailto:char...@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@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > _______________________________________________ > use-livecode mailing list > use-livecode@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 _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode