| Free £25 Bet! | Free £50 Bet at VCBet! | Free £25 Bet! |

In association with Sports-Punter Free Bets Odds Comparison BetHelp Limso
We are the Official Forum of FreeBetting.net & FCBet.com
| Sports News | Sports Stats | Live Scores | OddsChecker | Place Bets | Suggest a Site |
| |||||||
| Tech & Gaming Forum This is the place for all your technical related questions about computers, programs or whatever... |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) | ||||||||||||||||||||||||||||||||
| aka plopplop ![]() ![]() ![]() ![]() Join Date: 08 Aug 2006 Location: Nottingham Age: 29
Posts: 603
|
If I have the above data as a history for this match:
and I want to calculate the win % age for each player on the surface of the upcoming game. My code currently counts the instances of the player names in the history data where the surface is the same. You can see my problem, in the history data Federer has not player Roddick before the upcoming match. So I end up trying to do the calculation: zero / zero and i get an error. "Run-time error '6': Overflow" I assume i need to change my code to cope with this. The code as it stands is this: player_1_h2h_surface_win_pct = (player1surfacecount / (player1surfacecount + player2surfacecount)) * 100 How do I change the code to cope with zero / zero????? I could do On Error etc but I assume there must be a cleverer way. Thanks in advance Matt | ||||||||||||||||||||||||||||||||
| | |
| | #2 (permalink) |
| Sabbatical punter ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: 27 Nov 2000 Age: 29
Posts: 10,246
| I don't really use VBA but I have a bit of experience programming with matlab. The way I usually deal with that is to add the matlab 'epsilon' to the denominator. Epsilon is the limit of floating point precsion in matlab (10^-52, using double precision). I think there must be an equivalent in VBA. If not just add a really small number to your code manually, say 0.0000000000000001. This won't change the result within the limits of accuracy you're expecting and you shouldn't get a division by 0 error.
__________________ |
| | |
| | #3 (permalink) |
| Pocket Rocket ![]() ![]() ![]() ![]() ![]() Join Date: 06 Nov 2005
Posts: 924
| Matt, Only way to do other then On error os to have a check for the 0/0 condition using an if/else block. It's not very clean, but does exactly what you want if ((player1surfacecount + player2surfacecount)=0) player_1_h2h_surface_win_pct = 0 'Or whatever you want) else player_1_h2h_surface_win_pct = (player1surfacecount / (player1surfacecount + player2surfacecount)) * 100
__________________ http://gamblingtools.blogabet.com/ |
| | |
| | #4 (permalink) |
| aka plopplop ![]() ![]() ![]() ![]() Join Date: 08 Aug 2006 Location: Nottingham Age: 29
Posts: 603
| PAULM03, mcgin, Thanks very much - I went with mcgin's suggestion. Like most things - simple solutions are the way forward. My brain must have been a bit fuzzy at 2:45am. Thanks again. |
| | |
| Free £100 Bet! | Free £100 Bet! |
| Partner Sites | ||||||||
| Football Betting Tips | Free Bets | Australian Free Bets HOT | Odds Comparison | Soccer Punter |
| Bookmakers | Livescore | SoccerVista | Asian Handicap Betting Guide |
© 2008 PuntersLounge.Com Ltd | Gambling Problems?
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.