Open Office

Further to my suggestion that Engineering format be supported in the OO spread sheet, I found this formatting code on the web - consider incorporating it in some form....


def number_to_engineering(value, precision=3)
  expof10 = ((Math.log10(value)/3.0).floor)*3
  value *= 10**(-expof10)
  case
    when value>=1000.0 :
      value /= 1000.0
      expof10 +=3
    when value>=100.0 :  precision -= 2
    when value>=10.0 :  precision -= 1
  end
  "%.*fe%d" % [precision-1, value, expof10]
end

number_to_engineering(15000) => "15e3"


to ruby formatting number by Kevin on Tue Aug 23 07:40:20 GMT 2005





Nick Radonic


--
--------------------- [ SECURITY NOTICE ] ---------------------
To: [EMAIL PROTECTED]
For your security, [EMAIL PROTECTED]
digitally signed this message on 14 November 2006 at 01:42:35 UTC.
Verify this digital signature at http://www.ciphire.com/verify.
---------------- [ CIPHIRE DIGITAL SIGNATURE ] ----------------
Q2lwaGlyZSBTaWcuAjhkaXNjdXNzQG9wZW5vZmZpY2Uub3JnAG5yYWRvbmljQGNv
bWNhc3QubmV0AGVtYWlsIGJvZHkA9wEAAHwAfAAAAAEAAAALH1lF9wEAAD0CAAIA
AgACACALB26d9hmtxYkWXEs/xoWi/0ygntYmGZJS3y/Wj0+TOQEAWAaQbyvBYla6
oxuaRNPDJCDxTcHhxUWf/Dnyhm8zJLdFl/W1uhWKS/Q76aMgub5T0jTNUqZInX/E
FJnMk4vXOV/2OwjBU2lnRW5k
------------------ [ END DIGITAL SIGNATURE ] ------------------

Reply via email to