[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

comparing the magnitude order

From: CdeMills
Subject: comparing the magnitude order
Date: Fri, 9 Sep 2011 02:24:51 -0700 (PDT)


I would like to compare if two numbers are of the same order of magnitude. I
implement this as
magn =@(x, y) max (x, y)/min (x, y);

But there are redundancies: if x is > y, then the expression becomes x/y,
else y/x. Is it possible to introduce tests inside function handle ?
magn=@(x, y) if (x > y) x/y else y/x endif
is accepted but doesn't return anything.



View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]