0
votes
0answers
19 views

Trying to get variable to display as whole number

Trying to get the variable "totalreq" to display as a whole number. I've tried a number of examples of math floor math round etc. At this point it breaks if i even remove the toFixed(2) that I added. ...
-1
votes
0answers
28 views

Correlate two dimension array with array of weights

I'm stuck at coping some code. It has to correlate input array with array of weights. But becouse I'm quite faraway from Math it's quite unpleasant for me. var input = [ [1, 0, 1, 1, 1], ...
0
votes
1answer
64 views

HTML5 Canvas - What's the simplest way to draw a line that gets thicker and thicker to the end?

What's the simplest way to draw a line that gets thicker and thicker to the end? Like this: And this is for a clock project so I want the line x and y points not to be constant, I mean that the ...
0
votes
4answers
25 views

in javascript is it possible to assign a arithmetic operand to a variable?

I know I can simply use an if else statement to have the math done for me, and could even create a function that could be called either way depending on the need, but I am trying to based on math ...
0
votes
1answer
112 views

How do I make a function f(x) = y out of a 2d path?

I have a 2d path defined on a single variable: var point = path(t); // --> [0.113, 0.883] Iterating over t from 0 to 1 I can enumerate the entire path and then graph the successive pairs [x,y]. ...
2
votes
2answers
41 views

Using points to generate quadratic equation to interpolate data

I'm trying to come up with a flexible decaying score system for a game using quadratic curves. I could probably brute force my way through it but was wondering if anyone can help me come up with ...
-1
votes
1answer
32 views

JS: Carmichael number [closed]

I wrote a small carmichael algorithm but it return than 561 isn't a carmichael number. You can see a working demo of the algorithm here: dam.io/mt10 function carmichaelTest(n) { ...
15
votes
6answers
345 views

Better random function in JavaScript

I'm currently making a Conway's Game of Life reproduction in JavaScript and I've noticed that the function Math.random() is always returning a certain pattern. Here's a sample of a randomized result ...
1
vote
3answers
78 views

JavaScript Math.floor: how guarantee number will round down?

I want to normalize an array so that each value is in [0-1) .. i.e. the max will never be one but the min can be 0. This is not unlike the random function returning numbers in the same range. While ...
1
vote
0answers
48 views

Strange Subtraction in Chrome [duplicate]

Using Chrome Version 27.0.1453.93, I found something very strange that I can not understand : Launch your console and directly enter 95.1-80 For me the answer should be 15.1 For Chrome ...
0
votes
4answers
106 views

Javascript increment a value

I have tried and failed trying to get this to work so time to ask the experts. I've got the following HTML: <input type="button" value="-" class="minus"> <input type="number" value="20" ...
0
votes
3answers
35 views

Simple arithmatic error javascript

When I do the following operation : var score = (0.229*5) / + (0.237*5) / + (0.265*5) / + (0.214*5) / + (0.055*5); Score evaluates to ...
1
vote
1answer
47 views

Get x,y coord of a div when rotation is 0

Hi I need some help with math for my problem. I have a situation where I need to access the left,top coord of a div whenever a touchstart event is fired. But I need to get it based on the rotation of ...
0
votes
2answers
53 views

Understanding function

I am having trouble understanding a function hopefully someone can help me out here. I am trying to find the pitch diameter of a sprocket the function for this in JavaScript is: function ...
-1
votes
2answers
80 views

How can i include in a javascript more than one input?

I am trying to do more than one javascript math function , i put two inputs , the first makes the own calculate and the result of the first , be part of the second calculate . For example: HTML ...

1 2 3 4 5 64
15 30 50 per page