• 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: number formatting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: number formatting


  • Subject: Re: number formatting
  • From: Lance Bland <email@hidden>
  • Date: Fri, 22 Feb 2002 07:58:33 -0500

On Friday, February 22, 2002, at 07:29 AM, email@hidden
wrote:

> I believe that this covers the reason why.

I agree with that.

> This is not a bug (it is a side-effect of using floating point
> precision).

I don't agree with that. An object as big as a TextField (and intended
for users that don't know anything about IEEE floats) should know how to
handle truncation effects; even without a formatter. The fact is, the
behavior has been in Cocoa for 5 years or so, many people comment on it,
no one has done anything about it.

Even lowly printf can do better:

code:

printf(".4: %g\n", .4);
printf(".4: %f\n", .4);
printf(".4: 0.20f\n", .4);

output:

.4: 0.4
.4: 0.400000
.4: 0.40000000000000002220



-lance

_______________________________________________
Lance Bland
System Administrator at VVI
mailto:email@hidden
http://www.vvi.com
Realtime, bulk and web data reporting and visualization
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: number formatting (From: email@hidden)

  • Prev by Date: Re: number formatting
  • Next by Date: Re: Please help?...
  • Previous by thread: Re: number formatting
  • Next by thread: Re: number formatting
  • Index(es):
    • Date
    • Thread