• 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: Rounding to two decimals
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rounding to two decimals


  • Subject: Re: Rounding to two decimals
  • From: Ken Garden <email@hidden>
  • Date: Sun, 18 Jul 2004 00:18:02 +0200

Probably it's just a slight mistake. Here's the relevant code snippet
with some sample data filled for the integers:

[BEGIN]

int total, multiply;
float average;

total = 5;
multiply = 8;

average = (float)multiply / total;
average = round(average * 100) / 100;

[averageLabel setFloatValue:average];

[END]

The text printed in averageLabel is "1.6000000238...". It seems the
rounding is done quite nicely, I'm just wondering why there's such a
strange extension. An idea how I can get rid of this?
_______________________________________________
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.


  • Follow-Ups:
    • Re: Rounding to two decimals
      • From: "Ihar 'Philips' Filipau" <email@hidden>
    • Re: Rounding to two decimals
      • From: "Louis C. Sacha" <email@hidden>
    • Re: Rounding to two decimals
      • From: Dave Rosborough <email@hidden>
References: 
 >Rounding to two decimals (From: Ken Garden <email@hidden>)
 >Re: Rounding to two decimals (From: Yann Bizeul <email@hidden>)

  • Prev by Date: Forward delete Key and IB
  • Next by Date: Re: my arrays are being deallocated, and i dky
  • Previous by thread: Re: Rounding to two decimals
  • Next by thread: Re: Rounding to two decimals
  • Index(es):
    • Date
    • Thread