1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Weave light to take you to your highest hopes - the 6th Special Effect Contest is here!
    Dismiss Notice
  4. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Very small values

Discussion in 'World Editor Help Zone' started by nyks078, Nov 23, 2011.

  1. nyks078

    nyks078

    Joined:
    Oct 28, 2011
    Messages:
    23
    Resources:
    0
    Resources:
    0
    Uh, just curious.. How small can wc3 engine hold reals without rounding off??

    I need to use EXCACT values such as 0.01190476(hundred millionth) and i don't mind if I need to use triggers just to obtain these values.
     
  2. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    You probably need to use JASS because GUI rounds off to 0.01.
     
  3. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,977
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    0.0001 I think. Reals in WC3 are a combination of some decimal part (eithor fixed point or float) with a 32 bit integer for whole numbers.

    I advise you store the number in a multiplied form (like 1190476 which is it multiplied by 10^8). You obviously adjust your formula to compensate for this.
     
  4. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,893
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    If you need it for some very very low chances of something I suggest integers instead of reals.

    To get value like 10% you can:
    get random int from 1 to 100 < 10

    values 1%
    get random int from 1 to 1000 < 10


    values 0.0001%
    get random int from 1 to 1000000 < 10
     
  5. nyks078

    nyks078

    Joined:
    Oct 28, 2011
    Messages:
    23
    Resources:
    0
    Resources:
    0
    thanks.. solved it =D