• 2 Posts
  • 109 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle















  • I agree with all that. But I’m talking about exact integer values as mentioned in the parent.

    I just think this has to be true: count(exact integers that can be represented by a N bit floating point variable) < count(exact integers that can be represented by an N bit int type variable)



  • karlthemailmantoProgrammer Humor@programming.devJava
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I don’t think that’s possible. Representing more exact ints means representing larger ints and vice versa. I’m ignoring signed vs. unsigned here as in theory both the double and int/long can be signed or unsigned.

    Edit: ok, I take this back. I guess you can represent larger values as long as you are ok that they will be estimates. Ie, double of N (for some very large N) will equal double of N + 1.


  • karlthemailmantoProgrammer Humor@programming.devJava
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    1 year ago

    No, I get that. I’m sure the programming language design people know what they are doing. I just can’t grasp how a double (which has to use at least 1 bit to represent whether or not there is a fractional component) can possibly store more exact integer vales than an integer type of the same length (same number of bits).

    It just seems to violate some law of information theory to my novice mind.