gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected handling of mixed-precision integer arithmetic


From: Benjamin Kowarsch
Subject: Re: Unexpected handling of mixed-precision integer arithmetic
Date: Sat, 3 Feb 2024 13:29:15 +0900



On Fri, 2 Feb 2024 at 00:35, Nelson H. F. Beebe wrote:
In most programming languages, the conventions for evaluation of
expressions in integer arithmetic with operands of mixed precision is
that the lower-precision ones are promoted to the higher precision,
before the _expression_ is evaluated.

Both PIM and ISO use name equivalence and thus there is no promotion of typed values, only untyped constants can be promoted. Ada is even stricter, it uses strict name equivalence, thus TYPE Fahrenheit = REAL and TYPE Celsius = REAL are incompatible even though they are both of type REAL. In our M2 revision we adopted this convention. In Oberon, Wirth had adopted type promotion (called type inclusion) but later called it a "big mistake" and reverted it again in Oberon-07.

regards
benjamin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]