Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-4-20250514· AnthropicHugging Face LMArena Human Preference 140K

Find the shortest string (in character count) that overflows a conversion to…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-flash’s answer.
  1. User

    Find the shortest string (in character count) that overflows a conversion to double-precision floating point. Find the shortest string that underflows a conversion to double-precision floating point. Finally, find the shortest string that converts exactly to a double-precision number, and find the shortest string that converts inexactly. Give a summary at the end!

  2. Claude Assistant

    I'll work through each case systematically to find the shortest strings for double-precision floating point conversions.

    Overflow (shortest string that becomes infinity)

    For overflow, I need a number larger than the maximum finite double (~1.798e308). The shortest representation would be:

    • 2e308 (5 characters) - this overflows to positive infinity
    • -2e308 (6 characters) - this overflows to negative infinity

    So 2e308 at 5 characters is the shortest overflow string.

    Underflow (shortest string that becomes zero)

    For underflow, I need a number smaller in magnitude than the minimum subnormal double (~4.941e-324). The shortest would be:

    • 1e-324 (7 characters) - this underflows to zero
    • -1e-324 (8 characters) - this underflows to negative zero

    So 1e-324 at 7 characters is the shortest underflow string.

    Exact conversion (shortest string with exact representation)

    Many simple numbers convert exactly. The shortest exact conversions are single digits:

    • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (1 character each)

    So 0 (or any single digit) at 1 character is the shortest exact conversion.

    Inexact conversion (shortest string requiring rounding)

    For inexact conversion, I need a decimal that can't be represented exactly in binary floating point. The shortest would be:

    • 0.1 (3 characters) - cannot be represented exactly in binary
    • 0.2 (3 characters) - also inexact
    • 0.3 (3 characters) - also inexact

    So 0.1 at 3 characters is the shortest inexact conversion.

    Summary

    • Shortest overflow: 2e308 (5 characters) → +∞
    • Shortest underflow: 1e-324 (7 characters) → 0
    • Shortest exact: 0 (1 character) → 0.0 exactly
    • Shortest inexact: 0.1 (3 characters) → approximately 0.1000000000000000055511151231257827021181583404541015625

    The exact conversion wins for brevity at just 1 character, while underflow requires the most characters due to the extreme exponent needed.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.