comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » BYTSCL bug!?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
BYTSCL bug!? [message #65459] Tue, 03 March 2009 09:05
spidersapiens is currently offline  spidersapiens
Messages: 6
Registered: June 2006
Junior Member
I've recently been converting some IDL code to Java and found this
problem: BYTSCL returns different results based on the data type you
pass in. For example, the two lines below return different results for
9065.

print, bytscl([4124, 9065, 18946], top = 2)
print, bytscl(FLOAT([4124, 9065, 18946]), top = 2)

That's fine. Later on I found the explanation in IDL's documentation
"For floating-point input, each value is scaled using the formula (Top
+ 0.9999)*(x - Min)/(Max - Min). For integer input, each value is
scaled using the formula ((Top + 1)*(x - Min) - 1)/(Max - Min). ".

No problem, I can use their formulas. But the bad thing somehow
they're not using the formula for integer to do the actual
calculation. Here's the evidence

print, bytscl([4124, 9065, 18946], top = 2) gives me 0 on 9065.

But if you use their formula for compute it, ((2 + 1) * (9065 - 4124)
- 1) / (18946 - 4124) gives me 1.

This is frustrating me a lot because I need to duplicate the exactly
same numeric results in Java. But with this buggy BYTSCL, it's almost
impossible to duplicate its behavior. Anybody has any idea what
formula they're using internally?

Thanks!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Hide functions from other procedures
Next Topic: How to know if an object has a certain method ?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:20:16 PDT 2025

Total time taken to generate the page: 0.31997 seconds