MACSCRPT Archives

May 2003

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nigel Garvey <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 15 May 2003 10:39:43 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (46 lines)
Paul Berkowitz wrote on Wed, 14 May 2003 14:40:28 -0700:

>2 ^ 29 as double integer
>--> 5.36870912E+8 -- no error
>
>2 ^ 62 as double integer
>--> 4.61168601842739E+18
>
>(2 ^ 62) as real
>--> 4.61168601842739E+18
>
>(So 'real' is same as 'double integer'.)

It certainly seems to be!

  (2 ^ 29) as double integer
  class of result
  --> real

  1 as double integer
  class of result
  --> real

But:

  1.5 as double integer
  --> 2.0

  2.5 as double integer
  --> 2.0

So. A nice, faster than 'round', IEEE-standard rounding process for
someone:

  (n as double integer) div 1

Though that's still not as fast as:

  if (n mod 2) ^ 2 > 0.25 then
    n div 0.5 - n div 1
  else
    n div 1
  end if

NG

ATOM RSS1 RSS2