GCD approximation for type double numbers

Click For Summary
SUMMARY

The discussion focuses on finding a GCD approximation algorithm for double precision floating-point numbers in a physics experiment context. The user seeks a method to identify a number that can divide a significant portion of their data with an arbitrary remainder. A provided code snippet illustrates a custom modulus function for double types, which can be utilized to compute the remainder of division between two double values.

PREREQUISITES
  • Understanding of double precision floating-point representation
  • Familiarity with basic algorithm design
  • Knowledge of modulus operations in programming
  • Experience with numerical methods in scientific computing
NEXT STEPS
  • Research algorithms for GCD approximation in floating-point arithmetic
  • Explore numerical stability techniques for double precision calculations
  • Learn about the implications of floating-point precision on scientific measurements
  • Investigate existing libraries for numerical methods in languages like Python or C++
USEFUL FOR

Researchers, physicists, and software developers involved in scientific computing or data analysis who need to work with double precision numbers and seek efficient algorithms for numerical approximations.

teleport
Messages
240
Reaction score
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.
 
Technology news on Phys.org
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;
}
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
Replies
19
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
2
Views
1K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K