Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Odd Behavior With Decimals

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

    Odd Behavior With Decimals

    I was going along so well and just ran into a problem I just cannot solve. I have a list of a 1000 invoices or so. I performed a tablesum on the amount field and I got an amount with 11 decimal points. Figuring that there must be a bad number somewhere I added just 100 records at a time until I narrowed this down to the offending record. I put the amount back in and saved, but no luck, it still comes out strange. So I deleted the amount for that record and changed it to $100. and all worked fine. So, I went back in and put the correct amount back in $22.62 and the eleven decimals came back again!

    Then I created a new field and using the update function copied each of the numbers in the amount field to another field amount2, but this time I used the round() function for 2 decimal points. Didn't seem to matter, the issue is still there.

    Does anyone have ANY idea about this????

    Charlie

    #2
    Re: Odd Behavior With Decimals

    It's just so much easier to work through these things with a sample table.
    There can be only one.

    Comment


      #3
      Re: Odd Behavior With Decimals

      Is the problem that:
      1-You got the wrong total with 11 decimals? or
      2-You got the correct total but wondering why 11 decimals?
      And where did you perform that? On a form? Report? Browse?
      Have you tried to enter 22.61 instead of 22.62 to see what happens?
      My gut feeling, this has to do with a corrupted form/record..don't think it has to do with the calculation itself unless you hit the jackpot by accident.
      Delete that record altogether, pack the table, update the indexes, compact your db then re-enter a new record with that value and see what happens.

      Comment


        #4
        Re: Odd Behavior With Decimals

        #2 I did the tablesum() in a script file. I did compact the whole app, but I'll try the other things and see what happens. Very odd behavior though!

        Charlie

        Comment


          #5
          Re: Odd Behavior With Decimals

          Its not atypical behaviour of the 8088 series processor. If you tablesum with a rounded result or format mask you wouldn't see it.

          Comment


            #6
            Re: Odd Behavior With Decimals

            It's kind of disconcerting though!






            Yes, I do bowl overhand!

            Comment


              #7
              Re: Odd Behavior With Decimals

              Shouldnt be - its standard floating point arithmetic, as long as you've been programming its been happening, you just view the numbers formatted at the level that Alpha functions handle it. It does a pretty good job doing so. You do need to know it exists so you dont get surprised.
              It can handle up to 18 decimals. I just entered random numbers in the IW, try this
              v=654.22*8765
              ?v
              = 5734238.3
              ?str(v,30,18)
              = "5734238.299999999800000" - thats what the value really contains
              Last edited by Ray in Capetown; 02-08-2014, 05:33 PM.

              Comment


                #8
                Re: Odd Behavior With Decimals

                Hmmm. Very surprised. I remember I came across this years ago and I guess I forgot about it. I would have thought that the tablesum function would have eliminated this somehow?

                Oh well!

                Comment


                  #9
                  Re: Odd Behavior With Decimals

                  maybe someone at AS forgot to attend to that one

                  Comment


                    #10
                    Re: Odd Behavior With Decimals

                    Charles said...
                    I would have thought that the tablesum function would have eliminated this somehow?
                    They can't read minds any better now than when you first came across this years ago :) The level of precision in a computed result varies from app to app and from person to person. Why would you think they'd automatically round the value at some smaller arbitrary number of places for all users?

                    Comment


                      #11
                      Re: Odd Behavior With Decimals

                      Before calling it an FPE and possibly mask a more sinister issue, these questions remain to be answered:
                      1-Decimals aside, are you getting the correct total?
                      2-Have you attempted 22.61 instead of 22.62?
                      Last edited by G Gabriel; 02-09-2014, 06:56 AM.

                      Comment


                        #12
                        Re: Odd Behavior With Decimals

                        Originally posted by Ray in Capetown View Post
                        Shouldnt be - its standard floating point arithmetic, as long as you've been programming its been happening, you just view the numbers formatted at the level that Alpha functions handle it. It does a pretty good job doing so. You do need to know it exists so you dont get surprised.
                        It can handle up to 18 decimals. I just entered random numbers in the IW, try this
                        v=654.22*8765
                        ?v
                        = 5734238.3
                        ?str(v,30,18)
                        = "5734238.299999999800000" - thats what the value really contains
                        Ray:
                        The decimals were rounded to 3. That's not an FPE.

                        Here is an illustration of FPE:
                        Code:
                        dim a as n=456.123
                        ?mod(a,1)
                        = 0.123
                        
                        [COLOR="#0000FF"]Well, anyone would agree, that is the correct answer[/COLOR]
                        But then try this:
                        Code:
                        dim a as n=123.456
                        ?mod(a,1)
                        = 0.456000000000003
                        
                        [COLOR="#0000FF"]There is your FPE. Do you see it[/COLOR]?
                        Last edited by G Gabriel; 02-09-2014, 07:00 AM.

                        Comment


                          #13
                          Re: Odd Behavior With Decimals

                          Yes G I kind of see, that is very specific. I'm just lumping rounding errors generally into one category not being too careful about the terminology.
                          Generally whatever the cause - there was an issue with the Pentium5 FPU too, I remember.

                          Comment


                            #14
                            Re: Odd Behavior With Decimals

                            Charles,

                            perhaps you'll find this article helpful. For me, though, it made my head start hurting!

                            Comment


                              #15
                              Re: Odd Behavior With Decimals

                              Really interesting article Tom. My head hurt too after reading it, but it seems to makes sense and to at least give us some idea of what is going on. My concern though is, if we can't get an exact answer to adding 100 or so values, then how are more complicated scientific calculations made possible, or do I have to get out my Cray?

                              Comment

                              Working...
                              X