From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a90718b61c5de714 X-Google-Attributes: gid103376,public From: pvanbell@cloud9.net (Paul Van Bellinghen) Subject: Re: assignments using different types Date: 1997/01/29 Message-ID: <32eeaf02.9413191@NEWS.CLOUD9.NET>#1/1 X-Deja-AN: 212858407 references: <32EE4431.6D24@ti.com> organization: Cloud 9 Internet, White Plains, NY, USA newsgroups: comp.lang.ada Date: 1997-01-29T00:00:00+00:00 List-Id: why are you re-casting variables that are already in the proper cast. The only time you need to re-cast a variable into float is when the variable is an integer. On Tue, 28 Jan 1997 12:23:45 -0600, David Dessert wrote: >I have a question about readability and efficiency of assignments >when using strict types in Ada83. I'm using the TI-Tartan C40 >compiler, which has few Ada95 features. > >Example: > type Distance_Type is new float range 0.0 .. 1000.0; > type Time_Type is new float range 0.0 .. 10.0; > type Velocity_Type is new float; > > Distance : Distance_Type := 100.0; > Time : Time_Type := 10.0; > Velocity : Velocity_Type; > >... > > -- A difficult to read, but legal Ada assignment. > Velocity := Velocity_Type(float(Distance) / float(Time)); > > >Can anyone provide me with suggestions to improve the readability >of the above assignment? Of course, I'd like efficiency to be >similar to that of using the same type for all the variables.