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

NumberFormatters and sci notation


  • Subject: NumberFormatters and sci notation
  • From: Graham J Lee <email@hidden>
  • Date: Wed, 18 Jan 2006 14:39:35 +0000

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: This email sent to email@hidden
  • Follow-Ups:
    • Re: NumberFormatters and sci notation
      • From: Greg Herlihy <email@hidden>
    • Re: NumberFormatters and sci notation
      • From: Tommy Nordgren <email@hidden>
    • Re: NumberFormatters and sci notation
      • From: Johan Kool <email@hidden>
  • Prev by Date: Re: NSTimers
  • Next by Date: Re: NumberFormatters and sci notation
  • Previous by thread: Re: Implementing custom accessors in core data
  • Next by thread: Re: NumberFormatters and sci notation
  • Index(es):
    • Date
    • Thread