🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8678

AS Cant make number into integer?

#8678
From: Shane_Stanley
Date: Fri, 29 Sep 2006 02:21
17 lines
1376 bytes
You can coerce reals to integers in recent versions of AS, although I'd
argue it's not really a coercion because it changes the value. What you
probably need to do is use "round" to round the value:

 round (5.4)

You can round in different ways (up, down, nearest, etc).

It's actually quicker in most cases to dispense with round, which involves
the overhead of a call to a scripting addition, and instead use the built-in
div command:

 set x to 5.4
 (x + 0.5) div 1

-- 
Shane Stanley <sstanley@myriad-com.com.au>
Technical Details
Message-ID: <C142C03F.307E5%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.albasani.net!news.isoc.lu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,252e4f6a361f8985
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Shane_Stanley@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.albasani.net!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: AS Cant make number into integer?
Message-ID: <C142C03F.307E5%sstanley@myriad-com.com.au>
Date: Thu, 28 Sep 2006 19:21:19 -0700
Lines: 21
Return-Path: <sstanley@myriad-com.com.au>
User-Agent: Microsoft-Entourage/11.2.5.060620
Thread-Topic: AS  Cant make number into integer?
Thread-Index: AcbjbfK8MYOT1E9hEdupAwARJHm3nA==
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit