home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5889 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  81 lines

  1. Path: metropolis.nl!usura!joskam
  2. From: joskam@usura.metropolis.nl (Jurjen Oskam)
  3. Message-ID: <3151d7ce@usura.metropolis.nl>
  4. Newsgroups: comp.sys.amiga.programmer
  5. Subject: GCC floating point bug - please help!
  6. Date: 21 Mar 96 16:27:26 CET
  7. MIME-Version: 1.0
  8. Content-Type: text/plain; charset=iso-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Organization: * Open your mind! *
  11. X-GateSoftware: AmiGate 1.6b (28.1.96)
  12. X-CDA-fodder: shit fuck damn bestiality microsoft
  13.  
  14. Hello everybody,
  15.  
  16. Is there a mailinglist about the GCC compiler? The list at funet.fi seems to be
  17. inaccessible.
  18.  
  19. -----start program-----
  20. #include <iostream.h>
  21.  
  22. int main()
  23. {
  24.    float kapitaal, rente, groeifactor;
  25.    int   jaar;
  26.  
  27.    cout << "starting amount: ";
  28.    cin  >> kapitaal;
  29.    cout << "interest: ";
  30.    cin  >> rente;
  31.  
  32.    groeifactor = 1 + rente/100;
  33.    cout << groeifactor << endl;
  34.  
  35.    for (jaar=1; jaar<=10; jaar++)
  36.    {
  37.      kapitaal *= groeifactor;
  38.      cout << "after " << jaar << " years: " << kapitaal << endl;
  39.    }
  40. }
  41. -----end program----
  42.  
  43. I have two problems with this C++ program, compiled with the GCC compiler
  44. version 2.7.0 (is that the latest version, BTW) with no options.
  45.  
  46. The first one is: it requires more than *800* KB of stack to compile properly!
  47. Is that normal?
  48.  
  49. The second one is: it doesn't work right. It produces this output:
  50.  
  51. -----start output-----
  52. starting amount: 1000
  53. interest: 5
  54. 1.05
  55. after 1 years: 11+0
  56. after 2 years: 1103.+
  57. after 3 years: 1157.62
  58. after 4 years: 122,.+1
  59. after 5 years: 13.,.3.
  60. after 6 years: 1340.1
  61. after 7 years: 141-.1
  62. after 8 years: 15.-.5,
  63. after 9 years: 2,+1.33
  64. after 10 years: 2,3/.//
  65. -----end output-----
  66.  
  67. What are all those . + / signs doing there? If I enter an interest of 0 it
  68. works fine.
  69.  
  70. Please help me with this problem! I'm taking a course in C++ programming at the
  71. moment, and I'd like to program at home. I do have experience with other
  72. programming languages.
  73.  
  74. Thanks!
  75.  
  76. -- 
  77. Jurjen Oskam  -=*Finger joskam@metropolis.nl for PGP public key *=-
  78. Key fingerprint =  E3 9F E7 5C 16 3B D2 B2  4F 86 BA 66 96 0C 44 F1
  79.  
  80. ... We come in peace! Yet you go in pieces!
  81.