Top "Math" questions

Math involves the manipulation of numbers within a program.

How can I check for NaN values?

float('nan') results in Nan (not a number). But how do I check for it? Should be very easy, but …

python math
Math.random() explanation

This is a pretty simple Java (though probably applicable to all programming) question: Math.random() returns a number between zero …

java math
Calculate distance between two latitude-longitude points? (Haversine formula)

How do I calculate the distance between two points specified by latitude and longitude? For clarification, I'd like the distance …

algorithm math maps latitude-longitude haversine
Integer division with remainder in JavaScript?

In JavaScript, how do I get: The whole number of times a given integer goes into another? The remainder?

javascript math modulo integer-division
Safest way to convert float to integer in python?

Python's math module contain handy functions like floor & ceil. These functions take a floating point number and return the …

python math integer python-2.x
JavaScript math, round to two decimal places

I have the following JavaScript syntax: var discount = Math.round(100 - (price / listprice) * 100); This rounds up to the whole number. …

javascript math
Calculating arithmetic mean (one type of average) in Python

Is there a built-in or standard library method in Python to calculate the arithmetic mean (one type of average) of …

python math statistics average mean
What is the difference between '/' and '//' when used for division?

Is there a benefit to using one over the other? In Python 2, they both seem to return the same results: &…

python math syntax operators floor-division
What do these operators mean (** , ^ , %, //)?

Other than the standard +, -, *and / operators; but what does these mean (** , ^ , %, //) ? >>> 9+float(2) # addition 11.0 >>> 9…

python math operators native
What is the C++ function to raise a number to a power?

How do I raise a number to a power? 2^1 2^2 2^3 etc...

c++ math