procedure dec_bin(**a:real**); var wstr,mdstr:string;i,lng:integer;b,c,md:real; begin repeat **b:=a/2;** c:=frac(b); if c=0 then md:=0 else md:=1; str(md,mdstr); wstr:=concat(wstr,mdstr); **a:=trunc(b);** until a=1; wstr:=concat(wstr,'1'); lng:=length(wstr); for i:=lng downto 1 do binstr:=concat(binstr,wstr[i]); end; Entering 'a' with more than 10 digits gives the error:
Runtime Error: The value was unacceptably small or unacceptably large for an Int32.
a:=trunc(b). - Brain Arsonistbis outside the scope of the int32 type, or that the trunc function returns a variable to an integer type as a result of cutting the characters after the point? - Brain Arsonistbdescribed as a real variable - Brain ArsonistTruncin Pascal. In Delphi, this is exactly what happens ( the trunc function returns a variable to an integer type as a result of truncating the characters after the dot ), only in Delphi it is an int64. - Kromster