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 926691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:43:32+00:00 2026-05-15T19:43:32+00:00

I have a script that generates some numbers (specifically times in epoch form). Everytime

  • 0

I have a script that generates some numbers (specifically times in epoch form).

Everytime it generates a number, I append the number to an array (called VALUES) and print both the array and that number. However, the number does not contain as many places after the decimal as the number in the array.

For example, a sample output will look like this (after 3 iterations):

VALUES = [733948.45278935181, 733948.45280092594, 733948.45280092594]
Number = 733948.452801

The third number in the array corresponds to the value in Number.

How come they contain different number of positions after the decimal?

Off-topic: What are the numbers after the decimal called? I thought there was some mathematical term for them I just can’t remember what it is.

Note: Code was in python.

  • 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-15T19:43:33+00:00Added an answer on May 15, 2026 at 7:43 pm

    When python prints out a number, it sometimes prints out more decimal places based on whether the internal method is calling repr or str (which both convert the number to a string). repr will return more decimal places, while str does not.

    print calls str, so when you do print Number, it will trim it a tad. However, when you convert a list of numbers to a string when you do print VALUES, the list will internally use repr, giving it more decimal places.

    In summary, depending on how it is being printed out, you will see different amounts of decimal places. However, internally, it is still the same number.

    If you want to force it to use a specific number of decimal places, you can do this:

    print "%.3f" % 3.1415   # prints 3.142
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a perl script which when run from the command line generates a
I currently have a network camera that streams video as a .swf (and also
I have some javascript which will create some sort of widget on a page.
I have an application where many unit tests use a real connection to an
I would like to call a Ruby script when a user uploads an image
in my unit test framework, for some of the messages ( which are simply
I'm struggling to figure out how to re-index (?) a series of hidden fields
I am reviewing / redesigning / refactoring a database and want to create a
Here is what I figured so far: To get content of the spreadsheet od6
I'm having a really difficult time understanding how this all works together. I've fiddled

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.