in reply to Re^8: Introspection into floats/NV
in thread Introspection into floats/NV

What? BTW, I thought that was clear from the context.

Replies are listed 'Best First'.
Re^10: Introspection into floats/NV
by LanX (Saint) on Jun 04, 2025 at 19:46 UTC
    Maybe we should have a discussion about site policy regarding AI content on PMD

    I thought it's obvious why this is not a good idea.

    FWIW it's strictly forbidden on SO

    https://stackoverflow.com/help/gen-ai-policy

    NB: the content you posted is obviously wrong, the code I posted demonstrates 64 bit output from F

    But before I spend my time correcting BS content from AI, I'd rather decide to retire from posting.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      OK, the explanation that I honestly didn't read properly was a by-product of the code generation, so to speak. The code wasn't wrong - it output the same as your one liner. Unfortunately, I then added the explanation somewhat prematurely and only explicitly named the "source" when you asked. I already said that I thought that was clear from the context. I have no intention of passing off AI-generated content as my work - that should be clear. A completely different question is whether the generated content is really one hundred percent wrong. But I think we'd better leave that alone.

      Best regards, Karl

        I'd really appreciate if you edit your post to clarify that it's AI generated and (totally) wrong.

        > A completely different question is whether the generated content is really one hundred percent wrong.

        Obviously the output for F contradicts what I showed and I already explained why.

        > But I think we'd better leave that alone.

        Sorry, no can do! It's too important.

        While I enjoy seeing AI generated code, it should always be flagged and corrected.

        (FWIW I also asked ChatGPT and it agreed 😜)

        Otherwise AI content is much more dangerous for a board than spam is.

        Spam I can at least ignore, AI content "looks" too legit to be easily discarded and will eat up my brain power to be validated and keep me busy.

        This is the equivalent of a cerebral DOS attack.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

        A completely different question is whether the generated content is really one hundred percent wrong.

        The readers can judge for themselves if your post with the incorrect bits removed tells them the difference between d and F.

        Perl `pack` Template Comparison: "d" vs "F" =========================================== Summary Table ------------- | Template | Type | Precision | Bits | Description + | |----------|--------|--------------|------|--------------------------- +---------| | "d" | double | XXXXXXXXXXXX | XX | XXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXX | | "F" | XXXXXX | XXXXXXXXXXXX | XX | XXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXX | Example Code ------------ use feature 'say'; my $x = 1/3; say "Xouble:"; say unpack("BXX", pack("d>", $x)); # Big-endian XXXXXX say "XXXXX:"; say unpack("BXX", pack("F>", $x)); # Big-endian XXXXX Difference Illustration ----------------------- my $x = 1/3; my $XXXXX_bin = unpack "BXX", pack "F>", $x; my $double_bin = unpack "BXX", pack "d>", $x; printf " XXXXX (XX-bit): %s\n", $XXXXX_bin; printf "Xouble (XX-bit): %s\n", $double_bin; Expected Output: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXX IEEE 754 Format Summary ----------------------- | Precision | Sign | Exponent | Mantissa (Significand) | Bias | |-----------|------|----------|-------------------------|------| | XXXXX | 1 bit | 8 bits | 23 bits | 127 | | Double | 1 bit | 11 bits | 52 bits | 1023 | Usage Notes ----------- - Use "d" / "d>" if you want: - XXXXXXXXXXXXXXXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - Direct compatibility with XXXXXXXXXXXXXXXXXXXXXXXX - Use "F" / "F>" if you want: - XXXXXXXXXXXXXXXXXXX - Exact compatibility with XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Endianness Reminder ------------------- - d> and F> -> big-endian - d< and F< -> little-endian - d and F (no angle) -> native-endian (machine dependent)

        (Formatting errors left in. Only substantive errors were removed.)