O/H Andries Bos έγραψε: > Hello > > We are busy working, along with 3 others, on an estimation program: I'm using > a lot of doubles, but also curruncies to present the calculated values to the > user. (e.g. A *b * C * D = X where a,b,c,d are doubles and X is of type > currency) > > Now a customer entered a 13- valued value and after doing some calculation > the user recieves a resulting currency value, it shows a 'invalid floating > point' error.(so the result is > MaxCurrency) Lowering one of the values will > prevent this error, but I have to deal with these numbers. > > I saw that the max value of currency is about E+14 and double ~ E+308 . > > What is the neatest way to deal with calulated values that could result in an > "invalid floating point" error. Do I have to limit all entries to a certain > maximum, do I have to encapsulate all calculations with try except...? > > Any structured way of dealing with these sort of values will be great. > As these calculations are used in many parts of our program and the values > provided to a user are being recalculated ad-hoc, using try except on all > calculations (> 100,000,000) will put a great penalty on the performance. > > I've done this in Excel and excel will show values > limit as somthing like " > + #Value" (i'm using the dutch version). The customer would like to be > presented, I think, by a simular solution.. > > Any ideas? > > Andries > The Netherlands
Hi Andries check the NaN and Infinity constants IsNaN(), IsInfinite(), Sign() etc functions and this page at http://homepages.borland.com/efg2lab/Library/Delphi/MathInfo/Resources.htm Also you may try using Extended instead of Doubles -- Regards Theo ------------------------ Theo Bebekis Thessaloniki, Greece ------------------------ Greek_Delphi_Prog : a Delphi Programming mailing list in Greek at http://groups.yahoo.com/group/Greek_Delphi_Prog CSharpDotNetGreek : A C# and .Net mailing list in Greek language at http://groups.yahoo.com/group/CSharpDotNetGreek atla_custom : a Unisoft Atlantis Customization mailing list at http://groups.yahoo.com/group/atla_custom ------------------------ ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/delphi-en/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

