# Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

10 messages
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 On Monday 23 October 2017 10:40 AM, RedTigerFish wrote: >           Transcript show: 'aa='. Transcript show: 23124234 * 431213; cr. > > The output is aa=9971470315842 9971470315842 is a decimal number. What > can I do to display a number in any hex I want ?? Transcript show: (23124234 * 431213) hex; cr You can discover such functions by giving an example in Method Finder. For instance 23 is represented as 16r17 in hex, so:     23 . '16r17' will reveal the method. For any radix, see printStringBase: method. HTH .. Subbu _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 Hello, thanks for your answer. Here is my thinking: Transcript show: (23124234 * 431213) hex; cr The above code only displays a decimal in hexadecimal which is base-16. Now I want a decimal number to be displayed in base-17 or 20 or 100 or 250 or any positive integer. How can I do that? Is that possible in Smalltalk? I tried "Method Finder" and typed in Selector Browser "23 . '17r16' , only to get the warning: no single method does that function. Any method I can solve this problem ? -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell.
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 On Monday 23 October 2017 04:40 PM, RedTigerFish wrote: > Hello, thanks for your answer. > > Here is my thinking: > > Transcript show: (23124234 * 431213) hex; cr > > The above code only displays a decimal in hexadecimal which is base-16. > Now I want a decimal number to be displayed in base-17 or 20 or 100 or 250 > or any positive integer. > How can I do that? Is that possible in Smalltalk? Yes, with printStringBase: method     Transcript show: ((23124234 * 431213) printStringBase: 17); cr HTH .. Subbu _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 Thanks. That is what I want. But when I type: Transcript show: ((2423460) printStringBase: 250); cr. A "MessageNotUnderstood" window pops up. Is there a maximal base for displaying numbers? ----- Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell. -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell.
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 On Mon, Oct 23, 2017 at 1:27 PM, RedTigerFish wrote:Thanks. That is what I want. But when I type: Transcript show: ((2423460) printStringBase: 250); cr. A "MessageNotUnderstood" window pops up. Is there a maximal base for displaying numbers?​Yes, the maximum base is 36, because we only use 0-9 and A-Z as digits:\$Z digitValue=> 35For larger bases you would have to invent your own digits.Even digits beyond F (hexadecimal 15) are non-standard, and are allowed more as a syntactic curiosity than as something with a real application.The only somewhat commonly used bases are 2, 8, 10, 13, and 16, as far as I know.- Bert -​ _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners
Open this post in threaded view
|

## In Squeak SmallTalk, what can I do to display a number in any hex I want?

 In reply to this post by RedTigerFish Hi, I get the feeling you are asking the wrong question.  Can you tell us more about what you are trying to do. Lou On Mon, 23 Oct 2017 04:27:15 -0700 (MST), RedTigerFish <[hidden email]> wrote: >Thanks. That is what I want. > >But when I type: > >Transcript show: ((2423460) printStringBase: 250); cr. > >A "MessageNotUnderstood" window pops up. > >Is there a maximal base for displaying numbers? > > > > > >----- >Dig, dig where you are, >Down below's well. >Let those that walk in darkness shout, >Down below's hell. -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 In reply to this post by Bert Freudenberg On Mon, Oct 23, 2017 at 10:32 AM, Bert Freudenberg wrote:The only somewhat commonly used bases are 2, 8, 10, 13, and 16, as far as I know.- Bert -​ Hi.I haven't run across a reason to use base 13.  What domain was that in?  Just curious,cbc _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners
Open this post in threaded view
|

## Re: In Squeak SmallTalk, what can I do to display a number in any hex I want?

 On Tue, Oct 24, 2017 at 5:14 PM, Chris Cunningham wrote:On Mon, Oct 23, 2017 at 10:32 AM, Bert Freudenberg wrote:The only somewhat commonly used bases are 2, 8, 10, 13, and 16, as far as I know.- Bert -​ Hi.I haven't run across a reason to use base 13.  What domain was that in?  Just curious,cbc​The answer is 42.;)- Bert - _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners