|
|
Re: Meaning of the expression [message #93641 is a reply to message #93640] |
Tue, 20 September 2016 02:39   |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 09/20/2016 10:05 AM, Helder wrote:
> On Tuesday, September 20, 2016 at 8:05:22 AM UTC+2, Sanu wrote:
>> exp = 'BYTE(B1 NE 0)*1'
>>
>> What is the meaning of this expression???
> It's not an expression, it's an assignment.
> It assigns a string to the variable exp.
> However, the math displayed in the string is somewhat strange:
> - b1 NE 0 will always give a byte result, so there is no need for the byte function
> - the *1 will convert the result to an integer or long (depending on the compiler options)
- B1 NE 0 is of type BYTE with the Boolean flag set, the BYTE() function
removes that flag
- the only difference the Boolean flag makes, is to HELP,
ISA(XXX,/boolean) and implied print
- once *1 is applied, this does not matter
if compile_opt idl2 or defint32 is set, the math in the string could be
shortened to 'LONG(B1 NE 0)', otherwise 'FIX(B1 NE 0)'
|
|
|
Re: Meaning of the expression [message #93642 is a reply to message #93641] |
Tue, 20 September 2016 02:54   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Tuesday, September 20, 2016 at 11:39:39 AM UTC+2, Markus Schmassmann wrote:
> On 09/20/2016 10:05 AM, Helder wrote:
>> On Tuesday, September 20, 2016 at 8:05:22 AM UTC+2, Sanu wrote:
>>> exp = 'BYTE(B1 NE 0)*1'
>>>
>>> What is the meaning of this expression???
>> It's not an expression, it's an assignment.
>> It assigns a string to the variable exp.
>> However, the math displayed in the string is somewhat strange:
>> - b1 NE 0 will always give a byte result, so there is no need for the byte function
>> - the *1 will convert the result to an integer or long (depending on the compiler options)
> - B1 NE 0 is of type BYTE with the Boolean flag set, the BYTE() function
> removes that flag
> - the only difference the Boolean flag makes, is to HELP,
> ISA(XXX,/boolean) and implied print
> - once *1 is applied, this does not matter
>
> if compile_opt idl2 or defint32 is set, the math in the string could be
> shortened to 'LONG(B1 NE 0)', otherwise 'FIX(B1 NE 0)'
Hi Markus,
what version of IDL do you use?
I get very different results:
IDL> help, 0 NE 0
<Expression> BYTE = 0
IDL> help, isa(0b NE 0b, /boolean)
<Expression> BYTE = 0
IDL> !version
{
"ARCH": "x86_64",
"OS": "Win32",
"OS_FAMILY": "Windows",
"OS_NAME": "Microsoft Windows",
"RELEASE": "8.5.1",
"BUILD_DATE": "Nov 14 2015",
"MEMORY_BITS": 64,
"FILE_OFFSET_BITS": 64
}
The only way I can create a boolean is with the boolean function.
IDL> help, isa(boolean(0b NE 0b), /boolean)
<Expression> BYTE = 1
Even this does not return a boolean:
IDL> help, isa(boolean(0b) NE boolean(0b), /boolean)
<Expression> BYTE = 0
Cheers,
Helder
|
|
|
Re: Meaning of the expression [message #93643 is a reply to message #93642] |
Tue, 20 September 2016 06:55   |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 09/20/2016 11:54 AM, Helder wrote:
> On Tuesday, September 20, 2016 at 11:39:39 AM UTC+2, Markus Schmassmann wrote:
>> On 09/20/2016 10:05 AM, Helder wrote:
>>> On Tuesday, September 20, 2016 at 8:05:22 AM UTC+2, Sanu wrote:
>>>> exp = 'BYTE(B1 NE 0)*1'
>>>>
>>>> What is the meaning of this expression???
>>> It's not an expression, it's an assignment.
>>> It assigns a string to the variable exp.
>>> However, the math displayed in the string is somewhat strange:
>>> - b1 NE 0 will always give a byte result, so there is no need for the byte function
>>> - the *1 will convert the result to an integer or long (depending on the compiler options)
>> - B1 NE 0 is of type BYTE with the Boolean flag set, the BYTE() function
>> removes that flag
>> - the only difference the Boolean flag makes, is to HELP,
>> ISA(XXX,/boolean) and implied print
>> - once *1 is applied, this does not matter
>>
>> if compile_opt idl2 or defint32 is set, the math in the string could be
>> shortened to 'LONG(B1 NE 0)', otherwise 'FIX(B1 NE 0)'
> what version of IDL do you use?
> I get very different results:
> IDL> help, 0 NE 0
> <Expression> BYTE = 0
> IDL> help, isa(0b NE 0b, /boolean)
> <Expression> BYTE = 0
> IDL> !version
> {
> "ARCH": "x86_64",
> "OS": "Win32",
> "OS_FAMILY": "Windows",
> "OS_NAME": "Microsoft Windows",
> "RELEASE": "8.5.1",
> "BUILD_DATE": "Nov 14 2015",
> "MEMORY_BITS": 64,
> "FILE_OFFSET_BITS": 64
> }
>
> The only way I can create a boolean is with the boolean function.
> IDL> help, isa(boolean(0b NE 0b), /boolean)
> <Expression> BYTE = 1
> Even this does not return a boolean:
> IDL> help, isa(boolean(0b) NE boolean(0b), /boolean)
> <Expression> BYTE = 0
Hi Helder,
your right, IDL logical operators give back BYTE and not BOOLEAN, which
doesn't seems very sensible to me. My answer reflects what I thought
should be instead of what is. Sorry for the confusion.
Cheers, Markus
PS: IDL> isa(!true,/boolean)
1
|
|
|
|