Answered Algorithm formula

N3wN00l3_vb.net

New member
Joined
Oct 21, 2020
Messages
1
Programming Experience
Beginner
Hello,

I am in the process of making a small program to calculate the number ready on the mining.
Yes, there are several sites that do... But, there is so much currency that the sites cannot list them all.
I have the algorithm formula but in my program it gives me a 0.
  • H = Hashrate (hashes / second)​
  • D = Difficulty (Reference for values below)​
  • B = Reward per Block (Reference for value below)​
  • N = Number of days per month (default = 30)​
  • S = Number of seconds per day (S = 60 * 60 * 24 = 86400)​

aqxbm.png

Button1:
Function AlgoM(ByVal Days As Int32, ByVal Reward As Int32, ByVal Hsahrate As Int32) As Int32
        Dim Cout As Int32
        Cout = FormatNumber((30 * NumericUpDown4.Value * NumericUpDown1.Value * 86400) / (NumericUpDown6.Value * 2 ^ 32))
        Return Cout
    End Function

Button1:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Label18.Text = AlgoM(Me.NumericUpDown4.Value, Me.NumericUpDown1.Value, Me.NumericUpDown6.Value)
    End Sub

Thank you in advance :)
 
Break the calculation up into individual steps and perform one step per line of code. You can then use the debugger to step through the code line by line and see exactly where the result of a step is not what you expect. You ALWAYS need to debug for yourself first. Even if you still can't work out a solution, at least you can provide us with far more relevant information.
 
Also, you really should be providing meaningful names for all your controls. Having 18 Labels distinguished only by number and 6 NumericUpDowns the same is bad. How are we supposed to know whether you have the right controls in the right place in the calculation if the names are meaningless? Anyone not completely familiar with the project (that includes you when you come back it some time later) should be able to know what control is for what in the code without having to examine the UI and/or guess.
 
Actually, I also just realised that your AlgoM method has parameters but you completely ignore them inside the method. What's the point of passing in the values and then getting them from the controls again?
 
Back
Top