Category : numbers

to practice C++ i decided to write a modulo function. but it returns -nan(ind) how can i make it that the return is the rest of the division? #include <iostream> #include "Header.h" double modulo(double number1, double number2) { double intermediate_result_1=5; double result; int counter = 0; while (intermediate_result_1 < number1) { counter++; intermediate_result_1 = number2 ..

Read more

I’m trying to implement a combined linear congruential generator (CLCG) on myself for a school-project. Whereas i did implement successfully a single LCG, i do not understand what is the problem in combining them. Single LCG: #include<iostream> #include<climits> #include<cmath> #include<ctime> #include<fstream> // See: https://en.wikipedia.org/wiki/Linear_congruential_generator#LCG_derivatives //Numerical Recipes Parameters #define A 1664525 #define C 1013904223 #define POW232 ..

Read more