Re: Division by Zero Error

2017-07-09 Thread Bob Sneidar via use-livecode
try
-- some code here
catch theError
breakpoint
end try

see what theError contains. 

Bob S


> On Jul 9, 2017, at 08:00 , Roger Guay via use-livecode 
>  wrote:
> 
> Yes, but first let me play with it to see if I am doing something else to 
> cause my problem.
> 
> Roger


___
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


Re: Division by Zero Error

2017-07-09 Thread Roger Guay via use-livecode
Yes, but first let me play with it to see if I am doing something else to cause 
my problem.

Roger

> On Jul 8, 2017, at 10:42 AM, Mark Wieder via use-livecode 
>  wrote:
> 
> On 07/08/2017 08:26 AM, Roger Guay via use-livecode wrote:
>> I am using the try/catch method you mention, but it doesn’t seem to work 
>> reliably.
> 
> That's a bit disturbing. Can you post your code?
> 
> -- 
> Mark Wieder
> ahsoftw...@gmail.com
> 
> ___
> 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

Re: Division by Zero Error

2017-07-08 Thread Mark Wieder via use-livecode

On 07/08/2017 08:26 AM, Roger Guay via use-livecode wrote:

I am using the try/catch method you mention, but it doesn’t seem to work 
reliably.


That's a bit disturbing. Can you post your code?

--
 Mark Wieder
 ahsoftw...@gmail.com

___
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

Re: Division by Zero Error

2017-07-08 Thread Roger Guay via use-livecode
Thanks very much Mark, Herman and Mike. I am using the try/catch method you 
mention, but it doesn’t seem to work reliably. I’m probably doing something 
else wrong . . . I’ll keep trying. Thanks again for your time.

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

Re: Division by Zero Error

2017-07-08 Thread Mike Bonner via use-livecode
I use the try/catch/finally method mark mentions if there is a chance of
divide by 0 errors.  That way, no need to predict, just try it, and if
theres an error, respond accordingly.

On Sat, Jul 8, 2017 at 1:08 AM, hh via use-livecode <
use-livecode@lists.runrev.com> wrote:

> -- d0 is what you judge as "is at about zero" for your input
> -- select it such in size, that you don't get an "overflow" or
> -- such that 1/d0 is your max ± vertical plot value (= clipping)
>
> function f3 x
>local d0=0.001
>if abs(x-3) < d0 then
>   return empty -- don't plot in case of an empty return
>else return 1/(x-3)
> end f3
>
>
> ___
> 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

Re: Division by Zero Error

2017-07-08 Thread hh via use-livecode
-- d0 is what you judge as "is at about zero" for your input
-- select it such in size, that you don't get an "overflow" or
-- such that 1/d0 is your max ± vertical plot value (= clipping)

function f3 x
   local d0=0.001 
   if abs(x-3) < d0 then
  return empty -- don't plot in case of an empty return
   else return 1/(x-3)
end f3


___
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

Re: Division by Zero Error

2017-07-08 Thread Mark Schonewille via use-livecode
Usually, I can predict that a numerator is going to be 0, e.g. in 
1/(x^2). I just check the value of the numerator before doing the division.


In rare cases, I can't predict the value of the numerator. In those 
cases, I put a try control structure around the offending lines and some 
code to clean up after the "final" line.


Kind regards,

Mark Schonewille
http://economy-x-talk.com
https://www.facebook.com/marksch

Buy the most extensive book on the
LiveCode language:
http://livecodebeginner.economy-x-talk.com

Op 08-Jul-17 om 05:35 schreef Roger Guay via use-livecode:

I often find that I have to deal with a division by zero error message in 
plotting functions, solving equation etc. Are there methods or techniques used 
to programmatically handle or work-around a possible division by zero? e.g. If 
I want to evaluate y= 1/(x-3), what can I do to deal with a possible x=3 
situation?

Thanks for your help,

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


Division by Zero Error

2017-07-07 Thread Roger Guay via use-livecode
I often find that I have to deal with a division by zero error message in 
plotting functions, solving equation etc. Are there methods or techniques used 
to programmatically handle or work-around a possible division by zero? e.g. If 
I want to evaluate y= 1/(x-3), what can I do to deal with a possible x=3 
situation? 

Thanks for your help,

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