Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Float mantissa, negative integer exponent

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
GTBecker



Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral

Posted: 15 February 2010, 20:32 PM    Post subject: Float mantissa, negative integer exponent Reply with quote

Code:
console.writeline(cstr((10.0^2.0)))  ' yields 100.0
console.writeline(cstr((10.0^-2.0))) ' yields 10.0E-3 = 0.01
console.writeline(cstr((10^2)))      ' yields 100
console.writeline(cstr((10^-2)))     ' yields 0 since cint(0.01)=0
console.writeline(cstr((10.0^2)))    ' yields 100.0
console.writeline(cstr((10.0^-2)))   ' yields &.& ?
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 15 February 2010, 23:33 PM    Post subject: Re: Float mantissa, negative integer exponent Reply with quote

GTBecker wrote:
Code:
console.writeline(cstr((10.0^-2)))   ' yields &.& ?
This occurs because integral constants are represented internally as unsigned 32-bit values so the effect is the same as 10.0 ^ &Hfffffffe. The fact that the negative sign is present is stored along with the constant so this probably can be made to work as you were expecting it to work.

In the mean time, you can force the desired behavior by making it clear that you want the exponent treated as a signed value, e.g.
Code:
console.writeline(cstr((10.0^CInt(-2))))
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group