• 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: NumberFormatters and sci notation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NumberFormatters and sci notation


  • Subject: Re: NumberFormatters and sci notation
  • From: Tommy Nordgren <email@hidden>
  • Date: Wed, 18 Jan 2006 19:01:51 +0100

I think your only solution for first-rate support for scientific notation, is to implement a
custom formatter class. You might want to examine how to implement a custom
Interface Builder plugin, to make it possible to add such objects to Nibs.
On Jan 18, 2006, at 3:39 PM, Graham J Lee wrote:


Afternoon all,

I want to set up a NSNumberFormatter attached to a cell to display scientific notation with a fixed precision on the mantissa, so that a number like 0.00017234784 might be displayed as 1.72e-04. If I attach the formatter through IB, then it just specifies strings like @"##0,00.00" which format the example above as "0.00". I've tried using the numberStyle, thus:
[NSNumberFormatter setDefaultFormatterBehavior:NSNumberFormatterBehavior10_4];
NSNumberFormatter *fmt=[[[NSNumberFormatter alloc] init] autorelease];
[fmt setNumberStyle:NSNumberFormatterScientificStyle];
[[c0Field cell] setFormatter:fmt];
but this formats the number as "1.7234784e-04". How can I restrict the mantissa's precision while still retaining scientific notation?

Thanks,

Graham.

--
Graham Lee                       GPG Key ID: 01D5B9D8
UNIX Systems Manager,
Oxford Physics Practical Course
http://users.ox.ac.uk/~wadh1342               01865 273450


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40chello.se


This email sent to email@hidden

------------------------------------- This sig is dedicated to the advancement of Nuclear Power Tommy Nordgren email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NumberFormatters and sci notation (From: Graham J Lee <email@hidden>)

  • Prev by Date: Re: "Open dialogue"-like file system browser
  • Next by Date: Re: Translucent black window
  • Previous by thread: Re: NumberFormatters and sci notation
  • Next by thread: Re: NumberFormatters and sci notation
  • Index(es):
    • Date
    • Thread