Autor Beitrag
Hazer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54

Win XP Pro SP2
Turbo Delphi 2006
BeitragVerfasst: So 10.04.05 21:22 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var x:real;
    function faculty(var x:real):real;
  var a:real;
      i:integer;
  begin
      a:=1;
      for i:=1 to trunc(x) do begin
         a:=a*i;
      end;
      faculty:=a;
  end;
begin
  readln(x);
  x:=faculty(x);
  writeln(x);
  readln;
end.


bei kleinen zahlen funktioniert das, doch bei größeren, wie 1000 nicht. Woran liegt das?
warum klappt es so nicht?

Gruß
hazer

_________________
I was too weak to fight | once more i let go
it is a black session | an invitation of sorts


Zuletzt bearbeitet von Hazer am So 10.04.05 21:33, insgesamt 1-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 10.04.05 21:31 
Real (in D6 ist das Double) dürfte für 1000! zu klein sein. Extended hat einen deutlich größeren Bereich, aber die Fakultäts-Funktion ist sehr rasch wachsend, sodass das auch nicht lange vorhalten wird.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: So 10.04.05 21:35 
user profile iconChristian S. hat folgendes geschrieben:
Extended hat einen deutlich größeren Bereich, aber die Fakultäts-Funktion ist sehr rasch wachsend, sodass das auch nicht lange vorhalten wird.
Hihi, für 1000! nicht, da macht sogar mein Taschenrechner schlapp ;-)

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert