Having a play around with the W7 calculator in 'programmer' mode.
Set radix to DEC and width to byte. Now try and enter 255. Set radix to HEX,keep width as byte enter FF No problem; now click on DEC you don't get 255, but -1 I recall that in XP the calculator had problems with some logarithms. Colin -- cdb, on 17/06/2010 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
> -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf > Of cdb > Sent: 17 June 2010 11:40 > To: [hidden email] > Subject: [OT]Windows 7 calculator can't count in binary! > > > Having a play around with the W7 calculator in 'programmer' mode. > > Set radix to DEC and width to byte. > > Now try and enter 255. > Set radix to HEX,keep width as byte enter FF > > No problem; now click on DEC you don't get 255, but -1 I don't have Windows 7 to check, but has anything been added to the calculator to enable hex values to be interpreted as signed? -1 is perfectly correct for an 8 bit signed value of 0xFF, but it's certainly different to the way the old XP calculator works (which would happily translate signed decimal to hex, but all hex to decimal conversions are unsigned). Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
:: has anything been added to the
:: calculator to enable hex values to be interpreted as signed? All is now clear - it treats all programming numbers as signed. In decimal I can enter 127 but not 128. However in hex or binary it works as unsigned. To me that seems like a piece of inconsistent programming. Colin -- cdb, [hidden email] on 17/06/2010 Web presence: www.btech-online.co.uk Hosted by: www.1and1.co.uk/?k_id=7988359 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by CDB-3
cdb wrote:
> Set radix to DEC and width to byte. > > Now try and enter 255. > Set radix to HEX,keep width as byte enter FF > > No problem; now click on DEC you don't get 255, but -1 So? -1 is just as correct as 255. You thought of it as a unsigned byte and they as a signed byte. Neither is wrong unless it was specified to be one or the other. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by CDB-3
Does it happen even if your number size set to qword or byte?
Tamas On Thu, Jun 17, 2010 at 11:40 AM, cdb <[hidden email]> wrote: > Having a play around with the W7 calculator in 'programmer' mode. > > Set radix to DEC and width to byte. > > Now try and enter 255. > Set radix to HEX,keep width as byte enter FF > > No problem; now click on DEC you don't get 255, but -1 > > I recall that in XP the calculator had problems with some logarithms. > > Colin > > -- > cdb, on 17/06/2010 > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- int main() { char *a,*s,*q; printf(s="int main() { char *a,*s,*q; printf(s=%s%s%s, q=%s%s%s%s,s,q,q,a=%s%s%s%s,q,q,q,a,a,q); }", q="\"",s,q,q,a="\\",q,q,q,a,a,q); } -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by Michael Rigby-Jones-2
-------------------------------------------------- From: "Michael Rigby-Jones" <[hidden email]> Sent: Thursday, June 17, 2010 12:27 PM To: "Microcontroller discussion list - Public." <[hidden email]> Subject: RE: [OT]Windows 7 calculator can't count in binary! > > >> -----Original Message----- >> From: [hidden email] [mailto:[hidden email]] On > Behalf >> Of cdb >> Sent: 17 June 2010 11:40 >> To: [hidden email] >> Subject: [OT]Windows 7 calculator can't count in binary! >> >> >> Having a play around with the W7 calculator in 'programmer' mode. >> >> Set radix to DEC and width to byte. >> >> Now try and enter 255. >> Set radix to HEX,keep width as byte enter FF >> >> No problem; now click on DEC you don't get 255, but -1 > > I don't have Windows 7 to check, but has anything been added to the > calculator to enable hex values to be interpreted as signed? > > -1 is perfectly correct for an 8 bit signed value of 0xFF, but it's > certainly different to the way the old XP calculator works (which would > happily translate signed decimal to hex, but all hex to decimal > conversions are unsigned). Yes, that was my guess too, but.. I'm on Vista with the old calculator - so I downloaded the win7 version from here: http://www.box.net/shared/y7tdnm9y2a#Windows7-calculator It looks like it is obviously treating all values as signed - ffff translates to -1 in word mode, fe ttranslates to -2 in byte etc. However, I can't see any setting to change this (maybe I'm not looking in the right place though) -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by CDB-3
At 08:07 AM 17/06/2010, you wrote:
>:: has anything been added to the >:: calculator to enable hex values to be interpreted as signed? > >All is now clear - it treats all programming numbers as signed. In decimal >I can enter 127 but not 128. > >However in hex or binary it works as unsigned. It's always treated as 2's complement signed, no? Where is the inconsistency? Did you find an operation where it's actually treated as unsigned? >To me that seems like a piece of inconsistent programming. > >Colin Well, it would be nice for those of us who program if it would allow a selection of 2's complement, 1's complement and unsigned as did the venerable HP16C hand-held calculator. But there are plenty of emulations of the HP16 around, some free. More annoying than that, at least for me, is that they created a new data display mode "DEC" which is a signed integer of whatever width, and eliminated the "DEC" in the XP calculator, which is really a floating point number. You can switch views to scientific and get the floating point but when you go back to convert to hex and maybe do some shifts or whatever, the calculator clears, so you have to pass the number through the clipboard. Ugly compared to the old way. Fortunately, the old XP calculator works fine in Win 7 64-bit, so I just copied it over. To see the difference, try to calculate something like the hex value of 32768*sin(x) where x = pi/4 or whatever, (answer is 0x5A82) >Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" [hidden email] Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by Oli Glaser
On Jun 17, 2010, at 5:25 AM, Oli Glaser wrote: > It looks like it is obviously treating all values as signed - ffff > translates to -1 in word mode, fe ttranslates to -2 in byte etc. > However, I > can't see any setting to change this I have "geekcalc" on my Mac, and it has separate settings for int32/ uint32, int8/uint8, etc and hex, decimal, octal, binary, float, ascii... BillW -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
Powered by Nabble | Edit this page |