Issue 4415 in pharo: asNonFraction

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 4415 in pharo: asNonFraction

pharo
Status: Accepted
Owner: [hidden email]
Labels: Milestone-1.4 Type-Squeak

New issue 4415 by [hidden email]: asNonFraction
http://code.google.com/p/pharo/issues/detail?id=4415

We should have a look.


==================== Summary ====================

Name: Kernel-wiz.592
Author: wiz
Time: 29 May 2011, 6:40:45.398 pm
UUID: ce3c0c86-e4f2-4bf5-8c2a-efbc708af821
Ancestors: Kernel-wiz.591

asNonFraction with updated comments.

ceiling speed up for positive numbers by mirroring floor code rathar than  
calling floor.

=============== Diff against Kernel-wiz.591 ===============

Item was changed:
  ----- Method: Fraction>>asNonFraction (in category 'converting') -----
  asNonFraction
+       "Answer a number equivalent to the receiver that is not a fraction."
-       "Answer the receiver asFloat. This is here for the benifit of the  
copyBits primitive which can handle floats but not fractions. It has to be  
stated this way so we don't turn integers into floats.  See inheritance for  
backstop"

+
        ^self asFloat!

Item was changed:
  ----- Method: Number>>asNonFraction (in category 'converting') -----
  asNonFraction
+       "Answer a number equivalent to the receiver that is not a fraction.  
See Fraction for active method."
-       "Answer the receiver. This is here for the benifit of the copyBits  
primitive which can handle floats but not fractions. It has to be stated  
this way so we don't turn integers into floats.  See Fraction for active  
method"

        ^self !

Item was changed:
  ----- Method: Number>>ceiling (in category 'truncation and round off')  
-----
  ceiling
+       "Answer the integer nearest the receiver toward  infinity."
-       "Answer the integer nearest the receiver toward positive infinity."

+       | truncation |
+       truncation := self truncated.
+       self <= 0 ifTrue: [^truncation].
+       self = truncation
+               ifTrue: [^truncation]
+               ifFalse: [^truncation + 1]!
-       self <= 0.0
-               ifTrue: [^self truncated]
-               ifFalse: [^self negated floor negated]!



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4415 in pharo: asNonFraction

pharo

Comment #1 on issue 4415 by [hidden email]: asNonFraction
http://code.google.com/p/pharo/issues/detail?id=4415

Bert Freudenberg uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-wiz.591.mcz

==================== Summary ====================

Name: Kernel-wiz.591
Author: wiz
Time: 29 May 2011, 4:11:53.048 pm
UUID: 53586ad8-595c-477a-ac55-19471c286e26
Ancestors: Kernel-eem.590

This is asNonFraction defined only for Number and Fraction but not Object.  
Fractions are converted to Floats other numbers are left alone. Non numbers  
including nil  will raise a DNU.

=============== Diff against Kernel-eem.590 ===============

Item was added:
+ ----- Method: Fraction>>asNonFraction (in category 'converting') -----
+ asNonFraction
+       "Answer the receiver asFloat. This is here for the benifit of the  
copyBits primitive which can handle floats but not fractions. It has to be  
stated this way so we don't turn integers into floats.  See inheritance for  
backstop"
+
+       ^self asFloat!

Item was added:
+ ----- Method: Number>>asNonFraction (in category 'converting') -----
+ asNonFraction
+       "Answer the receiver. This is here for the benifit of the copyBits  
primitive which can handle floats but not fractions. It has to be stated  
this way so we don't turn integers into floats.  See Fraction for active  
method"
+
+       ^self !



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4415 in pharo: asNonFraction

pharo
Updates:
        Cc: [hidden email]
        Labels: Difficulty-Easy

Comment #2 on issue 4415 by [hidden email]: asNonFraction
http://code.google.com/p/pharo/issues/detail?id=4415

SLICE-Issue-4415-Number-ceiling-AlexandreBergel.1 in  
ss3.gemstone.com/PharoInbox

asNonFraction does not exist in Pharo 1.4. So, most of this entry is not  
relevant anymore.
I improved ceiling with what Nice proposed. I also added a tests.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4415 in pharo: asNonFraction

pharo
Updates:
        Status: FixProposed

Comment #3 on issue 4415 by [hidden email]: asNonFraction
http://code.google.com/p/pharo/issues/detail?id=4415

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4415 in pharo: asNonFraction

pharo
Updates:
        Status: Closed

Comment #4 on issue 4415 by [hidden email]: asNonFraction
http://code.google.com/p/pharo/issues/detail?id=4415

in 14126


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker