top | item 35583855

(no title)

fm77 | 2 years ago

In Turbo Pascal :-) you have to filter for NaN or else you will end up with a Runtime Error.

  const NaN = $FF shl 23;

  var x, t: longint;
      f: single absolute x;

  begin 
    t := 0;
    x := 0;
    repeat
      inc(t, ord((x and NaN <> NaN) and (0<=f) and (f<=1)));
      inc(x);
    until x = 0;
    WriteLn('total: ', t);
  end.
total: 1065353218 (in ca. 40 seconds)

discuss

order

No comments yet.