How to round down / round up a number based on my own rounding off criteria?

  • Profile Image
    Abrisud
    Asked on February 03, 2017 at 05:45 AM

    Bonjour,

    j'aimerais savoir comment faire pour arrondir un nombre a : 0,1

    1 EXEMPLE :

    si ma valeur est 4,02

    arrondir a = 4

    2 EXEMPLE :

    par contre si ma valeur est 4,12

    arrondir à = 5

     

    Si ma valeur dépasse 0,1 arrondir au dessus

    sinon arrondir a la valeur du bas toujours avec un chiffre rond

     

    MERCI pour votre aide

  • Profile Image
    Jim_R
    Answered on February 03, 2017 at 06:25 AM

    Keep in mind, rounding off doesn't work this way. The threshold is at .5 (anything lower than .5 will be round down and anything higher than .5 will be rounded up)

    I checked your previous threads and found this https://www.jotform.com/answers/1048360 And that's how the normal Round Off function works.

    However, did you mean you wanted to round down anything that's below .1 then round up anything above it?

    e.g.

    4.01, 4.02, 4.09 = 4

    4.10, 4.12, 4.19 = 5

    Is that what you mean?

     

    In case you really want it to work like how I described it above, then you can probably achieve this by using Conditions. Have a look at this demo form I came up with: https://form.jotform.com/70332412598960

    Anything that is below .1 will be rounded down. And anything above .1 will be rounded up. Clone the form (here's how), so you can have a closer look on the Conditions I set up.

    In case we misunderstood your question, just get back to us with a bit more info and a clearer description of what you're trying to do so we can better assist you.

  • Profile Image
    Abrisud
    Answered on February 03, 2017 at 11:54 AM

    Bonjour

    OUI c'est exactement ça que je veux, comment vous avez fait ???

    je dois utiliser round ?? C'est ce que j'ai fait

    Merci

  • Profile Image
    ashwin_d
    Answered on February 03, 2017 at 01:27 PM

    Hello,

    I did check my colleague's demo form and found that he has used "floor" function in the conditions to calculate and insert value in the textbox. Please check the screenshot below:

     

    I would suggest you to please clone my colleague's form and take a closer look at conditions which should help you.

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!