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 867455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:58:44+00:00 2026-05-15T09:58:44+00:00

I found this code in NVIDIA’s CUDA SDK samples. void computeGold( float* reference, float*

  • 0

I found this code in NVIDIA’s CUDA SDK samples.

void computeGold( float* reference, float* idata, const unsigned int len)
{
    reference[0] = 0;
    double total_sum = 0;
    unsigned int i;
    for( i = 1; i < len; ++i)
    {
        total_sum += idata[i-1];
        reference[i] = idata[i-1] + reference[i-1];
    }
    // Here it should be okay to use != because we have integer values
    // in a range where float can be exactly represented
    if (total_sum != reference[i-1])
        printf("Warning: exceeding single-precision accuracy.  Scan will be inaccurate.\n");
}
//(C) Nvidia Corp

Can somebody please tell me a case where the warning would be printed, and most importantly, why.

  • 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-15T09:58:44+00:00Added an answer on May 15, 2026 at 9:58 am

    The function is written with a certain range of input data in mind. If that input data expectation isn’t met, the warning will print:

    #include <stdio.h>
    #define COUNT_OF(x) (sizeof(x)/sizeof(0[(x)]))
    
    void computeGold( float* reference, float* idata, const unsigned int len)
    {
        double total_sum = 0;
        unsigned int i;
    
        reference[0] = 0;
    
        for( i = 1; i < len; ++i)
        {
            total_sum += idata[i-1];
            reference[i] = idata[i-1] + reference[i-1];
        }
        // Here it should be okay to use != because we have integer values
        // in a range where float can be exactly represented
        if (total_sum != reference[i-1])
            printf("Warning: exceeding single-precision accuracy.  Scan will be inaccurate.\n");
    }
    //(C) Nvidia Corp
    
    
    float data[] = {
        1.0,
        2.0,
        3.0,
        4.0,
        5.0
    };
    
    float data2[] = {
        123456.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        999999.0,
        123456.0
    };
    
    float ref[COUNT_OF(data2)] = {0.0};
    
    int main()
    {
        computeGold( ref, data, COUNT_OF(data));
        computeGold( ref, data2, COUNT_OF(data2));
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 516k
  • Answers 516k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I was using build #133 i upgraded to #140 now,… May 16, 2026 at 6:51 pm
  • Editorial Team
    Editorial Team added an answer To be able to upload your application to appstore you… May 16, 2026 at 6:51 pm
  • Editorial Team
    Editorial Team added an answer Sure - check out svcutil.exe . From MSDN: The ServiceModel… May 16, 2026 at 6:51 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i found this code: protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource =
I found this code that goes through and prints out csv for both columns.
I found this code: this.Invoke(new EventHandler(EventGetSum)); Is this not the same as writing: EventGetSum();
I found this code in a RailsCast : def tag_names @tag_names || tags.map(&:name).join(' ')
I found this code below in a script, I am trying to figure out
I'v been trying to anti alias with OGL. I found a code chunk that
I have found this link: Detect Antivirus on Windows using C# However when I
I'm a little confused as to why this doesn't give an error. I found
I am running Windows 7 64bit, with Visual Studio 2008. I installed the CUDA
I'm getting this error: Only parameterless constructors and initializers are supported in LINQ to

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.