Announcement

Collapse
No announcement yet.

Rounding issue ?!?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    As stevehare2003 explained, there are technical reasons why the rounding occurs. Genspoo gave an accurate description of how data is transmitted, and the likely cause is missing base code.

    As stated earlier, to make your code snippet work, simply change the conditional statement to:

    If (Round(CurrentPrice), 6) == 1.275)

    and, BOOM! - the condition is met.

    In eSignal, the application itself has logic to determine how many decimal places to display, so the issue is never apparent.


    I feel we have offered an explanation of why this situation occurs and a perfectly efficient way to avoid the problem. I do not feel there is anything left to discuss and would like to concentrate my finite resources on other problems.

    Comment


    • #17
      Originally posted by eSignal Robi
      As stevehare2003 explained, there are technical reasons why the rounding occurs. Genspoo gave an accurate description of how data is transmitted, and the likely cause is missing base code.

      As stated earlier, to make your code snippet work, simply change the conditional statement to:

      If (Round(CurrentPrice), 6) == 1.275)

      and, BOOM! - the condition is met.

      In eSignal, the application itself has logic to determine how many decimal places to display, so the issue is never apparent.


      I feel we have offered an explanation of why this situation occurs and a perfectly efficient way to avoid the problem. I do not feel there is anything left to discuss and would like to concentrate my finite resources on other problems.
      Thanks for the reply. I am well aware how to fix your problem.

      I'll be blunt. 1.275 as a double is 1.2749999999999999 and not 1.2750000000000001, which is the value esignal is transmitting. Frankly, I’m not bother why the value is wrong, it still doesn’t change the fact it’s wrong.

      To get the correct value, we your users and customers have to round. In other words, we have to fix your error.

      Clearly you don’t think this is a major issue, even though I have given you an example of where this error becomes significant. Since you are unable to fix it, I suggest you proactively tell all your users and customers that they need to round all your values if they might be using them in numeric calculations that test for equality without an epsilon. It would be a good idea to add the solution "round all values from esignal" and add it to documentation while your at it.

      Cheers,

      Red.

      Comment


      • #18
        No, I do not feel this is a MAJOR issue since only one user reported a single price that was not cleanly converted to a floating number, which I cannot replicate. I would consider a major issue one that affects the majority of our customers, like the T&S I was able to correct in 7.7 or this situation occuring very frequently. Simply put, this was an outlier.

        I also do not feel it should be added to our documentation, as only a few users are experiencing this as a problem for their specific use of our data. This forum is a place for developers to identify issues and read about either ways around them or eSignal's progress on corrections.

        In my own applications that use market data, I run a few logical checks to ensure that there was not corruption of data either by the vendor, during transmission or my own application logic. I suggest developers relying on ANY data to perform such validation tests to strengthen their application.

        Comment


        • #19
          Rob, the rounding function you specified may work for VB, how you suggest that in C/C++ ? This is a nasty rounding issue which i faced and realised IEEE/Intel floating point representation would never always give me double data correctly. So I had to rely on adding/substracting a "delta" before doing actual "=" or "<" or ">" operations.

          Sincere request is esignal should return double data only till 5th decimal place which should cater all forex and equity market. And this would take away lot of ambuigity and testing efforts too.

          Comment


          • #20
            When in doubt, Google it out.

            Here is one example page that provides a C++ function to round doubles to a requested precision.



            Cheers... George

            Comment


            • #21
              chimanshu,

              These different method to round in C/C++ may apply, http://msdn.microsoft.com/library/de...RoundTopic.asp

              Comment


              • #22
                Cannot find 'Round()'

                I saw the posting which suggested the way 'round the rounding problem was to use the following construct:

                If (Round(CurrentPrice), 6) == 1.275)

                I have included it in my code but get:

                ReferenceError: Round is not defined.

                What am I missing? Is there something I need to download to get this to work?

                PS. I too feel that the prices I receive into my efs() code via high(), close(), etc. should be valid for the symbol. This has caused me enormous problems in trying to determine when a price is touched in a trade simulation script I have laboured over.

                Comment


                • #23
                  Hi griesha30246,

                  This is a Desktop API Development thread, so depending on what programming language you are using the methods may be different. If you are referring to efs coding, I would code it as follows:

                  If (CurrentPrice.toFixed(3)*1) == 1.275)

                  where CurrentPrice.toFixed(3)* rounds to the 3rd decimal points and converts to a string. Multiplying by 1 then converts the string to a number.

                  Comment

                  Working...
                  X