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

  • Home
  • SEARCH
  • 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 7012219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:13:40+00:00 2026-05-27T22:13:40+00:00

There is a part of code: *det_ptr++ = (float)(dx*dy – 0.81*dxy*dxy); where dx, dy,

  • 0

There is a part of code:

*det_ptr++ = (float)(dx*dy - 0.81*dxy*dxy);

where dx, dy, and dxy are floats.

Apple LLVM 3.0 compiler makes the following assembly for it:

+0x250  vldr.32                        s0, [r13, #+140]
+0x254  vldr.32                        s1, [r13, #+136]
+0x258  vmul.f32                       s0, s0, s1
+0x25c  vcvt.f64.f32                   d16, s0 <-------------- cast from float to double
+0x260  vldr.32                        s0, [r13, #+132]
+0x264  vcvt.f64.f32                   d17, s0 <-------------- cast from float to double
+0x268  vldr.64                        d18, [r13, #+16]
+0x26c  vmul.f64                       d17, d18, d17
+0x270  vldr.32                        s0, [r13, #+132]
+0x274  vcvt.f64.f32                   d19, s0 <-------------- cast from float to double
+0x278  vmul.f64                       d17, d17, d19
+0x27c  vsub.f64                       d16, d16, d17
+0x280  vcvt.f32.f64                   s0, d16
+0x284  ldr                            r0, [sp, #+104]
+0x286  adds                           r1, r0, #4  ; 0x4
+0x288  str                            r1, [sp, #+104]
+0x28a  vstr.32                        s0, [r0]

Is there any way to forbid these casts?

  • 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-27T22:13:40+00:00Added an answer on May 27, 2026 at 10:13 pm

    The way in which you wrote your program requires those casts. 0.81 is a double-precision literal, so dxy must be promoted to double before the multiplication takes place, and dx*dy must be promoted before the subtraction. The fact that you cast the final result back to float doesn’t matter–the C standard is perfectly clear that those terms are evaluated in double-precision regardless.

    To prevent the promotion to double, use a single-precision literal instead (by adding the f suffix):

    *det_ptr++ = dx*dy - 0.81f*dxy*dxy;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is the part of my code which works perfectly var image_mini = $('#map_mini');
I have the next question. There is part of code: $result = $this->find('all', array(
Is there any documentation or is there a part of the cecil source code
i have the following code part in one of my classes: $l = new
Reading Java Concurrency In Practice, there's this part in section 3.5: public Holder holder;
Is there someway to have a part of the page that renders like a
Is there a general way to implement part of an application with JavaScript and
Is there any built-in methods that are part of lists that would give me
Is there any way to get just a part from MySql cell and ignore
Are there any open source projects or part of codes using which its possible

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.