home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / mswindo / programm / misc / 3239 < prev    next >
Encoding:
Text File  |  1992-11-05  |  2.0 KB  |  57 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!usenet.ucs.indiana.edu!silver.ucs.indiana.edu!bdwheele
  3. From: bdwheele@silver.ucs.indiana.edu (Brian Wheeler)
  4. Subject: Re: OVERFLOW ERROR with Double in VB
  5. Message-ID: <Bx8y3B.LLM@usenet.ucs.indiana.edu>
  6. Sender: news@usenet.ucs.indiana.edu (USENET News System)
  7. Nntp-Posting-Host: silver.ucs.indiana.edu
  8. Organization: Indiana University
  9. References: <9211042127.AA24137@top.magnus.acs.ohio-state.edu>
  10. Date: Thu, 5 Nov 1992 14:11:35 GMT
  11. Lines: 44
  12.  
  13. In <9211042127.AA24137@top.magnus.acs.ohio-state.edu> John E Salter <salter@magnus.acs.ohio-state.edu> writes:
  14.  
  15.  
  16.  
  17. >What am doing wrong to cause the OVERFLOW ERROR.
  18. >If it is a VB problem, is there a work around?
  19. >I am trying to do logical ORing of bits in double numbers.
  20.  
  21.  
  22. >    Dim tbits As Double
  23. >    Dim sbits As Double
  24. >    Dim wbits As Double
  25. >    sbits = 0
  26. >    tbits = 2 ^ 36              'This statement is OK
  27. >    form1.Print sbits           'This is OK
  28. >    form1.Print tbits           'This is OK
  29. >    wbits = sbits Or tbits      'Produces OVERFLOW ERROR
  30. >    form1.Print sbits Or tbits  'Produces OVERFlOW ERROR
  31.  
  32.  
  33. >John Salter
  34. >salter.1@osu.edu
  35.  
  36. Logical operators work only on integers.  variables that are stored as Double
  37. have a format somthing like this:
  38.     SEEEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
  39. where:
  40.     S is the sign (1 bit)
  41.     E is the exponent (10 bits)
  42.     M is the mantissa (53 bits)
  43.  
  44. (I may be a little off on the bit counts)
  45.  
  46. so it doesn't make any sense to OR something with this because it isn't in a
  47. true binary number format.
  48. I suggest using LONG or INTEGER.  LONG is 32 bits (I think) and INTEGER is 16 
  49. bits, and both are signed.
  50.  
  51.     Hope this helps
  52. -- 
  53. ******************************************************************************
  54. * Brian 'Nautical' Wheeler - These are my opinions, do you hear me?  MINE!
  55. * "Wombats are our friends" - Me
  56. ******************************************************************************
  57.