Top "Math" questions

Math involves the manipulation of numbers within a program.

Check if a number is a perfect square

How could I check if a number is a perfect square? Speed is of no concern, for now, just working.

python math perfect-square
Remove insignificant trailing zeros from a number?

Have I missed a standard API call that removes trailing insignificant zeros from a number? Ex. var x = 1.234000 // to become 1.234; …

javascript regex math numbers
How can I get a count of the total number of digits in a number?

How can I get a count of the total number of digits of a number in C#? For example, the …

c# math numbers
What are the most widely used C++ vector/matrix math/linear algebra libraries, and their cost and benefit tradeoffs?

It seems that many projects slowly come upon a need to do matrix math, and fall into the trap of …

c++ math matrix linear-algebra
syntaxerror: "unexpected character after line continuation character in python" math

I am having problems with this Python program I am creating to do maths, working out and so solutions but …

python math syntax continuation
Java rounding up to an int using Math.ceil

int total = (int) Math.ceil(157/32); Why does it still return 4? 157/32 = 4.90625, I need to round up, I've looked around and this …

java math
Mod in Java produces negative numbers

When I calculate int i = -1 % 2 I get -1 in Java. In Python, I get 1 as the result of -1 % 2. …

java math mod
Calculating a 2D Vector's Cross Product

From wikipedia: the cross product is a binary operation on two vectors in a three-dimensional Euclidean space that results in …

language-agnostic math vector 2d
How do I get a decimal value when using the division operator in Python?

For example, the standard division symbol '/' rounds to zero: >>> 4 / 100 0 However, I want it to return 0.04. …

python python-2.7 math syntax operators
Rounding integer division (instead of truncating)

I was curious to know how I can round a number to the nearest whole number. For instance, if I …

c math int rounding integer-division