• 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: IOS floating point performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IOS floating point performance


  • Subject: Re: IOS floating point performance
  • From: John McCall <email@hidden>
  • Date: Thu, 08 Aug 2013 10:19:26 -0700

On Aug 8, 2013, at 6:37 AM, Scott Ribe <email@hidden> wrote:
> On Aug 8, 2013, at 6:37 AM, Roland King <email@hidden> wrote:
>> shouldn't do that as long as one uses the correct functions, ie sinf() and cosf().
>
> But */+- promote…

If all the operands to an operator are floats, the operation occurs in float, and
the type of the result will be float.  However, if either type is double, the other
will be promoted, and the type of the result will be double.  This is an easy
situation to get into because (a) the type of an unsuffixed floating-point literal
(e.g. 1.0 instead of 1.0f) is double and (b) while many of the math library calls
come in both float and double varieties, the double version usually has the
more obvious name.

C does permit the implementation to use a larger-precision type to compute
intermediate results within an expression.  For example, if you compute
4.0f * someFloat + 7.0f * someOtherFloat, the implementation is allowed to
do this at a greater precision than float.  But note that, when this is done,
it’s done *for better performance*, so that machines that don’t provide native
float support (like the x87 coprocessor) aren’t forced to round to float after
every operation.  (Java permits something similar in the absence of ‘strictfp’.)

John.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >IOS floating point performance (From: Trygve Inda <email@hidden>)
 >Re: IOS floating point performance (From: Kevin Meaney <email@hidden>)
 >Re: IOS floating point performance (From: Roland King <email@hidden>)
 >Re: IOS floating point performance (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: IOS floating point performance
  • Next by Date: Re: IOS floating point performance
  • Previous by thread: Re: IOS floating point performance
  • Next by thread: Re: IOS floating point performance
  • Index(es):
    • Date
    • Thread