Folks:
Try this:
You have to be sure that if myNum is a perfect negative integer, floor(myNum) = 
myInteger
while
floor(-some non-integer) = trunc(myNum - 1)

Colin’s version works too.

on mouseUp
   put 1.55 into tNum
   put 1 into tCor
   put "case: "&tNum&" Correct value: "&tCor&", Calc Value: "&floor(tNum)&cr 
into tResult
   put 0 into tNum
   put 0 into tCor
   put "case: "&tNum&" Correct value: "&tCor&", Calc Value: "&floor(tNum)&cr 
after tResult
   put -1.55 into tNum
   put -2 into tCor
   put "case: "&tNum&" Correct value: "&tCor&", Calc Value: "&floor(tNum)&cr 
after tResult
   put -1.25 into tNum
   put -2 into tCor
   put "case: "&tNum&" Correct value: "&tCor&", Calc Value: "&floor(tNum)&cr 
after tResult
   put -1 into tNum
   put -1 into tCor
   put "case: "&tNum&" Correct value: "&tCor&", Calc Value: "&floor(tNum)&cr 
after tResult
   put tResult into fld "myOutput"
end mouseUp

function floor mNum
   if tNum < 0 then
      if trunc(tNum) = tNum then
         return tNum
      else
         return trunc(tNum - 1)
      end if
   else
      return trunc(mNum)
   end if
end floor

Cheers,
Bill

On Aug 23, 2014, at 12:24 PM, Richmond <richmondmathew...@gmail.com> wrote:

> Go, get it Happy People :)
> 
> http://forums.livecode.com/viewtopic.php?f=5&t=21404
> 
> Richmond.
> 
> _______________________________________________
> 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

Reply via email to