Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 27th, 2003, 10:34 AM
rec rec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: houston
Posts: 94 rec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 40 m
Reputation Power: 6
can I round infinity

I have an equation that will very often yield an infinite number so I need an interim step to cut the number off at around four decimal places. Does any one know a way to achieve this?

It would seem there should be a way to do this otherwise Flash’s usefulness with math would be seriously crippled but I haven’t been able to find anything in any of the resources I have.

Reply With Quote
  #2  
Old April 27th, 2003, 11:14 AM
gargoyle gargoyle is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 14 gargoyle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
no, infinity in flash is a defined value just being defined somehow as too big/small to compute anymore.
check out the reference on isFinite and the mentioned stuff there...

Reply With Quote
  #3  
Old April 27th, 2003, 11:40 AM
rec rec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: houston
Posts: 94 rec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 40 m
Reputation Power: 6
infinity

There has got to be a way to deal with this. PI is an infinite number but Flash works with it. I assume it is a predefined values cut off at a useable length but still, infinite numbers are going to be abundant unless you keep your math uses limited to 1 + 1 = 2.

Reply With Quote
  #4  
Old April 27th, 2003, 01:44 PM
gargoyle gargoyle is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 14 gargoyle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ah wait! stop! u r talking about the precision of floating point numbers?
well i never had a problem with it, as long as i wanted flash to measure out some pixel values or stuff or make it calculate fractals or stuff but for sure i would not trust it's correctness if i had the choice between my scientific calculator somewhere in the mees on my desktop and flash...
but well it is able to nice algebra but if it suits a scientific topic i am not sure about that...

Reply With Quote
  #5  
Old April 28th, 2003, 09:28 PM
rob5408 rob5408 is offline
Certified Genius
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: over there
Posts: 77 rob5408 User rank is Private First Class (20 - 50 Reputation Level)rob5408 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 46 m 57 sec
Reputation Power: 7
Send a message via AIM to rob5408
Post not to nit pick

you may have found the solution already...but what you're talking about is an irrational number not an infinite number...pi is an irrational number which means it has no fractional equivalent, unless you live in indiana...rob

ok so after feeling bad about not even coming close to attempting to help you i had second thoughts...flash will store your variable in like a 32 bit or whatever memory location...so to say it has infinite decimal places would mean you had an infinite amount of memory in your machine...so why don't you just round all of them? i don't think the flash player will complain if you round .2 to the thousandth or anything...
__________________
Delenda est Carthago

Last edited by rob5408 : April 28th, 2003 at 09:34 PM.

Reply With Quote
  #6  
Old April 29th, 2003, 08:38 AM
rec rec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: houston
Posts: 94 rec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 40 m
Reputation Power: 6
infinity

Rob, Gargoyle;

First of all I want to thank you guys for replying to my inquiry, I often find help on this site and sometimes all that is needed is a different perspective. In this case I think I have found the solution.

I started by breaking the equation down into its various subcomponents and testing each one to find where the problem was coming in and also running a function that would round any value to a desired number of decimal places. What I discovered when I did this was that when I tried to string too much together in a single line of code it would return infinity but if I put each step on a separate line and stored that answer in a variable to be used in a subsequent line or step it would work. I don’t know if it’s just a miss-step in the way I am forming the code or what. But for instance something like

var value1 = 6 / (Math.PI * Math.log (3)) ;

would return infinity whereas

value1 = Math.log (3);
value2 = Math.PI * value1;
solution = 6 / value2;

would work just fine. I’m not sure what the problem is with the other approach. Maybe you guys know what’s up with this.

BTW I also don’t know if my sample code I’ve put here will display correctly so my apologies if it displays a string of gobbldy gook.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > can I round infinity


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway