Boolean keywords and system routines

21 views
Skip to first unread message

fawltyl...@gmail.com

unread,
Aug 5, 2026, 7:00:49 AM (6 days ago) Aug 5
to idl-pvwave
Hi all,

most of the system routines are compiled C functions, but there are some routines distributed as .pro source file in the IDL lib directory. Source files use KEYWORD_SET() to evaluate boolean keywords, with well documented rules. However,  the builtin C routines use different rules,:

IDL> help, keyword_set(0.5)
<Expression>    INT       =        1

IDL> help, where(0, null=0.5)
<Expression>    LONG      =           -1

0.5 is true in the first case, false in the second. For non-integer keywords, users must know the type of the system routine to use it correctly. Is this a bug or a feature?

best regards,
Lajos

(this was originally discovered by the GDL folks.)


Chris

unread,
Aug 6, 2026, 2:05:09 PM (5 days ago) Aug 6
to idl-pvwave
Hey Lajos,
I don't know if this is really a bug, but it's definitely a difference between PRO code and C code. In the C code, it always converts the input keywords to the desired IDL data type. In this case, "on/off" keywords are always converted to the LONG type, which just returns 0, which of course is then "off" for the keyword.
As I'm sure you know, it's way too late to change any of this behavior. :-)
Cheers,
Chris
NV5 Geospatial Software

Reply all
Reply to author
Forward
0 new messages