Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #5301

Re: Shortint calculations

Newsgroups comp.lang.clipper.visual-objects
Date 2013-05-29 04:44 -0700
References <aa22a440-8e92-444c-9538-3488ccce999d@googlegroups.com> <0d515ec5-a6d5-4e1f-9ea8-13c5128f0798@googlegroups.com>
Message-ID <418e57c0-80db-420d-a98d-c3da4c19c2d9@googlegroups.com> (permalink)
Subject Re: Shortint calculations
From Mathias <mathias.hakansson@consultec.se>

Show all headers | View raw


Hi David,

no it's more complicated than this...

	? shortint(nA) > nD				// .T.
No surprise, as nA > nD also was true. nA is allready a shortint so this is expected.

	? shortint(nA) > nB - nC		// .F.
Expected...

	? nA > shortint(nD)				// .F.
What? nD is a shortint. Converting to a shortint should have no effect as nD allready is a shortint. 

	? shortint(nA) > shortint(nD)	// .F.

Strange ideed...

/MathiasH

Den tisdagen den 28:e maj 2013 kl. 16:15:04 UTC+2 skrev dlzc:
> Dear kvste...:
> 
> 
> 
> On Monday, May 27, 2013 8:53:43 AM UTC-7, kvste...@web.de wrote:
> 
> ...
> 
> > 	LOCAL nA, nB, nC AS SHORTINT
> 
> > 
> 
> > 	nA := 748
> 
> > 	nB := 22
> 
> > 	nC := 35
> 
> > 
> 
> > 	IF nA > ( nB - nC )
> 
> 
> 
> Here is the problem, the result of subtraction is NOT a shortint.  It is (probably) a long integer.  When compared to the shortint nA, the result of subtraction may be being truncated, rather than the result being demoted to a shortint, or nA being promoted to a long int.
> 
> 
> 
> > 		? "748 is greater than (22 - 35)"
> 
> > 	ELSE
> 
> > 		? "748 is not greater than (22 - 35). Oops!"
> 
> > 	ENDIF
> 
> 
> 
> It sure looks like a bug to me.
> 
> 
> 
> David A. Smith

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Shortint calculations kvstegemann@web.de - 2013-05-27 08:53 -0700
  Re: Shortint calculations Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-05-27 18:09 +0200
  Re: Shortint calculations dlzc <dlzc1@cox.net> - 2013-05-27 10:21 -0700
    Re: Shortint calculations Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-05-27 20:32 +0200
    Re: Shortint calculations kvstegemann@web.de - 2013-05-27 11:46 -0700
      Re: Shortint calculations Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-05-27 23:40 +0200
      Re: Shortint calculations "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-05-28 08:02 +0200
  Re: Shortint calculations Mathias <mathias.hakansson@consultec.se> - 2013-05-27 22:39 -0700
    Re: Shortint calculations Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-05-28 09:01 +0200
      Re: Shortint calculations kvstegemann@web.de - 2013-05-28 01:02 -0700
        Re: Shortint calculations Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-05-28 10:32 +0200
          Re: Shortint calculations kvstegemann@web.de - 2013-05-28 01:46 -0700
    Re: Shortint calculations Meinhard Schnoor-Matriciani <msm@appfact.de> - 2013-05-28 11:45 +0200
      Re: Shortint calculations Mathias <mathias.hakansson@consultec.se> - 2013-05-28 23:45 -0700
        Re: Shortint calculations "Er!k \\/!$$Er" <nospam@nospam.url> - 2013-05-29 16:57 +0200
          Re: Shortint calculations dlzc <dlzc1@cox.net> - 2013-05-29 09:33 -0700
  Re: Shortint calculations dlzc <dlzc1@cox.net> - 2013-05-28 07:15 -0700
    Re: Shortint calculations Mathias <mathias.hakansson@consultec.se> - 2013-05-29 04:44 -0700
      Re: Shortint calculations dlzc <dlzc1@cox.net> - 2013-05-29 07:25 -0700
  Re: Shortint calculations "Jamal" <jamal@examples.net> - 2013-05-29 17:18 -0400
    Re: Shortint calculations kvstegemann@web.de - 2013-05-30 01:47 -0700
      Re: Shortint calculations "Jamal" <jamal@examples.net> - 2013-05-30 13:19 -0400
  Re: Shortint calculations Meinhard Schnoor-Matriciani <msm@appfact.de> - 2013-05-30 22:05 +0200
    Re: Shortint calculations kvstegemann@web.de - 2013-05-31 03:43 -0700

csiph-web