[Info-vax] Where is EISNER:: and who funds it?

Simon Clubley clubley at remove_me.eisner.decus.org-Earth.UFP
Tue Dec 28 11:54:12 EST 2021


On 2021-12-26, Arne Vajhøj <arne at vajhoej.dk> wrote:
> On 12/26/2021 5:48 AM, Simon Clubley wrote:
>> On 2021-12-25, Dave Froble <davef at tsoft-inc.com> wrote:
>>> As far as that goes, so is Fahrenheit with either.  It's just a multiplier and
>>> an offset.
>>>
>>> A couple of lines from a simple VB program I have:
>>>
>>>       C = (F - 32) * 5 / 9
>>>       F = C * 9 / 5 + 32
>> 
>> I looked at the above two statements and basically went "eek!" at
>> all the implicit type conversions potentially going on above. :-)
>> 
>> Does VB do the right thing above or do variables F and C get
>> type converted to an integer (with loss of information) before
>> the above calculations are done ?
>> 
>> Just curious. (In situations like that, I would have written the
>> integers with a decimal component, so 32 would become 32.0 for example.)
>
> VMS Basic behaves like most other languages.
>
> If the input variable is integer then it does integer math.
>
> If the input variable is floating point then it does floating point math.
>
> And it produces expected result if input variable and output
> variable are same type.
>
> Only if input is integer and output is floating point it is
> necessary to do something to change the math from integer math
> to floating point math.
>

I've hit cases in the past with at least one language (I can't remember
which) where integer constants used with a floating point variable would
give a different result than FP constants used with a FP variable.

As a result, I would now write "C = (F - 32) * 5 / 9" if I am working
with integer variables and "C = (F - 32.0) * 5.0 / 9.0" if I am working
with decimal/float variables.

That's why the use of integers with (presumed) FP variables stood
out above... :-)

Simon.

-- 
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.



More information about the Info-vax mailing list