From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 616A53858D1E for ; Sat, 25 Mar 2023 11:58:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 616A53858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x532.google.com with SMTP id x3so17587789edb.10 for ; Sat, 25 Mar 2023 04:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679745501; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=d9XKw9/rkyPN6aTUnydoy8aMpTTzTW5vSSWZR6xYP3s=; b=fCE7zn97IATdO4VEquhrbePG7sORTd1eTPUkLSxttkNkupdRaHcyXDRVQDX5rpGX+P Iu+24y87379ELax+t5pqmgnH7jiKrkdLoctdhmC9rDouxk8d+quyO4ReNrrfQfDTx3gO hJ45JLvgYdQahDy8gBGUX1d2ur1GTA6Jycdd4OSCFiBy9/m8p38tCdPKUKr0BpnnZ2TH pz1hBrX0/iRV2mHs4Fn2jIWGQIpWF3qVasw4Tj+dzExuk1o4uwj1cAMKkYuIm7ecndwO Vy28PdKDpZPiNecYqXByffc1hIgSPmobAmQyOoOKnSFWBLITiAfjSAJPDYrDiLcBME4P M09g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679745501; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d9XKw9/rkyPN6aTUnydoy8aMpTTzTW5vSSWZR6xYP3s=; b=I8/A/cbJZxg3dm0DQ19GJU8LhgLtmEXxM7C9UI2/Vn/BpBG7G45UUz2981LsBjOyNz qdryjGb/0B+0yiYIbpZwzRwJwTdOBTujGzr+JyhV4BiZTPl8ZRaTsbb00NRuFZTbYr72 6hTR0uco5qD1WHrWjz0r2g4+gAilu/0PR4epdqjjoVA6TMRvXo16mMX8RATwEZkJACCs +hzRBFPOxnQfovhhmhmZS7RPbnP+wwIsz4brebj+3DADwHHI1kD5a2upU1AKLYdBHgJO pthUzaQAyCB1XOcgMAWbZ6752/AlEs8Ou7mF1tSCtQW46mRpYhbqppdNPFXA8Cs3RiyA NxMg== X-Gm-Message-State: AAQBX9dTHJWMBfTWhUukFKtRE/dkMb/WNY9locdtgwISbuXKFJnoxgVw G8MTbG9oBWEnMHHUSBGE99G1B443iSlXxmiyp+s= X-Google-Smtp-Source: AKy350YD0NFyElDZGe8+L90zVHchmJDPvfkbgiUCiM8+I/aLa1QrQ8Ly5DctNs19Qgxhd1OmvB4OPMZf8Yx2N41w1ek= X-Received: by 2002:a50:d711:0:b0:4fc:7014:f91c with SMTP id t17-20020a50d711000000b004fc7014f91cmr2892722edi.5.1679745500760; Sat, 25 Mar 2023 04:58:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Sat, 25 Mar 2023 11:58:08 +0000 Message-ID: Subject: Re: float is constructible from double, C++23's std::float13_t is not To: Filippo Bistaffa Cc: gcc-help Content-Type: multipart/alternative; boundary="000000000000e2cc9705f7b839c4" X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000e2cc9705f7b839c4 Content-Type: text/plain; charset="UTF-8" On Sat, 25 Mar 2023, 11:29 Filippo Bistaffa, wrote: > I'm not sure I fully understand that quote: double can be converted to > float (even if float has a lower rank) because they are both "standard", > whereas the same doesn't apply to std::float16_t? > Correct. float16_t is an extended floating-point type. https://en.cppreference.com/w/cpp/language/types#Floating-point_types > On Fri, Mar 24, 2023, 21:22 Jonathan Wakely wrote: > >> >> >> On Fri, 24 Mar 2023, 17:05 Filippo Bistaffa via Gcc-help, < >> gcc-help@gcc.gnu.org> wrote: >> >>> I was playing around with gcc-trunk's support for C++23's std::float13_t >>> and I found out that, while float is constructible from double, as far >>> as I >>> can tell std::float13_t is not. >>> In other words, the following code compiles OK: >>> >>> #include >>> #include >>> int main() { >>> std::vector x(5); >>> std::vector y(std::begin(x), std::end(x)); >>> } >>> >>> whereas the following does not: >>> >>> #include >>> #include >>> int main() { >>> std::vector x(5); >>> std::vector y(std::begin(x), std::end(x)); >>> } >>> >>> See this snippet . >>> Am I missing something or is it supposed to be like that? >>> >> >> Yes, this is the correct behaviour. The C++23 standard says: >> >> "A prvalue of floating-point type can be converted to a prvalue of >> another floating-point type with a greater or equal conversion rank ( >> [conv.rank] ). >> A prvalue of standard floating-point type can be converted to a prvalue >> of another standard floating-point type." >> >> >> >> --000000000000e2cc9705f7b839c4--