Top "Math" questions

Math involves the manipulation of numbers within a program.

How to force JS to do math instead of putting two strings together

I need javascript to add 5 to an integer variable, but instead it treats the variable as a string, so it …

javascript string math addition
I want to calculate the distance between two points in Java

OK, so I've written most of a program that will allow me to determine if two circles overlap. I have …

java math distance
How do I calculate a trendline for a graph?

Google is not being my friend - it's been a long time since my stats class in college...I need …

c# math graph
milliseconds to days

i did some research, but still can't find how to get the days... Here is what I got: int seconds = (…

java math time milliseconds
How do I round to the nearest 0.5?

I have to display ratings and for that i need increments as follows: If the number is 1.0 it should be …

c# math function
How does java do modulus calculations with negative numbers?

Am I doing modulus wrong? Because in Java -13 % 64 is supposed to evaluate to -13 but I get 51.

java math modulo negative-number
Changing the sign of a number in PHP?

I have a few floats: -4.50 +6.25 -8.00 -1.75 How can I change all these to negative floats so they become: …

php math numbers sign
How can I check if two segments intersect?

How can I check if 2 segments intersect? I've the following data: Segment1 [ {x1,y1}, {x2,y2} ] Segment2 [ {x1,y1}, {x2,…

python math geometry
How do I determine whether my calculation of pi is accurate?

I was trying various methods to implement a program that gives the digits of pi sequentially. I tried the Taylor …

algorithm math language-agnostic pi
Round float to x decimals?

Is there a way to round a python float to x decimals? For example: >>> x = roundfloat(66.66666666666, 4) 66.6667 >&…

python math rounding