Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-06-2008, 04:10 AM   #1
Noct
Toys in the Attic...
 
Noct's Avatar
 
Join Date: Oct 2006
Location: NY
Posts: 2,348
Send a message via ICQ to Noct Send a message via AIM to Noct Send a message via MSN to Noct
Question Parsing a number, float versus integer

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?
__________________
Just one dimension shy of a career in 3d gaming.
Noct is offline   Reply With Quote
Old 11-15-2008, 01:42 AM   #2
pj-co
Site Contributor
 
Join Date: Jun 2008
Location: Brooklyn
Posts: 311
Default

If the users have entered a number, go with number. why over think it?
pj-co is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
decimal number to binary number ? baby_annie Other Flash General Questions 11 03-29-2004 05:12 AM
Problem with addition and number validation Denaes ActionScript 2.0 2 10-07-2003 02:39 PM
getting numbered values from array linckx ActionScript 1.0 (and below) 14 06-24-2003 12:21 AM
load vars from text file as a number (int, float...) tnicolas ActionScript 1.0 (and below) 3 08-05-2002 09:59 PM
Random number bruceleecutie ActionScript 1.0 (and below) 1 02-18-2002 03:51 PM


All times are GMT. The time now is 05:54 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.