Math.round (), How to with a random number?

Tech-Xcellent

Similar to my other issue with Auto-Calculation, when I use the mobile app I need round number's only and nothing else. In saying that, at the moment I get 1.05 instead of 1 using the code below and Math.ciel(), I really need it to round to the nearest whole number with absolute no decimal places.

var rc1FrontMM = Number(Apperyio("rc1FrontMM").val());
var rc1RearMM = Number(Apperyio("rc1RearMM").val());
var rc1TyreRatio1 = Number(Apperyio("rc1TyreRatio1").val());
var rc1TyreRatio2 = Number(Apperyio("rc1TyreRatio2").val());

var rc1TyreRatio1 = (rc1RearMM / rc1FrontMM).Math.ceil(num * 100)/100;
var rc1TyreRatio2 = (rc1RearMM / rc1FrontMM).Math.ceil(num * 100)/100;

Apperyio('rc1TyreRatio1').val(rc1TyreRatio1.Math.ceil(num * 100)/100);
Apperyio('rc1TyreRatio2').val(rc1TyreRatio2.Math.ceil(num * 100)/100);

console.log(rc1TyreRatio1 = (rc1RearMM / rc1FrontMM).Math.ceil(num * 100)/100);
console.log(rc1TyreRatio2 = (rc1RearMM / rc1FrontMM).Math.ceil(num * 100)/100);

So far, it seems to work beautifully except I still get decimal's without rounding to the nearest whole number.

Advice?

Edit: 3:20pm 17/6/16 AEST Using Javascript only due to limitations of Appery.io platform (as explained prior, this wasn't my first choice, it was the client's choice).

Subjective Effect

Why don't you use the toFixed(x) method? It'll round down or up to the nearest integer if you use x = 0.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to make Math.random round to a number

From Dev

JavaFX how to Math.round a bind number?

From Dev

How to use Math.round to round numbers to the nearest EVEN number?

From Dev

How to use Math.round to round numbers to the nearest EVEN number?

From Dev

How to Print Random number in a Math Table?

From Dev

Math.round: round number by conditions

From Dev

VB.NET How to use the Math.Round() function to round the percentage to a whole number

From Dev

How to make a random number math quiz with 10 questions in C++?

From Dev

Math.random number of random bits

From Dev

Math.random number of random bits

From Dev

Math.round gives a decimal number in android

From Dev

Math round function with variable number of digits

From Dev

Math.Round number with 3 decimal

From Dev

Why Math.random() type is number and Math.random is function?

From Dev

How do you generate a random number with equal probability using Math.random() in Java

From Dev

How do you generate a random number with equal probability using Math.random() in Java

From Dev

how to round a number in ocaml?

From Dev

how to round a number in kotlin

From Dev

How to round a decimal number?

From Java

Is 161803398 A 'Special' Number? Inside of Math.Random()

From Dev

Selecting a number randomly with math.random()

From Dev

Selecting a number randomly with math.random()

From Dev

Math.random() Generates same number

From Dev

Java Math.random() How random is it?

From Dev

How to round my values with Math.ceil()?

From Dev

How to round double in swift to 2 places with math round

From Dev

Why Java's Math.round() cannot handle this number?

From Dev

Why Java's Math.round() cannot handle this number?

From Dev

How does the distribution of Math.random()*50 + Math.random()*20 compare to Math.random()*70?

Related Related

  1. 1

    how to make Math.random round to a number

  2. 2

    JavaFX how to Math.round a bind number?

  3. 3

    How to use Math.round to round numbers to the nearest EVEN number?

  4. 4

    How to use Math.round to round numbers to the nearest EVEN number?

  5. 5

    How to Print Random number in a Math Table?

  6. 6

    Math.round: round number by conditions

  7. 7

    VB.NET How to use the Math.Round() function to round the percentage to a whole number

  8. 8

    How to make a random number math quiz with 10 questions in C++?

  9. 9

    Math.random number of random bits

  10. 10

    Math.random number of random bits

  11. 11

    Math.round gives a decimal number in android

  12. 12

    Math round function with variable number of digits

  13. 13

    Math.Round number with 3 decimal

  14. 14

    Why Math.random() type is number and Math.random is function?

  15. 15

    How do you generate a random number with equal probability using Math.random() in Java

  16. 16

    How do you generate a random number with equal probability using Math.random() in Java

  17. 17

    how to round a number in ocaml?

  18. 18

    how to round a number in kotlin

  19. 19

    How to round a decimal number?

  20. 20

    Is 161803398 A 'Special' Number? Inside of Math.Random()

  21. 21

    Selecting a number randomly with math.random()

  22. 22

    Selecting a number randomly with math.random()

  23. 23

    Math.random() Generates same number

  24. 24

    Java Math.random() How random is it?

  25. 25

    How to round my values with Math.ceil()?

  26. 26

    How to round double in swift to 2 places with math round

  27. 27

    Why Java's Math.round() cannot handle this number?

  28. 28

    Why Java's Math.round() cannot handle this number?

  29. 29

    How does the distribution of Math.random()*50 + Math.random()*20 compare to Math.random()*70?

HotTag

Archive