Shop OBEX P1 Docs P2 Docs Learn Events
"Limit Minimum" complaint/question — Parallax Forums

"Limit Minimum" complaint/question

RaymanRayman Posts: 14,243
edited 2008-09-15 03:16 in Propeller 1
So, I was looking for a SPIN MAX function...··You know x:=MAX(y,z) to set x to the bigger of y and z.

I came across the "Limit Minimum" operator that "compares two values and returns the highest value".

Why don't they just call it "MAX"?· For a language that otherwise seems to strive for simplicity, I don't understand this at all...

Or, am I missing something?

Comments

  • evanhevanh Posts: 15,545
    edited 2008-09-13 23:24
    Just a point of view is all. That's how a bottom limit operates. You want to prevent an analogue value from dropping below a certain level. Feeding the reading plus the limit through this function will result in either the reading coming straight back out, or the limit value will replace the reading if the reading was too low.


    Evan
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-09-14 00:04
    The terms might be counterintuitive, but their semantics are compatible with the MIN and MAX operators in PBASIC. More importantly, though, the actual Spin operators are visually very intuitive. Think of

    ····A <# B

    to mean "the value of A, forced to be less than or equal to B". Then it all makes sense!

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • hippyhippy Posts: 1,981
    edited 2008-09-14 15:23
    Phil Pilgrim (PhiPi) said...
    More importantly, though, the actual Spin operators are visually very intuitive. Think of

    A <# B

    to mean "the value of A, forced to be less than or equal to B". Then it all makes sense!

    A <=# B would make more sense to me ( although in Spin that would have to be A =<# B.

    I instinctively read <# as 'less than number' which isn't correct.

    The easiest solution if one really is having problems is to create a "PRI Max(a,b)" and "PRI Min(a,b)" methods and use those elsewhere.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-09-14 15:32
    As I recall, the original Propeller Manual had typos in the MAX and MIN section. Are you using the latest version, which is corrected?

    At some point all technical manuals have a few typos creep in and some sections may be weaker because the author had a bad day. Often that is why the second edition of a text is the best. At some point, you just have to annotate according to what is clearest to you. AND report the typos to Parallax. They really do correct them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
  • RaymanRayman Posts: 14,243
    edited 2008-09-15 00:00
    Well, I guess everybody has there own way of looking at things... But, "Max" is a whole lot more clear to me than "Limit Minimum".
  • jazzedjazzed Posts: 11,803
    edited 2008-09-15 00:44
    Think Different (... then rationalize).· rolleyes.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve
  • rjo_rjo_ Posts: 1,825
    edited 2008-09-15 03:16
    Rayman et al,

    I think it was probably done this way so that the old codgers who are used to seeing it this way didn't have to think about it.

    I have to confess, I looked at it a couple of times and then just decided to ignored it...

    ...but compact code is not exactly my forte[noparse]:)[/noparse]

    The same is true for other instructions in both Spin and Propeller Assembly... if you don't like them or can't remember them, don't worry about it... they are just there to save you a few lines of code ... so if you keep your needs simple... you don't need to clutter your mind with a bunch of speculated instructions....

    On the other hand... if you just remember that they are there and roughly what they do... it is always possible to look them up when you need them.

    One of the things that all of the controversy about instructions per second (in Spin) seems to miss is just how much you can get done with a single line of code... if you really need to. Dittos for Propeller Assembly.


    Rich
    ILMP
Sign In or Register to comment.