[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Request for "fix float to u64 intrinsics"
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] Request for "fix float to u64 intrinsics" |
Date: |
Fri, 11 Sep 2020 16:41:24 +0200 |
User-agent: |
Mutt/1.14.5+76 (bb407ec3) vl-127292 (2020-06-24) |
On 2020-09-11 10:32:06 +0000, Kyryl Melekhin wrote:
> I guess I'll explain the bug here as well.
> consider this code:
>
> float a = -123.987;
> printf("%lu", (unsigned long int)a);
>
> Before the patch output would be 123.
> After the patch output would be 18446744073709551493.
There's no bug. That's undefined behavior (see ISO C17, 6.3.1.4)
because -123 is not representable in unsigned long int. So, any
behavior is correct.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
- [Tinycc-devel] Request for "fix float to u64 intrinsics", Christian Jullien, 2020/09/10
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics", Kyryl Melekhin, 2020/09/11
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics",
Vincent Lefevre <=
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics", Kyryl Melekhin, 2020/09/11
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics", Vincent Lefevre, 2020/09/11
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics", Vincent Lefevre, 2020/09/12
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics", Herman ten Brugge, 2020/09/12
- Message not available
- Message not available
- Message not available
- Re: [Tinycc-devel] Request for "fix float to u64 intrinsics", Kyryl Melekhin, 2020/09/17