Click here to Skip to main content
15,867,862 members

Comments by merano99 (Top 200 by date)

merano99 3 days ago View    
I did not see a download option for the compiled file, but I was able to create it without any significant effort. As I had already set up the WSL2, only three simple steps were necessary. Download with wget, unpack and call "do". If it helps I could provide the result.
Although I have not tested it with these files, Visual Studio can also be used to conveniently edit Linux-based programs remotely. But in the end, programs are created that are based on the Linux API.
merano99 4 days ago View    
Thank you very much! Unfortunately I have to withdraw my answer. Although the 4 jumps did not cause a crash for me, they require a presumably segmented solution.
merano99 5 days ago View    
It would probably be better if you discussed your problem based on your current source code, e.g. a link. Without knowing exactly how your data is currently displayed, but based on the requirement that it should be based on Win32, the article Custom Controls in Win32 API: Scrolling by Martin Mitáš would be a possible starting point. There is the "Advanced scrolling example".
merano99 22-Mar-24 18:15pm View    
In your proposed solution, you are already assuming that k is positive. The search starts asymmetrically at 0.
Usually, however, the solution is not known and I would read the (poorly implemented) approach of the questioner with the asymmetric loop in such a way that the solution could actually also be negative.
Your approach would also not find any negative solutions.

Another point is that the extremely frequent summation or subtraction in the floating point range can generate high errors.

Starting from a symmetrical loop with for ( i = -310000; i < 310000; i++) the result would be with your approach with k += kInc;
i = -10000
formula = 2.2370993946196904e-12
k = 3.0000000000111862


If you do not add up, but multiply by the loop index, the result looks like this with k = i*kInc:
i = 300001
formula = 0.0000000000000000
k = 3.0000000000000004

Please bear in mind that my proposed solution covers a much larger area, which would have led to the following result with your solution:
i = 300000
formula	= 4.6054271507500744e-12
k = 3.0000000000230274
merano99 22-Mar-24 14:33pm View    
Since the questioner knows that the result 3.0 is correct, he should have told us his constants and the start value.
I have thought about why the loop starts at -10000 and come to the conclusion that it is better to calculate k with the loop index i. k = offset + k_step*i
If you were to add Rick's and my solutions to your approach, you would have to check (fabs(formula) > epsilon), calculate k with the loop index and, as you correctly described, increase the range of the loop to such an extent that the supposedly correct result 3.0 has a chance.
I'll wait and see if my comment has any effect on your suggestion before voting.