wlandsman / IDLAstro

Astronomy related procedures in the commercial IDL language
https://asd.gsfc.nasa.gov/archive/idlastro/
BSD 2-Clause "Simplified" License
144 stars 64 forks source link

-9223372036854775808LL in MRDFITS #32

Closed hivon closed 1 year ago

hivon commented 3 years ago

The routine MRDFITS uses the value -9223372036854775808LL as an offset (in line 984). This value is not currently accepted by GDL nor FL (see https://github.com/gnudatalanguage/gdl/issues/1037) and makes the routine unusable. Replacing that value with 2LL^63 would work properly in IDL, GDL and FL.

fawltylanguage commented 3 years ago

I have changed FL to accept the (out of range) 9223372036854775808 value, so FL 0.79.50 works as expected.

2LL^63 silently overflows, too (or causes a run-time error if sanitizers are enabled).'8000000000000000'xll would be the ideal solution, but, unfortunately, GDL evaluates it to -1.

GillesDuvert commented 3 years ago

It is important that MRDFITS works in GDL, so gnudatalanguage/gdl#1037 needs to be solved.

GillesDuvert commented 3 years ago

Strangely, as a fervent MRDFITS user with GDL, I never encountered any problem, though.

GillesDuvert commented 3 years ago

I just commited an ugly patch that gives

GDL> help,'8000000000000000'xll
<Expression>    LONG64    =   -9223372036854775808

because solving gnudatalanguage/gdl#1037 is too complicated, as explained there. So if IDLAstro uses '8000000000000000'xll instead of -9223372036854775808LL then it should work with GDL.