• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Decimal Point Truncations?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decimal Point Truncations?


  • Subject: Re: Decimal Point Truncations?
  • From: Pier Kuipers <email@hidden>
  • Date: Thu, 8 Feb 2001 22:36:59 +0000

>I want to get the disk size and display the result in Gb with one decimal
>place (If possible). Currently, the full code above gets something like
>54.6464646748783838.

Here's what i cobbled together a few years ago. Not as fancy (read:
concise) as some of the stuff I've seen, but it works. And I
understand how it works, too... I think.

set y to 54.64646467487
set p to (count ((y - (y div 1)) as text))-2
if p > 1 then
set x to (y - (y div 1)) * 10
set q to (x + 0.5) div 1
set r to (y div 1) + (q / 10)
else
set r to y
end if

Pier.
--
Pier Kuipers
Visual ID
* the Media Asset Management solution *

2 Whitefriars
Aungier Street
Dublin 2
Tel. +353 1 476 7059
Mobile +353 87 294 3063
Fax +353 1 478 1366
ISDN +353 1 602 0754

http://www.visualid.com


References: 
 >Decimal Point Truncations? (From: "Gregory Smith" <email@hidden>)

  • Prev by Date: Re: Program Linking via IP (Was: Why doesn't this work?)
  • Next by Date: Re: Changed definition of word? No dashes?
  • Previous by thread: Re: Decimal Point Truncations?
  • Next by thread: Re: Decimal Point Truncations?
  • Index(es):
    • Date
    • Thread