Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[].min and [].max think +Inf and -Inf (respectively) are spelled "undef" #416

Closed
p6rt opened this issue Nov 26, 2008 · 6 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Nov 26, 2008

Migrated from rt.perl.org#60868 (status was 'resolved')

Searchable as RT60868$

@p6rt
Copy link
Author

p6rt commented Nov 26, 2008

From @masak

From Rakudo r33221​:

$ perl6 -e'say [].min'
Use of uninitialized value

$ perl6 -e'say [].max'
Use of uninitialized value

<pmichaud> min of an empty list should be...?
<TimToady> +Inf
* masak files rakudobug
<TimToady> according to S03, if you consider it equiv to [min]()
<pmichaud> undef is what it returns now.
<pmichaud> and .min isn't constrained to be numeric, is it?
<TimToady> no, but +Inf isn't constrained to be numeric either, necessarily
<pmichaud> ah. :-)

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

From @cspencer

The attached patch fixes the issues below. min/max on an empty list
should now return Inf/-Inf respectively.

On Wed Nov 26 13​:49​:32 2008, masak wrote​:

From Rakudo r33221​:

$ perl6 -e'say [].min'
Use of uninitialized value

$ perl6 -e'say [].max'
Use of uninitialized value

<pmichaud> min of an empty list should be...?
<TimToady> +Inf
* masak files rakudobug
<TimToady> according to S03, if you consider it equiv to [min]()
<pmichaud> undef is what it returns now.
<pmichaud> and .min isn't constrained to be numeric, is it?
<TimToady> no, but +Inf isn't constrained to be numeric either,
necessarily
<pmichaud> ah. :-)

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

From @cspencer

min-max-inf.patch
Index: src/builtins/any-list.pir
===================================================================
--- src/builtins/any-list.pir	(revision 34202)
+++ src/builtins/any-list.pir	(working copy)
@@ -246,7 +246,9 @@
     result = $P0
     goto loop
   fail:
-    result = 'undef'()
+    .local num failres
+    failres = "+Inf"
+    .return (failres)
   done:
     .return (result)
 .end
@@ -288,7 +290,9 @@
     result = $P0
     goto loop
   fail:
-    result = 'undef'()
+    .local num failres
+    failres = "-Inf"
+    .return (failres)
   done:
     .return (result)
 .end

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

From @pmichaud

On Sun Dec 21 08​:26​:41 2008, cspencer wrote​:

The attached patch fixes the issues below. min/max on an empty list
should now return Inf/-Inf respectively.

Applied in r34214, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

@pmichaud - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Dec 21, 2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant