Re: [Newbies] How to doubble sort a collection

2015-02-04 Thread Raymond Asselin
Thank to everybody because I learned a lot here
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to doubble sort a collection

2015-02-04 Thread Raymond Asselin
I finaly found the problem witch was not in the code suggest but behind the 
keyboard.

In fact when the time is generated everything is good , when i entered it by 
hand = this is a String.
So I had in the sorting code:  
> ^notes sort:[:a :b | (a date = b date) and:[a temps asTime > b temps asTime 
> ]] .




> Le 2015-02-04 à 14:40, Chris Cunningham  a écrit :
> 
> You have a logic issue with the first one:
> sortedNotes
> ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
> This is saying that the the two dates are different, then false.  For this 
> you probably want to be something like:
> sortedNotes
> ^notes sort:[:a :b | a date > b date or: [(a date = b date) and:[a temps > b 
> temps]]] .
> 
> -cbc
> 
> On Wed, Feb 4, 2015 at 10:22 AM, Raymond Asselin  > wrote:
> For now I implemented:
> 
> sortedNotes
> ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
> 
> AND
> 
> notesSorted
> ^notes sort:[:a :b | a date = b date
> ifTrue:[a temps > b temps]
> ifFalse:[a date > b date]] .
> 
> does exactly the same result.
> 
> But there is still notes in a same date that do not sort correctly, the 
> begining is good and after 5 or so objects
> I get some witch do not seem to be sorted.
> 
> BTW don't know the difference between sort:  and sorted:
> it seems as if the last one produce a new collection and the first one 
> produce same collection but sorted.
> 
> Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?
> 
> > Le 2015-02-04 à 12:00, Paul DeBruicker  > > a écrit :
> >
> > a date = b date
> >   ifTrue:[a temps > b temps]
> >   ifFalse:[a date > b date]
> 
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org 
> 
> http://lists.squeakfoundation.org/mailman/listinfo/beginners 
> 
> 
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to doubble sort a collection

2015-02-04 Thread Paul DeBruicker
Are your temps stored as strings? Strings that are numbers aren't coerced to
numbers before comparison.  

e.g. in a workspace



'765' > '1230'  

prints true and   


765 > 1230 


prints false.








Raymond Asselin-4 wrote
>> Le 2015-02-04 à 13:33, Tobias Pape <

> Das.Linux@

> > a écrit :
>> 
>> 
>> can you give an example?
>> 
> 
> 
> ___
> Beginners mailing list

> Beginners@.squeakfoundation

> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> 
> 
> SortedNotesExample.png (62K)
> ;





--
View this message in context: 
http://forum.world.st/How-to-doubble-sort-a-collection-tp4803657p4803794.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to doubble sort a collection

2015-02-04 Thread Chris Cunningham
You have a logic issue with the first one:
sortedNotes
^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
This is saying that the the two dates are different, then false.  For this
you probably want to be something like:
sortedNotes
^notes sort:[:a :b | a date > b date or: [(a date = b date) and:[a temps >
b temps]]] .

-cbc

On Wed, Feb 4, 2015 at 10:22 AM, Raymond Asselin  wrote:

> For now I implemented:
>
> sortedNotes
> ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
>
> AND
>
> notesSorted
> ^notes sort:[:a :b | a date = b date
> ifTrue:[a temps > b temps]
> ifFalse:[a date > b date]] .
>
> does exactly the same result.
>
> But there is still notes in a same date that do not sort correctly, the
> begining is good and after 5 or so objects
> I get some witch do not seem to be sorted.
>
> BTW don't know the difference between sort:  and sorted:
> it seems as if the last one produce a new collection and the first one
> produce same collection but sorted.
>
> Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?
>
> > Le 2015-02-04 à 12:00, Paul DeBruicker  a écrit :
> >
> > a date = b date
> >   ifTrue:[a temps > b temps]
> >   ifFalse:[a date > b date]
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to doubble sort a collection

2015-02-04 Thread Paul DeBruicker
Proably because you're using #> and not #>=.  If not that post the list of
dates/times that don't sort properly. 



also - #sort: & #sort sort in place.  #sorted & sorted: make a new copy as
you've seen.  If your objects should always sort the same way just implement
#<= in the instance side of your object and then you can use #sort or
#sorted without having to add a sort block.








Raymond Asselin-4 wrote
> For now I implemented:
> 
> sortedNotes
> ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
> 
> AND
> 
> notesSorted
> ^notes sort:[:a :b | a date = b date 
>   ifTrue:[a temps > b temps] 
>   ifFalse:[a date > b date]] . 
> 
> does exactly the same result.
> 
> But there is still notes in a same date that do not sort correctly, the
> begining is good and after 5 or so objects
> I get some witch do not seem to be sorted.
> 
> BTW don't know the difference between sort:  and sorted: 
> it seems as if the last one produce a new collection and the first one
> produce same collection but sorted.
> 
> Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?
> 
>> Le 2015-02-04 à 12:00, Paul DeBruicker <

> pdebruic@

> > a écrit :
>> 
>> a date = b date 
>>   ifTrue:[a temps > b temps] 
>>   ifFalse:[a date > b date]
> 
> ___
> Beginners mailing list

> Beginners@.squeakfoundation

> http://lists.squeakfoundation.org/mailman/listinfo/beginners





--
View this message in context: 
http://forum.world.st/How-to-doubble-sort-a-collection-tp4803657p4803711.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to doubble sort a collection

2015-02-04 Thread Raymond Asselin



> Le 2015-02-04 à 13:33, Tobias Pape  a écrit :
> 
> 
> can you give an example?
> 

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to doubble sort a collection

2015-02-04 Thread Tobias Pape

On 04.02.2015, at 19:22, Raymond Asselin  wrote:

> For now I implemented:
> 
> sortedNotes
> ^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
> 
> AND
> 
> notesSorted
> ^notes sort:[:a :b | a date = b date 
>   ifTrue:[a temps > b temps] 
>   ifFalse:[a date > b date]] . 
> 
> does exactly the same result.

sounds strange.
Probably you don't want to store date and time separated but as 
DateAndTime instances, then you just have to sort them by that.
Look at that class.
  Also, you can see that Date is a subclass of Timespan,
which implies a duration: a Date is a timespan of one day. You
probably don't want that if you compare them like above.


> 
> But there is still notes in a same date that do not sort correctly, the 
> begining is good and after 5 or so objects
> I get some witch do not seem to be sorted.

can you give an example?

> 
> BTW don't know the difference between sort:  and sorted: 
> it seems as if the last one produce a new collection and the first one 
> produce same collection but sorted.
> 

exactly.
#sorted: is like saying
“Give me this, but sorted” and this “give me” typically results in a 
new collection.
#sort: is like saying
“You! Sort yourself!” and implies mutation
(a bit like set! in scheme or sort! in ruby)


> Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?

see above


BEst
-Tobias___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to doubble sort a collection

2015-02-04 Thread Raymond Asselin
For now I implemented:

sortedNotes
^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .

AND

notesSorted
^notes sort:[:a :b | a date = b date 
ifTrue:[a temps > b temps] 
ifFalse:[a date > b date]] . 

does exactly the same result.

But there is still notes in a same date that do not sort correctly, the 
begining is good and after 5 or so objects
I get some witch do not seem to be sorted.

BTW don't know the difference between sort:  and sorted: 
it seems as if the last one produce a new collection and the first one produce 
same collection but sorted.

Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?

> Le 2015-02-04 à 12:00, Paul DeBruicker  a écrit :
> 
> a date = b date 
>   ifTrue:[a temps > b temps] 
>   ifFalse:[a date > b date]

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection - DynamicSortBlock.st (1/1)

2015-02-04 Thread Louis LaBrunda

begin 644 DynamicSortBlock.st
M#0I/8FIE8W0@6YA;6EC4V]R=$)L;V-K#0H@("`@8VQA
M
M*'-E;&8@;F5W*2!A8V-E2!I6UB;VQS*2!U6UB;VP@
M:6X@86-C97-S;W)S+"!T6UB;VP-"@DB268@86X@87-S;V-I871I;VXL(&%D9"!T
M:&4@86-C97-S;W(@86YD(&1I6UB;VP@:7-3>6UB;VP@:694
M6UB;VP@=F%L=64N#0H)72X-"B$-"@T*861D06-C97-S;W(Z(&%3
M>6UB;VP@86YD1&ER96-T:6]N.B!A0F]O;&5A;D]R4W1R:6YG#0H)(D%D9"!T
M:&4@86-C97-S;W(@86YD(&ET6UB;VP-"@DB061D('1H
M92!A8V-E6UB;VPN#0H)"!C;&%S9&ER96-T:6]N6UB;VP@:6X@86-C
M97-S;W)S+"!T71H:6YG#0H);W1H97(@
M=&AA;B!TF4@;V8@86-C97-S;W)S+B(-"@DB4V5E("-D:7)E8W1I
M;VYS(&%N9"`C=F%L=64Z=F%L=64Z(@T*"7P@<&%I2X-"@EA9&1#;G0@.CT@'10=71!;&PZ(&%C8V5S3H@86-C
M97-S;W(@=F%L=64Z(&1I2!T:&4@86-C97-S;W)S(&%R92!T9&ER96-T:6]N72X-"@D)"79A;'5E0B!I9&ER96-T:6]N(&YO=%TN#0H)"0DH=F%L=65!(#P@=F%L=65"*2!I
M9E1R=64Z(%M>9&ER96-T:6]N72X-"@D)"2AV86QU94$@/B!V86QU94(I(&EF
M5')U93H@6UYD:7)E8W1I;VX@;F]T72X-"@D)72X-"@E=+@T*"5YThttp://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection

2015-02-04 Thread Louis LaBrunda
Hi Raymond,

Try:

^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
temps > b date temps))].

Lou

On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin 
wrote:

>I have this kind of sorting on anOrderedCollection
>
>BlocNotes >>sortedNotes
>   ^notes sorted:[:a :b | a date  > b date]
>
>This sort my notes on date but I want them sort by date AND inside a date by 
>hours and I don't khow how to do this.
>
>Some insights?
>
>aNote = 'med com date temps' instancesVariables what I call hours = temps 
>witch is a number like 2123 for 21h23
>
>Some insights?
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection - DynamicSortBlock.st (0/1)

2015-02-04 Thread Louis LaBrunda
On Wed, 4 Feb 2015 09:00:13 -0800 (PST), Paul DeBruicker
 wrote:

>Does using the | or & notation have any advantages over and: or or:  or
>ifTrue:ifFalse ?

and: and or: are needed when you don't want to execute the code inside the
block unless it is needed.  They are also used to protect from executing
code that shouldn't be run for example:

x notNil and: [x foo > y foo]

>I always write expressions like the one you've written like:

>a date = b date 
>   ifTrue:[a temps > b temps] 
>   ifFalse:[a date > b date]

I like this but it may be a little tricky for a beginner.  But both or
replay help one to learn.

I have also attached a file out (from VA Smalltalk) of a class that acts
like a sort block but is much easier to use for complex sorts.

Lou

>Louis LaBrunda wrote
>> Hi Raymond,
>> 
>> Try:
>> 
>> ^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
>> temps > b date temps))].
>> 
>> Lou
>> 
>> On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin <
>
>> jgr.asselin@
>
>> >
>> wrote:
>> 
>>>I have this kind of sorting on anOrderedCollection
>>>
>>>BlocNotes >>sortedNotes
>>> ^notes sorted:[:a :b | a date  > b date]
>>>
>>>This sort my notes on date but I want them sort by date AND inside a date
>by hours and I don't khow how to do this.
>>>
>>>Some insights?
>>>
>>>aNote = 'med com date temps' instancesVariables what I call hours = temps
>witch is a number like 2123 for 21h23
>>>
>>>Some insights?
>> ---
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>> mailto:
>
>> Lou@
>
>>  http://www.Keystone-Software.com
>> 
>> ___
>> Beginners mailing list
>
>> Beginners@.squeakfoundation
>
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: How to doubble sort a collection

2015-02-04 Thread Chris Cunningham
| and & make sure that each expression between them is executed - so it
will do each of:
   a date  > b date
and
   a date = b date
and
   a date > temps > b date temps

This matters if one of these is significantly slower than the others - it
will run it even it it doesn't need too.  Also if any side-effects are in
one of these expressions, this will make that side effect happen (there
aren't any in these, though).

and: and or: stop executing as soon as one of them is satisfied
sufficiently - so if a date > b date then it will immediately return true
without bothering with the rest of the expressions.
ifTrue:ifFalse: is similar - except you will evaluate the condition
expression AND one of the following expressions.

Often this doesn't matter one way or another - but when it does, it matters
a lot.

-cbc

On Wed, Feb 4, 2015 at 9:00 AM, Paul DeBruicker  wrote:

> Does using the | or & notation have any advantages over and: or or:  or
> ifTrue:ifFalse ?
>
>
> I always write expressions like the one you've written like:
>
> a date = b date
>ifTrue:[a temps > b temps]
>ifFalse:[a date > b date]
>
>
>
>
>
>
>
> Louis LaBrunda wrote
> > Hi Raymond,
> >
> > Try:
> >
> > ^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
> > temps > b date temps))].
> >
> > Lou
> >
> > On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin <
>
> > jgr.asselin@
>
> > >
> > wrote:
> >
> >>I have this kind of sorting on anOrderedCollection
> >>
> >>BlocNotes >>sortedNotes
> >>  ^notes sorted:[:a :b | a date  > b date]
> >>
> >>This sort my notes on date but I want them sort by date AND inside a date
> by hours and I don't khow how to do this.
> >>
> >>Some insights?
> >>
> >>aNote = 'med com date temps' instancesVariables what I call hours = temps
> witch is a number like 2123 for 21h23
> >>
> >>Some insights?
> > ---
> > Louis LaBrunda
> > Keystone Software Corp.
> > SkypeMe callto://PhotonDemon
> > mailto:
>
> > Lou@
>
> >  http://www.Keystone-Software.com
> >
> > ___
> > Beginners mailing list
>
> > Beginners@.squeakfoundation
>
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/How-to-doubble-sort-a-collection-tp4803657p4803671.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to doubble sort a collection

2015-02-04 Thread Paul DeBruicker
Does using the | or & notation have any advantages over and: or or:  or
ifTrue:ifFalse ?


I always write expressions like the one you've written like:

a date = b date 
   ifTrue:[a temps > b temps] 
   ifFalse:[a date > b date]







Louis LaBrunda wrote
> Hi Raymond,
> 
> Try:
> 
> ^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
> temps > b date temps))].
> 
> Lou
> 
> On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin <

> jgr.asselin@

> >
> wrote:
> 
>>I have this kind of sorting on anOrderedCollection
>>
>>BlocNotes >>sortedNotes
>>  ^notes sorted:[:a :b | a date  > b date]
>>
>>This sort my notes on date but I want them sort by date AND inside a date
by hours and I don't khow how to do this.
>>
>>Some insights?
>>
>>aNote = 'med com date temps' instancesVariables what I call hours = temps
witch is a number like 2123 for 21h23
>>
>>Some insights?
> ---
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:

> Lou@

>  http://www.Keystone-Software.com
> 
> ___
> Beginners mailing list

> Beginners@.squeakfoundation

> http://lists.squeakfoundation.org/mailman/listinfo/beginners





--
View this message in context: 
http://forum.world.st/How-to-doubble-sort-a-collection-tp4803657p4803671.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection

2015-02-04 Thread Raymond Asselin
I have this kind of sorting on anOrderedCollection

BlocNotes >>sortedNotes
^notes sorted:[:a :b | a date  > b date]

This sort my notes on date but I want them sort by date AND inside a date by 
hours and I don't khow how to do this.

Some insights?

aNote = 'med com date temps' instancesVariables what I call hours = temps witch 
is a number like 2123 for 21h23

Some insights?___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to round a float?

2015-02-04 Thread Ben Coman
On Wed, Feb 4, 2015 at 7:22 PM, Chuck Hipschman 
wrote:

> 7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!
>
> But:
>
> 100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001
>
> "162.88946267774418" "unrounded"
> 100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001
>
>  "207.8928179411367"  "unrounded"
>  Bug, or me again :-)
>
>
If you debug into #roundTo: you'll see its implementation is simple
arithmetic, subject to the vagaries of float resolution.

Float(Number)>>roundTo:
^(self / quantum) rounded * quantum

Now are you wanting something nicely formatted for display, or are you
rounding for some mathematic purpose?  Perhaps instead you are wanting...

   100 * (1.05 raisedTo: 10) printShowingDecimalPlaces: 2  " --> 162.89 "

   0.105 printShowingDecimalPlaces: 2" --> 0.10 "

   0.115 printShowingDecimalPlaces: 2" --> 0.12 "

btw, I only found these today, looking in the printing protocol of Number
and Float.

cheers -ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to round a float?

2015-02-04 Thread Louis LaBrunda
Hi Guys,

On Wed, 4 Feb 2015 08:22:02 -0500, Johann Hibschman 
wrote:

>That just looks like floating-point representation. It's as rounded as it
>can get!
>-Johann

At first I thought some more parans "(" were needed but that didn't change
anything.  No this sounds like a bug to me (ar at least something that can
be improved) as VA Smalltalk prints 162.89, so somehow they are able to
make the floats do the right thing.

Lou


>
>On Wed, Feb 4, 2015 at 6:22 AM, Chuck Hipschman 
>wrote:
>
>> 7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!
>>
>> But:
>>
>> 100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001
>>
>> "162.88946267774418" "unrounded"
>> 100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001
>>
>>  "207.8928179411367"  "unrounded"
>>  Bug, or me again :-)
>>
>> MacBook Pro (Retina, 15-inch, Early 2013)  System Version: OS X 10.10.2
>> (14C109)
>>
>> Image
>> -
>>
>> /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
>> Squeak4.5
>> latest update: #13680
>> Current Change Set: Unnamed1
>> Image format 6505 (32 bit)
>>
>> Virtual Machine
>> ---
>>
>> /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/MacOS/Squeak
>> Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] 4.5
>> Mac OS X built on Aug 22 2013 10:08:05 Compiler: 4.2.1 (Apple Inc. build
>> 5666) (dot 3)
>> platform sources revision VM: r2776
>> http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545
>> http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
>> CoInterpreter VMMaker.oscog-eem.331 uuid:
>> 37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
>> StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid:
>> 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013
>>
>> On Wed, Feb 4, 2015 at 2:59 AM, Ben Coman  wrote:
>>
>>> In the interest of teaching how to fish, look at the senders of #roundTo:
>>> to find its usage.
>>>
>>> I'll post a full answer tomorrow if you don't beat me to it.
>>>
>>> cheers -ben
>>>
>>> On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman 
>>> wrote:
>>>
 7 / 8.0 roundTo: 2 I expect 0.88, I get 0

 What am I doing wrong, or this a bug?

 TIA

 Chuck

 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners


>>>
>>> ___
>>> Beginners mailing list
>>> Beginners@lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>>
>>>
>>
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to round a float?

2015-02-04 Thread Johann Hibschman
That just looks like floating-point representation. It's as rounded as it
can get!

-Johann

On Wed, Feb 4, 2015 at 6:22 AM, Chuck Hipschman 
wrote:

> 7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!
>
> But:
>
> 100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001
>
> "162.88946267774418" "unrounded"
> 100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001
>
>  "207.8928179411367"  "unrounded"
>  Bug, or me again :-)
>
> MacBook Pro (Retina, 15-inch, Early 2013)  System Version: OS X 10.10.2
> (14C109)
>
> Image
> -
>
> /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
> Squeak4.5
> latest update: #13680
> Current Change Set: Unnamed1
> Image format 6505 (32 bit)
>
> Virtual Machine
> ---
>
> /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/MacOS/Squeak
> Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] 4.5
> Mac OS X built on Aug 22 2013 10:08:05 Compiler: 4.2.1 (Apple Inc. build
> 5666) (dot 3)
> platform sources revision VM: r2776
> http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545
> http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
> CoInterpreter VMMaker.oscog-eem.331 uuid:
> 37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
> StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid:
> 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013
>
> On Wed, Feb 4, 2015 at 2:59 AM, Ben Coman  wrote:
>
>> In the interest of teaching how to fish, look at the senders of #roundTo:
>> to find its usage.
>>
>> I'll post a full answer tomorrow if you don't beat me to it.
>>
>> cheers -ben
>>
>> On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman 
>> wrote:
>>
>>> 7 / 8.0 roundTo: 2 I expect 0.88, I get 0
>>>
>>> What am I doing wrong, or this a bug?
>>>
>>> TIA
>>>
>>> Chuck
>>>
>>> ___
>>> Beginners mailing list
>>> Beginners@lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>>
>>>
>>
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to round a float?

2015-02-04 Thread Herbert König

Hi,


100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001
  "162.88946267774418" "unrounded"
100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001
   "207.8928179411367"  "unrounded"


this is to be expected and I think you need a bigger pond than the 
Squeak image to fish for that. I think I found the hint inside Squeak 
only because I know the reason. I think you did your fishing well.


I'll explain later because maybe I can learn better fishing from Ben's 
reply.


Cheers,

Herbert
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to round a float?

2015-02-04 Thread Chuck Hipschman
7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!

But:

100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001

"162.88946267774418" "unrounded"
100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001

 "207.8928179411367"  "unrounded"
 Bug, or me again :-)

MacBook Pro (Retina, 15-inch, Early 2013)  System Version: OS X 10.10.2
(14C109)

Image
-
/Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
Squeak4.5
latest update: #13680
Current Change Set: Unnamed1
Image format 6505 (32 bit)

Virtual Machine
---
/Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/MacOS/Squeak
Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] 4.5
Mac OS X built on Aug 22 2013 10:08:05 Compiler: 4.2.1 (Apple Inc. build
5666) (dot 3)
platform sources revision VM: r2776
http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545
http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
CoInterpreter VMMaker.oscog-eem.331 uuid:
37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid:
84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013

On Wed, Feb 4, 2015 at 2:59 AM, Ben Coman  wrote:

> In the interest of teaching how to fish, look at the senders of #roundTo:
> to find its usage.
>
> I'll post a full answer tomorrow if you don't beat me to it.
>
> cheers -ben
>
> On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman 
> wrote:
>
>> 7 / 8.0 roundTo: 2 I expect 0.88, I get 0
>>
>> What am I doing wrong, or this a bug?
>>
>> TIA
>>
>> Chuck
>>
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Panic

2015-02-04 Thread Herbert König

Hi,

Alt + . (Alt key and simultaneously the . key) usually brings up a 
debugger.


Cheers,

Herbert

Am 04.02.2015 um 05:34 schrieb Kirk Fraser:

What does one do in Squeak to stop an infinite loop?
If one takes a flying leap at it and:
1) hits anything inside the Smalltalk window nothing happens.
2) hits Ctrl-Alt-Del enough times, selects Task Manger then stops Squeak
then next time it opens it says it can't write to the changes file 
until this is fixed [ok]




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to round a float?

2015-02-04 Thread Ben Coman
In the interest of teaching how to fish, look at the senders of #roundTo:
to find its usage.

I'll post a full answer tomorrow if you don't beat me to it.

cheers -ben

On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman 
wrote:

> 7 / 8.0 roundTo: 2 I expect 0.88, I get 0
>
> What am I doing wrong, or this a bug?
>
> TIA
>
> Chuck
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to round a float?

2015-02-04 Thread Chuck Hipschman
7 / 8.0 roundTo: 2 I expect 0.88, I get 0

What am I doing wrong, or this a bug?

TIA

Chuck
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners