GCD approximation for type double numbers

  • Thread starter teleport
  • Start date
  • #1
240
0
Hi, I am doing a phys experiment, and I find myself trying to obtain some pattern of quantization of some measurements, i.e., I'm trying to find a number (double) that divides at least a significant portion of my data, with an arbitrary remainder. Does anyone know of any algorithm that does this for type double numbers? I really need your help on this one. Thanks a lot.
 

Answers and Replies

  • #2
CRGreathouse
Science Advisor
Homework Helper
2,820
0
Code:
double mod(double n, double m) {
	if (n < 0)
		n = -n;
	if (m < 0)
		m = -m;
	int tmp = (int)(n / m);

	return n - tmp * m;
}
 

Related Threads on GCD approximation for type double numbers

  • Last Post
Replies
5
Views
11K
Replies
28
Views
2K
  • Last Post
Replies
4
Views
16K
  • Last Post
Replies
4
Views
5K
Replies
2
Views
1K
Replies
10
Views
4K
Replies
8
Views
3K
Replies
9
Views
2K
Top