Errors with large numbes while using Doubles

Discussion in 'Plugin Development' started by BitBoxGaming, Dec 21, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    BitBoxGaming

    I am working on a plugin for my server where there are two types of economy.
    I am currently storing all the money and coupons as doubles, however if the player has too much money, then when they execute the command, /bal if their balance is more than 1 million, it starts saying 1.0E7 for 10 million 1.0E8 for 100 million.

    Is there any way to stop this, perhaps use a different variable type?
     
  2. Offline

    BitBoxGaming

    @DJSkepter

    Thanks very much! I'll now go through the laborious process of converting all Doubles to BigDecimals :)

    @DJSkepter

    The issue I am having is that because there is no config.getBigDecimal("Money"), I get the double, and then I use BigDecimal.valueOf(config.getBigDecimal("Money")) however that just gives me the E's because I went through a double.

    Not sure what to do :/

    <Edited by bwfcwalshy: Merged posts, please use the edit button rather than double posting.>
     
    Last edited by a moderator: Dec 21, 2014
  3. Offline

    BitBoxGaming

    @Assist

    If I did that, when I have to do maths operators such as + it wouldn't work due to it being a string.
     
  4. Offline

    CraftCreeper6

  5. Offline

    BitBoxGaming

  6. Offline

    CraftCreeper6

  7. Offline

    BitBoxGaming

    Last edited: Dec 21, 2014
Thread Status:
Not open for further replies.

Share This Page