In the attached program we are attempting to use monetary reward as feedback. After the initial set of trials, ProbeProc, the feedback then on each trial attempts to either add $0.01 (1 cent) or subtract $0.01 (1 cent) based on the accuracy of the response. In the BlockProc the EvalResp code should be performing this function.
If ProbeDisplay.RESP = "1" Then
c.setAttrib "ErrorCode", 0
Tcorr = Tcorr + 1
Tpoint = Tpoint + 0.01
c.setAttrib "ErrorCode", 1
Tpoint = Tpoint - 0.01
Tpoint is defined as Double
Then in the CountDisp it displays the current total of the amount the participant has earned. CountDisp.Text = "You have earned: $"&Tpoint & "!"
This works fine until you get to about 25 correct answers or so (this would be across two blocks of trials as you are error testing).
At that point, the screen starts to display "You earned $2.24999999999999" instead of $2.25. I'm uncertain as to why this is occurring. I thought perhaps I was not actually adding, but concatenating the strings, but then I don't understand why it would work up until about 25 or so. Any ideas you could give would be very helpful.Thank you in advance for putting up with my explanation and any help you can give!
Please sign in to leave a comment.