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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:36:51+00:00 2026-06-14T22:36:51+00:00

I have a method that expects a double, and I want to store the

  • 0

I have a method that expects a double, and I want to store the UTC time and my variable that I am passing to this method is a long.

I am using:

Date now = new Date();
now.getTime() 

to get the UTC time.

Can this value not fit into a double?

  • 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-06-14T22:36:52+00:00Added an answer on June 14, 2026 at 10:36 pm

    It will “fit”, in the sense that double can represent any long value, but there would be a loss of precision for dates far in the distant future (100,000’s of years from now).

    The IEEE 754 spec, which double uses, uses up to only 53 bits for the non-exponent part of the number. Since long is 64 bits, roughly speaking you’ll potentially lose precision if the long value exceeds 53 bits.

    However, 53 bits can accurately represent the current epoch millisecond time long value, which requires only 41 bits.

    A loss of precision will not occur until the epoch time exceeds 253, which won’t occur until Oct 12 287396.

    Even at the worst case, 11 bits of “inaccuracy” would still translate to a time value with an accuracy of about ±1 second (2 ^ 11 = 2048, which in milliseconds is a range of 2 seconds).

    In short, converting an epoch time to double is OK.

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

Sidebar

Related Questions

I have a method that I want to test which expects an IEnumerable<T> as
I have a method that expects a Set parameter. I want to pass in
I have this situation: A method that expects a Type as one of its
I have a WCF service method that expects an object and then retrieves its
I have an annotated controller with a method that expects a model and a
I have a data type that contains a set and a method that expects
I have a method that prints private variable of the class. public class Test
I have a python method that returns a Python byte array.array('c'). Now, I want
I have a method that expects an Action<string> I call the method as follows:
For example, I want to have a method that, depending on the first argument

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.