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

When is 5247029612727387904 = 5247029612727388200?

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

  • When is 5247029612727387904 = 5247029612727388200?

    Apparently, when you're in XBasic.

    Look, I'm not trying to be a wise guy and this could easily be a foolish error or lack of understanding on my part. And HOW I found this out or why I need to know is a separate issue.

    Could someone just check to see that I'm not going crazy? It should be sufficient to go to the interactive window, type DIM X as N = (the LHS), press carriage return, then type ?x and press the carriage return.

    I thought it might be me using the wrong variable type, perhaps a capacity issue, but it looks to me that the LHS is actually LESS THAN the RHS, so I don't know why the range of an N would be an issue. But, again, I'm not very good at bits and bytes and data types, so it could just be me doing something dumb.

    Wouldn't be the first time.

    Thanks for any information.

  • #2
    Re: When is 5247029612727387904 = 5247029612727388200?

    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

    Comment


    • #3
      Re: When is 5247029612727387904 = 5247029612727388200?

      Ahh, so we've established that, while perhaps not very skilled, I am at least not crazy.

      I'll tell my wife. Thanks.

      Of course this does nothing to help solve my original problem but I do appreciate the time you took to engage in this bizarre exercise and post the outcome.

      Comment


      • #4
        Re: When is 5247029612727387904 = 5247029612727388200?

        looks like that is the ceiling for numerical value

        Code:
        dim x as n = 5247029612727387904
        ?x
        = 5247029612727388200
        
        dim x1 as n
        x1 = 5247029612727388200 +12345678
        ?x1
        = 5247029612739733500
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


        • #5
          Re: When is 5247029612727387904 = 5247029612727388200?

          Well, something that on the surface looks funky is going on. Your last number is bigger than the RHS and it sort of looks like XBasic is trying to add your two numbers, but can't quite make it. So I have no idea what to say, except that I hope I wasn't at the limit of the N type, because in that case I won't be able to deal with certain dates.

          Thanks for playing.

          Comment


          • #6
            Re: When is 5247029612727387904 = 5247029612727388200?

            http://wiki.alphasoftware.com/Understanding+Data+Types

            What are you trying to achieve here? There's probably some alternative approach, but nothing to suggest unless we understand what you're doing.
            -Steve
            sigpic

            Comment


            • #7
              Re: When is 5247029612727387904 = 5247029612727388200?

              Originally posted by Steve Workings View Post
              http://wiki.alphasoftware.com/Understanding+Data+Types

              What are you trying to achieve here? There's probably some alternative approach, but nothing to suggest unless we understand what you're doing.
              OK. Thanks for the reference. I was trying to find that in the online documentation but couldn't.

              Bear with me, I'll explain. I am trying to call a function in a (.Net) DLL that requires, as one parameter, a System.DateTime set to Utc Kind. I created a T variable and attempted to set it to Utc. But the function kept returning an error complaining of an unexpected value for that parameter. So I decided to make the call using C#, using the exact same date parameters, and it
              worked fine. What was the difference in the System.DateTime variable? I used the ToBinary method to try and find out if XBasic was actually setting the upper two bits properly to indicate Utc. The LHS of the subject was the output of ToBinary in C#, the RHS the output of ToBinary in XBasic. So as a test I decided to simply try and set an N variable to the C# output, use FromBinary to get an XBasic T variable and try the call again. The point is, I can't. There may be a very good reason for that but then the question becomes how to handle this problem. AFAIK the 64 bit representation of a System.DateTime is independent of language (e.g. XBasic, C#) so how would I create one for which that representation falls outside the range of XBasic's N variable?

              I'm not saying there isn't a way to handle this, perhaps it's a simple issue to those more skilled than I am. I'd just like to know what it is.

              Thanks for your post.

              Comment


              • #8
                Re: When is 5247029612727387904 = 5247029612727388200?

                It's pretty hard to imagine what you're doing here. But is this helpful?:

                http://wiki.alphasoftware.com/DotNet...:+Big+Integers
                -Steve
                sigpic

                Comment


                • #9
                  Re: When is 5247029612727387904 = 5247029612727388200?

                  Originally posted by Steve Workings View Post
                  It's pretty hard to imagine what you're doing here. But is this helpful?:

                  http://wiki.alphasoftware.com/DotNet...:+Big+Integers
                  Steve:

                  Yea, well, it was late and I was tired, so probably my "explanation" could have been better, sorry. Let me put it this way, simply.

                  I need to create a System.DateTime object representing, for example, 4/29/2014 at 9h 10m 30s and with SystemKind set to Utc. That's it.

                  My limited (both in time and skill) experimentation leads me to believe it can't be done. The reason is that the binary (64 bit) representation of this System.DateTime object is the LHS of my subject. That number appears not to be representable in Alpha's XBasic N variable. So when I TRY to create this date with, say,

                  dim myTimeUTC as ::System::DateTime = ::System::DateTime(2014,4,29,9,10,30,::System::DateTimeKind::Utc)
                  bitUtc = myTimeUTC.ToBinary()

                  bitUtc ends up being the RHS of the numbers in the subject which (if C# is correct, and I'm assuming it is because the DLL doesn't barf when it's called from C#) is NOT the binary representation of my Utc date. What it does represent, if anything, is anyone's guess. Maybe setting the upper two bits for Utc throws the binary representation out of the range of N, I don't know (just a guess).

                  Thus, to sum, I just want to create a System.DateTime object with a Utc Kind (and then pass it to the function as a T, of course) and I can't seem to do that.

                  Your reference is interesting, but I don't offhand see how I can incorporate it to solve my problem since what I'm trying to do is intercept Alpha's internal date handling routines. But, again, I could be wrong.

                  Thanks for taking the time to post.
                  Last edited by nlk10010; 04-29-2014, 09:45 AM.

                  Comment


                  • #10
                    Re: When is 5247029612727387904 = 5247029612727388200?

                    Alpha Anywhere is a 32-bit program, so it does not have a native 64-bit numeric type. But as shown in the link provided by Steve Workings, you can use a .Net BigInteger to work with larger values. If you want to use a 64-bit representation of anything, you will need to use this approach.

                    However, you're jumping through uneccesary hoops here. You can specify the DateTimeKind in the constructor to have your UTC DateTime:

                    Code:
                    dim dt_utc as System::DateTime = new System::DateTime(0,System::DateTimeKind::Utc)
                    See http://msdn.microsoft.com/en-us/libr...v=vs.100).aspx for more details on the DateTime constructors.

                    Lenny Forziati
                    Vice President, Internet Products and Technical Services
                    Alpha Software Corporation

                    Comment


                    • #11
                      Re: When is 5247029612727387904 = 5247029612727388200?

                      Questions of precision and rounding in Alpha have come up before. Maybe it would add some clarification if the Alpha documentation specified that xbasic is using the IEEE 32-bit floating point format for variables of type N?

                      The conversion of Norman's Left-hand-side number to floating point and back to a display value which results in the right-hand-side number is easily confirmed as expected behavior for IEEE floating point numbers with the following online number conversion tool:

                      http://babbage.cs.qc.cuny.edu/IEEE-754.old/Decimal.html

                      Comment


                      • #12
                        Re: When is 5247029612727387904 = 5247029612727388200?

                        Originally posted by Lenny Forziati View Post
                        Alpha Anywhere is a 32-bit program, so it does not have a native 64-bit numeric type. But as shown in the link provided by Steve Workings, you can use a .Net BigInteger to work with larger values. If you want to use a 64-bit representation of anything, you will need to use this approach.

                        However, you're jumping through uneccesary hoops here. You can specify the DateTimeKind in the constructor to have your UTC DateTime:

                        Code:
                        dim dt_utc as System::DateTime = new System::DateTime(0,System::DateTimeKind::Utc)
                        See http://msdn.microsoft.com/en-us/libr...v=vs.100).aspx for more details on the DateTime constructors.
                        Lenny:

                        Two things.

                        First, I don't want to work with 64-bit anything, I want to work with System.DateTime objects which "want to work with 64-bit things".

                        Second, I understand your code, if you look at my last message you will see that is in effect the code I use to create my "P" object (which points to the System.DateTime struct). It is set to SystemKind Utc. Unfortunately, you can't pass the "P" as an argument, at least to any DLL function I've worked with. The function is looking for the 64-bit representation of that date which, as you know, has the Kind encoded, I believe, in the first two bits. From my experiments, you can't generate, within XBasic, that representation, and that's the ONLY thing you can pass as a System.DateTime argument.

                        When you try something like

                        Code:
                        dim myTimeUTC as ::System::DateTime = ::System::DateTime(2014,4,29,9,10,30,::System::DateTimeKind::Utc)
                        time = myTimeUTC.ToUniversalTime()
                        you do end up with a T variable which the function accepts but kicks back, complaining of an unexpected value. My guess is that time is not in the 64-bit format the function expects; in particular, it doesn't have its upper two bits set to indicate UTC. I've tried various methods in the second line, thinking that perhaps the bits are being set incorrectly, but no matter which ".To" method I use the function barfs. Note I have successfully passed T variables corresponding to System.DateTime structs to other functions in this DLL, but those did not require that the date have a kind of Utc. Hence my focus on SystemKind.

                        So I wish I were jumping through unnecessary hoops here (or unnecessarily jumping through hoops, as you wish). If you can show me how to generate a T variable encoded as Utc, I would be grateful.

                        Thanks for the post and for trying to help me out.
                        Last edited by nlk10010; 04-29-2014, 12:04 PM.

                        Comment


                        • #13
                          Re: When is 5247029612727387904 = 5247029612727388200?

                          Originally posted by RichCPT View Post
                          Questions of precision and rounding in Alpha have come up before. Maybe it would add some clarification if the Alpha documentation specified that xbasic is using the IEEE 32-bit floating point format for variables of type N?

                          The conversion of Norman's Left-hand-side number to floating point and back to a display value which results in the right-hand-side number is easily confirmed as expected behavior for IEEE floating point numbers with the following online number conversion tool:

                          http://babbage.cs.qc.cuny.edu/IEEE-754.old/Decimal.html
                          RichCPT: That's fine, I have no issue with that. I suppose I left the impression in my OP that I was playing a game and wanted to "call out" XBasic for generating a nonsense result. That wasn't my intention, believe me. I'm very impressed, from certain perspectives, with Alpha and that's why I'm trying so hard to make it work for my application.

                          My wish, as stated elsewhere, is simply to generate a T variable representing a System.DateTime object of Utc kind. That's all. I just can't seem to do it.

                          Thanks for the post.

                          Comment


                          • #14
                            Re: When is 5247029612727387904 = 5247029612727388200?

                            Norman, I am still very unclear on what you ultimately want/need to do. Xbasic T variables have no time zone encoding, so you will never be able to create one that is encoded as UTC. Why are you trying to create a T from your System::DateTime and manipulate it that way?

                            If you have a method that takes a System::DateTime, you should be able to pass it directly. If you have a method that takes the Int64 number of ticks, use the Ticks property of your DateTime instance (e.g. myTime.Ticks).


                            Also your examples have a syntax error in them. You need the new keyword after the = in your dim statements. See my previous post for the exact placement.

                            Lenny Forziati
                            Vice President, Internet Products and Technical Services
                            Alpha Software Corporation

                            Comment


                            • #15
                              Re: When is 5247029612727387904 = 5247029612727388200?

                              Originally posted by Lenny Forziati View Post
                              Norman, I am still very unclear on what you ultimately want/need to do. Xbasic T variables have no time zone encoding, so you will never be able to create one that is encoded as UTC. Why are you trying to create a T from your System::DateTime and manipulate it that way?

                              If you have a method that takes a System::DateTime, you should be able to pass it directly. If you have a method that takes the Int64 number of ticks, use the Ticks property of your DateTime instance (e.g. myTime.Ticks).


                              Also your examples have a syntax error in them. You need the new keyword after the = in your dim statements. See my previous post for the exact placement.
                              Lenny:

                              Well, yes, I noticed that, it doesn't seem to make a difference (to Alpha or to the DLL) but I have tried it both ways. Thanks.

                              What I want to do is call a DLL function. The function expects two arguments: The first is an array of bytes and the second is of valuetype System.DateTime, encoded as UTC. It IS passed as ticks, but the ticks are the last 62 bits, the first two represent the encoding. That's not me, that's .NET. Disclaimer: you are the expert, not me, so if I'm mistaken about this I apologize. But I only know what I read. :)

                              The DLL is "DotNetOpenAuth.DLL" (freely available), the function is a constructor for CryptoKey. I can't get the System.DateTime argument to be accepted. I don't know what else to say. Again, COULD it be me? Sure. But I don't know what else I can try.

                              This may be beyond one (or both) of two things: My ability to explain and Alpha's ability to work with certain .Net valuetypes. My money is on the former but I have to allow for the latter.

                              Comment

                              Working...
                              X