Thread: How can i get better range?

  1. #1
    Registered User
    Join Date
    Dec 2018
    Posts
    4

    How can i get better range?

    Hi, i have written a code that take a decimal number and convert it to binary number.
    for example 14 = 1110
    The problem is that i store the number in double and when i put a number bigger than this i don't have enough bits.
    How can i contain a longer number in a variable? (1001010101010101111 for example)
    Thanks!

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    If you want more than 64 bits, you'll have to use some arbitrary-length maths library, or create your own extended type.

    I have the suspicion though that you save that "binary number" as a decimal... I suggest you generate a string instead.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Range of Values
    By devilsknight in forum C Programming
    Replies: 1
    Last Post: 06-03-2006, 03:16 PM
  2. range?
    By tu_user in forum C++ Programming
    Replies: 13
    Last Post: 01-19-2004, 11:35 PM
  3. Range
    By volk in forum C Programming
    Replies: 3
    Last Post: 12-19-2002, 09:43 AM
  4. Range
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 05-23-2002, 10:52 AM

Tags for this Thread