Deutsch   English   Français   Italiano  
<87mslhag4b.fsf@bsb.me.uk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Ben Bacarisse <ben@bsb.me.uk>
Newsgroups: comp.lang.c
Subject: Re: how cast works?
Date: Mon, 12 Aug 2024 16:57:24 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <87mslhag4b.fsf@bsb.me.uk>
References: <v8vlo9$2oc1v$1@dont-email.me> <slrnvb7kis.28a.dan@djph.net>
	<v929ah$3u7l7$1@dont-email.me>
	<87ttfu94yv.fsf@nosuchdomain.example.com>
	<v93a3t$6q7v$1@dont-email.me> <v93e2q$8put$1@dont-email.me>
	<87bk228uzg.fsf@nosuchdomain.example.com> <86ttfqin3x.fsf@linuxsc.com>
	<v9bmqu$2v3e1$1@dont-email.me> <86a5hih0nv.fsf@linuxsc.com>
	<87h6bqe4x8.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 12 Aug 2024 17:57:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="53c30f705c7efa763573a633844fd370";
	logging-data="3536529"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+vYE8L8q3m0/w5V3a/rf4hgXrZkU456cg="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:mH40a9JpdxXxUaMmayD9a2uoSM4=
	sha1:DP2I9Kn03o3GlzARQbzH0+vAzoo=
X-BSB-Auth: 1.952415cef9cc72002984.20240812165724BST.87mslhag4b.fsf@bsb.me.uk
Bytes: 2246

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> [...]
>> Furthermore, there are cases where having to do a conversion from
>> one type to the same type has semantic consequences, even though
>> the types are the same.
>
> What are these cases?

The case that comes to mind is where the result of a floating point
expression is represented with more precision than the type can hold
when stored.

6.3.1.8 p2:
  The values of floating operands and of the results of floating
  expressions may be represented in greater range and precision than
  that required by the type; the types are not changed thereby.[63]

The footnote explains that the implicit conversion done on assignment
will change the value even though the types may be the same:

[63] The cast and assignment operators are still required to remove
     extra range and precision.

-- 
Ben.