So I have this division between double
s (from values it gets in a database);
indPayRatio[loadCounter] = c.getDouble(c.getColumnIndex("payment")) / c.getDouble(c.getColumnIndex("debt_total"));
There is no case where either of the values can be blank. They HAVE to be something here.
Well I get this crazy long number sometimes, so I convert it to BigDecimal
like so:
bdRatio = new BigDecimal(indPayRatio[i]);
At this line, I get the following stack trace from many users. I am unable to replicate it so I am unsure of the value.
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.NumberFormatException: Infinity or NaN: NaN
at java.math.BigDecimal.<init>(BigDecimal.java:465)
at com.---.---.DebtDataSource.payoffDebt(DebtDataSource.java:544)
at com.---.---.PlannerFragment$PlannerTask.doInBackground(PlannerFragment.java:177)
at com.---.---.PlannerFragment$PlannerTask.doInBackground(PlannerFragment.java:143)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more
My first hunch, is that I should be using BigDecimal
to multiply at the first line, but if that is the issue, why am I getting the error when I convert it to BigDecimal
?