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

Home » Public Forums » archive » Conversion Error?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Conversion Error? [message #16813 is a reply to message #16680] Tue, 17 August 1999 00:00 Go to previous messageGo to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <4KVt3.65216$jl.41071979@newscontent-01.sprint.ca>
"Laurent Chardon" <chardons@NOT_THISsprint.ca> writes:

> Thanks David and Martin for your help. So if I understand
> properly, IDL uses fix() by default when converting doubles to
> integer. That's tricky. Does it make sense to do that?

Yes, it does. I know of no other language that rounds by default
when converting float to integer types. (Ok, so there probably
are *some* languages that use round).

> The solution would be to use c=fltarr(round(size)). Shouldn't IDL
> do that by default?
> I'm wondering what's the use of using fix() instead of round() in
> this instance. Does anybod know?

You can bet a number of applications *rely* on this default
behaviour. Needs differ from one situation to another. You should
also consider using either ceil() or floor() instead of round(),
in some cases.

Regards,

Stein Vidar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: looking for some software to convert idl format data to text
Next Topic: seperators in menus

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

Current Time: Sat Oct 11 13:05:55 PDT 2025

Total time taken to generate the page: 0.24197 seconds