Code Comments
Programming Forum and web based access to our favorite programming groups.Is Fortran 95 suitable for financial calculations? I mean: I probably have to perform all calculations with two digits after the decimal point and then do some "Banker's rounding", but I have really no idea. TIA, GaK
Post Follow-up to this messageGastfreund aus Korinth <keine@nirgendwo.de> wrote: > Is Fortran 95 suitable for financial calculations? I mean: I probably have > to perform all calculations with two digits after the decimal point and > then do some "Banker's rounding", but I have really no idea. > One common trick is to perform all calculations in Cents (or Lepta or whatever) and then shift the decimal point just for printing EURO (or $ or EYPO or whatever) amounts. This at least avoids the problem that a number like 0.01 EUR does not have an exact representation in binary floating point. Double precision variables hold more digits than integers and they may give you a handle for rounding. Rounding may be more tricky. Whatever "Banker's rounding" means, you will probably have to implement it by hand using AINT, ANINT or whatever is suitable. The real problem is to avoid intermediate rounding in more complex calculations (more complex than a single operation). -- Klaus Wacker wacker@Physik.Uni-Dortmund.DE Experimentelle Physik V http://www.physik.uni-dortmund.de/~wacker Universitaet Dortmund Tel.: +49 231 755 3587 D-44221 Dortmund Fax: +49 231 755 4547
Post Follow-up to this message"Gastfreund aus Korinth" <keine@nirgendwo.de> wrote in message news:pan.2004.07.27.05.53.48.109000@nirgendwo.de... > Is Fortran 95 suitable for financial calculations? I mean: I probably have > to perform all calculations with two digits after the decimal point and > then do some "Banker's rounding", but I have really no idea. > > TIA, > GaK > Earlier this year I showed a Fortran solution http://home.cfl.rr.com/davegemini/decimal.f90 to a multi-language challenge called "The IBM Telco Benchmark" that has fastest processing of the 1 million phone call file. Review: http://www2.hursley.ibm.com/decimal/telco.html
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.