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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:04:03+00:00 2026-06-02T20:04:03+00:00

I’m currently working on the following code: for (double i = 0.00; i <

  • 0

I’m currently working on the following code:

    for (double i = 0.00; i < 5; i += 0.01)
        {
            cmd.CommandText = "SELECT " +
            "COUNT(DISTINCT(ActualAFR)) " +
            "FROM tblBaseLog AS tBL " +
            "INNER JOIN tblSettings AS tSET " +
            "ON tBL.RPM = tSET.RPM " +
            "WHERE MAFVoltage = " + i + " AND " +
            "(tBL.AccelPedalPos > tSET.APPTransition OR " + 
            "tBL.CalculatedLoad > tSET.LoadTransition)";

            int trimCount = Convert.ToInt32(cmd.ExecuteScalar().ToString());

The problem I’m having is specific to the WHERE clause comparison on the last line of the query (specifically tBL.CalculatedLoad > tSET.LoadTransition).

  1. This query as it sits returns one result from my existing data set; this result is correct, but is not the expected full data set.

  2. If I flip the operand (from greater than to less than) I get an expected but unverified result (basically lots of data points).

  3. Strangest of all, if I start the for loop out at a higher value (for double i = 4.00;…etc), I get more results than before.

Now that I’ve clarified what is happening, here is the relevant information pertaining to the structure/contents of the databases that are being used:

  1. The table data types for everything are set to REAL except RPM which is just a plain INTEGER.

  2. The result for tBL.AccelPedalPos > tSET.APPTransition will never return as true (don’t ask, it doesn’t matter at this time and yes I’ve removed it from the query to no avail) so it isn’t a factor

  3. The value for tSET.LoadTransition is pretty much always 1 except early in the log where it is 1.1

  4. The value for tBL.Calculated Load varies between .2 and 2, with hundreds of iterations of decimal values that are greater than the flat 1.0 it should be comparing to.

It’s probably something ridiculously simple that I’m missing, but after re-writing the query a few dozen times, I’m breaking down and asking for help here.

It may also be worth noting that my computer has one of the “fixed” AMD TLB bug processors; however, I have tested a compiled version of the app on a laptop running a Core 2 Duo with the same exact result.

Any input would be appreciated.

  • 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-06-02T20:04:04+00:00Added an answer on June 2, 2026 at 8:04 pm

    Floating point values behave differently from integer values; your loop from 0.00 to 5 will never yield a value of 4.0 for i.

    You may want to either specify a range for the MAFVoltage (> last_value_of_i AND <= current_value_of_i) or use decimal for integer-like accuracy.

    To verify that the issue I’m talking about is what happens in your case, log the CommandText property for the first time i is larger than 4 – it should report something like WHERE MAFVoltage = 4.0099999999999589.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.