I need to find the highest number from 3 different numbers. The only thing I've found is max() but you can only use 2 numbers.
Whats the best way?
|
How can I round down a number in Javascript?
math.round() doesn't work because it rounds it to the nearest decimal.
I'm not sure if there is a better way of doing it ... |
I have a function to round a number given to the function to the nearest whole pence.
<script type='text/javascript'>
Math.roundNumber = function(a,b){
if(!isNaN(parseInt(a))){
c = Math.pow(10,b);
...
|
I have a simple, but perplexing problem, with Math.
The following code will take a number from a string (usually contained in a span or div) and subtract the value of 1 ... |
If I have a string '1+1' is there a way, other than eval(string) to get the numerical value of it i.e. I want to turn '1+1' into 2.
|
How do I calculate a curve of a linear floating point number (0 to 1) and get another floating point number as a result? What I want is up until the ... |
Have I missed a standard API call that removes trailing insignificant zeros from a number?
Ex.
var x = 1.234000 // to become 1.234;
var y = 1.234001; // stays 1.234001
Number.toFixed() and Number.toPrecision() are ... |
|
I need to find the most optimal combination of coins that makes up a certain dollar amount. So essentially, I want to use the least amount of coins to get ... |
Anyone knows such a function in javascript?
|
I am wondering how in javascript if i was given a number (say 10000) and then was given a percentage (say 35.8%)
how would I work out how much that is (eg ... |
Is this correct? using - http://en.wikipedia.org/wiki/Binomial_probability
Looks like values are from .0000000000000000 to .9999999999999999
Probability of happening twice = p^2 = (1/9999999999999999)^2 = 1.0 e-32
I think I am missing ... |
I know that I can round a number like this
var number = 1.3;
Math.round(number);
and the result I'm given is 1.
But how can I round a number to the next highest whole number? ... |
Lets say I have this data set...
var a = [5,6,7];
var b = [9,8,6];
Imagine that those values were plotted the y in a (x,y) coordinate pair, and the x was the array ... |
Good afternoon,
I have an Array of integers in javascript, [5,10,15,20,25,30,35]
when given a number x, how can I find the element in the array that is closest to that number? If the ... |
So a friend of mine had an interesting homework assignment. Her task was to create a diamond based on user input. Sample diamond based on input of (5) is:
************
***** ...
|
I'm looking to create a random number between two ranges that is a multiple of 10.
For example, if I fed the function the parameters 0, 100 it would return one of ... |
I have extended javascripts core functionality by creating a few functions that were useful to me. When creating test cases for a function today I started wondering which way is the ... |
I honestly can't think of what to search for, but what I've tried hasn't yielded any results, so I apologize if it's been asked already.
This is also more of a math ... |
I was looking at this because I'm trying to make a fifteen puzzle solver. I don't really understand what it's talking about. How would I go about checking if ... |
I understand that you can create a random number via javascript with:
Math.floor(Math.random()*100);
the problem is i would like the numbers to go up in twenties, so like if it was a number ... |
So, I'm trying to draw an HTML table as close to being a square as possible from a value passed in. For example, if the number passed in is 16, then ... |
I'm trying to get the nth root of a number using JavaScript, but I don't see a way to do it using the built in Math object. Am I overlooking something?
If ... |
Okay....
I have a lot of uncontrolled numbers i want to round:
51255 -> 55000
25 -> 25
9214 -> 9500
13135 -> 15000
25123 -> 30000
I have tried modifying the numbers as string and counting length....
But ... |
I'm attempting to perform the following calculation in Javascript:
e^x / (1 + e^x)
where x is a long floating point number.
In this instance, I require accuracy to at least the 10th decimal ... |
I'm trying to get numbers to be multiples of 150.
(all the num > 0)
if num = 0.333333 => output 150
if num = 149.9 => output 150
if num = 150 => output ...
|
Hi I am trying to solve a math problem where I take a number e.g. 45, or 111 and then split the number into separate digits e.g. 4 5 or 1 ... |
in javascript, lets say I got a random number 136, i'd like it to convert it automatically to 140 or if I got 124 to 120 etc or 24 to 20 ... |
I couldn't find this question here although it seems simple.
lets say that I want to calculate the percentage of an overall distance when i know the start and end positions ie:
function ...
|
The problem is that I have array with 5 numbers:
300 295 250 105 100 95
The result needed: the most numbers that have ... |
|