Mysql Finding Min/max Values For Double
Solution 1:
If you want to find and prove you know the exact max value on a system, here is a way to do it in a few minutes of execution time.
Do a simple loop that starts with the value of 1 and inserts it. On each loop multiple the value by 10 until it fails on overflow. At the end of this you have the minWorkingValue and the maxFailedValue.
Now do a second loop that inserts a value halfway between minWorkingValue and maxFailedValue. If it succeeds it becomes the new minWorkingValue. If it fails it becomes the new maxFailedValue. Continue until maxFailedValue - minWorkingValue = 1. At the end minWorkingValue is your actual max value you can insert.
As an alternative, if you are pretty sure you know where these values might be, then skip the first step and manually set minWorkingValue and maxFailedValue and straight to the 2nd loop.
Post a Comment for "Mysql Finding Min/max Values For Double"