Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7528777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:28:30+00:00 2026-05-30T04:28:30+00:00

What is the relevance of Stack Overflow question/answer Why does changing 0.1f to 0 slow

  • 0

What is the relevance of Stack Overflow question/answer Why does changing 0.1f to 0 slow down performance by 10x? for Objective-C? If there is any relevance, how should this change my coding habits? Is there some way to shut off denormalized floating points on Mac OS X?

It seems like this is completely irrelevant to iOS. Is that correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:28:31+00:00Added an answer on May 30, 2026 at 4:28 am

    As I said in response to your comment there:

    it is more of a CPU than a language issue, so it probably has
    relevance for Objective-C on x86. (iPhone’s ARMv7 doesn’t seem to support
    denormalized floats, at least with the default runtime/build settings)

    Update

    I just tested. On Mac OS X on x86 the slowdown is observed, on iOS on ARMv7 it is not (default build settings).

    And as to be expected, running on iOS simulator (on x86) denormalized floats appear again.

    Interestingly, FLT_MIN and DBL_MIN respectively are defined to the smallest non-denormalized number (on iOS, Mac OS X, and Linux). Strange things happen using

    DBL_MIN/2.0
    

    in your code; the compiler happily sets a denormalized constant, but as soon as the (arm) CPU touches it, it is set to zero:

    double test = DBL_MIN/2.0;
    printf("test      == 0.0 %d\n",test==0.0);
    printf("DBL_MIN/2 == 0.0 %d\n",DBL_MIN/2.0==0.0);
    

    Outputs:

    test      == 0.0 1  // computer says YES
    DBL_MIN/2 == 0.0 0  // compiler says NO
    

    So a quick runtime check if denormalization is supported can be:

    #define SUPPORT_DENORMALIZATION ({volatile double t=DBL_MIN/2.0;t!=0.0;})
    

    (“given without even the implied warranty of fitness for any purpose”)

    This is what ARM has to say on flush to zero mode: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204h/Bcfheche.html

    Update<<1

    This is how you disable flush to zero mode on ARMv7:

    int x;
    asm(
        "vmrs %[result],FPSCR \r\n"
        "bic %[result],%[result],#16777216 \r\n"
        "vmsr FPSCR,%[result]"
        :[result] "=r" (x) : :
    );
    printf("ARM FPSCR: %08x\n",x);
    

    with the following surprising result.

    • Column 1: a float, divided by 2 for every iteration
    • Column 2: the binary representation of this float
    • Column 3: the time taken to sum this float 1e7 times

    You can clearly see that the denormalization comes at zero cost. (For an iPad 2. On iPhone 4, it comes at a small cost of a 10% slowdown.)

    0.000000000000000000000000000000000100000004670110: 10111100001101110010000011100000 110 ms
    0.000000000000000000000000000000000050000002335055: 10111100001101110010000101100000 110 ms
    0.000000000000000000000000000000000025000001167528: 10111100001101110010000001100000 110 ms
    0.000000000000000000000000000000000012500000583764: 10111100001101110010000110100000 110 ms
    0.000000000000000000000000000000000006250000291882: 10111100001101110010000010100000 111 ms
    0.000000000000000000000000000000000003125000145941: 10111100001101110010000100100000 110 ms
    0.000000000000000000000000000000000001562500072970: 10111100001101110010000000100000 110 ms
    0.000000000000000000000000000000000000781250036485: 10111100001101110010000111000000 110 ms
    0.000000000000000000000000000000000000390625018243: 10111100001101110010000011000000 110 ms
    0.000000000000000000000000000000000000195312509121: 10111100001101110010000101000000 110 ms
    0.000000000000000000000000000000000000097656254561: 10111100001101110010000001000000 110 ms
    0.000000000000000000000000000000000000048828127280: 10111100001101110010000110000000 110 ms
    0.000000000000000000000000000000000000024414063640: 10111100001101110010000010000000 110 ms
    0.000000000000000000000000000000000000012207031820: 10111100001101110010000100000000 111 ms
    0.000000000000000000000000000000000000006103515209: 01111000011011100100001000000000 110 ms
    0.000000000000000000000000000000000000003051757605: 11110000110111001000010000000000 110 ms
    0.000000000000000000000000000000000000001525879503: 00010001101110010000100000000000 110 ms
    0.000000000000000000000000000000000000000762939751: 00100011011100100001000000000000 110 ms
    0.000000000000000000000000000000000000000381469876: 01000110111001000010000000000000 112 ms
    0.000000000000000000000000000000000000000190734938: 10001101110010000100000000000000 110 ms
    0.000000000000000000000000000000000000000095366768: 00011011100100001000000000000000 110 ms
    0.000000000000000000000000000000000000000047683384: 00110111001000010000000000000000 110 ms
    0.000000000000000000000000000000000000000023841692: 01101110010000100000000000000000 111 ms
    0.000000000000000000000000000000000000000011920846: 11011100100001000000000000000000 110 ms
    0.000000000000000000000000000000000000000005961124: 01111001000010000000000000000000 110 ms
    0.000000000000000000000000000000000000000002980562: 11110010000100000000000000000000 110 ms
    0.000000000000000000000000000000000000000001490982: 00010100001000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000745491: 00101000010000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000372745: 01010000100000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000186373: 10100001000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000092486: 01000010000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000046243: 10000100000000000000000000000000 111 ms
    0.000000000000000000000000000000000000000000022421: 00001000000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000011210: 00010000000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000005605: 00100000000000000000000000000000 111 ms
    0.000000000000000000000000000000000000000000002803: 01000000000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000001401: 10000000000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000000000: 00000000000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000000000: 00000000000000000000000000000000 110 ms
    0.000000000000000000000000000000000000000000000000: 00000000000000000000000000000000 110 ms
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to retrieve relevance values with results with the array returned
(This question is over 6 years old and probably no longer has any relevance.)
Looked at some other similar answers on stack overflow, but no relevant answer was
this is my first question on stack overflow but I have some experience in
I've notised that Stack Overflow only presents me with a captcha occasionally. Does anyone
While I see the relevance of web in the phrase web stack, I'm left
Can any one help me how to sort rows by relevance for the following
Are standards like ISO 9241 Ergonomics of Human System Interaction of any relevance in
I have a recursive call to a method that throws a stack overflow exception.
With the help of the Stack Overflow community I've written a pretty basic-but fun

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.