Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3623918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:26:34+00:00 2026-05-18T23:26:34+00:00

At the bottom of Kernel#sprintf ‘s documentation it has this example: sprintf(%u, -123) #=>

  • 0

At the bottom of Kernel#sprintf‘s documentation it has this example:

sprintf("%u", -123) #=> "..4294967173"

When I do this on 1.8.7 I get this result:

"..18446744073709551493"

That’s similar to the expected output, but is definitely not it.

When I do it on 1.9.2 however, I get the same number back as a string:

ruby-1.9.2-p136 :001 > sprintf("%u", -123)
 => "-123"

So there’s actually two questions here.

  1. Why would I be getting a different output to what the documentation says I would and

  2. Why would Ruby 1.9.2 behave differently to 1.8.7, even when the documentation is quite specific about the output type?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:26:34+00:00Added an answer on May 18, 2026 at 11:26 pm

    The 1.8 documentation says that %u is for a 32-bit unsigned integer, and you’re seeing it on a 64-bit unsigned integer, so that behavior is off. The 1.9 documentation says that %u is the same as %d, so that behavior is correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Notice in the bottom right hand corner of this page it has the SVN
Edit at bottom with solution I've seen a similar question to this posted before
Looking at the bottom of this page it would appear that it is possible
This intent at the bottom of the page simply says that it is unable
Fixed: See notes at bottom I am implementing a generic class that supports two
Reading the bottom of the documentation, specifically: You can still retrieve properties of deleted
Update: See the bottom of this question for a C# workaround. Hi there, Consider
EDIT: ANSWER AT BOTTOM OF THIS QUESTION Okay so I've got some generic EF
I have a bottom toolbar like this: <div style=float:left;width:100%;position:fixed;z-index:210;bottom:5px;> <div style=float:left;width:928px;border:1px solid #000;background:url('/images/noise-bg.jpg') repeat-x;height:26px;padding:5px;>
Solved: Look at the bottom of this question for the working configuration I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.