Noct
10-06-2008, 04:10 AM
In a best practice/"cleanest code possible" type scenario, would you stop to evaluate whether a number contained a decimal before you did a parseFloat on it?
I'm parsing user entered equations, and since they can enter a decimal, I currently have it just parseFloat-ing eveything to be safe.
Since my App does not perform these equations rapidly, I can't imagine it would really matter performance-wise, but I'm wondering if practices would suggest that I only use pInt on ints and pFloat on dec...
Any thoughts?
I'm parsing user entered equations, and since they can enter a decimal, I currently have it just parseFloat-ing eveything to be safe.
Since my App does not perform these equations rapidly, I can't imagine it would really matter performance-wise, but I'm wondering if practices would suggest that I only use pInt on ints and pFloat on dec...
Any thoughts?