Op vrijdag 26 september 2014 11:58:44 UTC+2 schreef Volker Braun:
>
> On Friday, September 26, 2014 10:46:08 AM UTC+1, Peter Bruin wrote:
>
>> To be honest, I tend to agree with this argument.  Once you start 
>> defining arithmetic with infinity, you are asking for trouble because there 
>> isn't one set of semantics that is valid in all or even most cases; you are 
>> also forced to either introduce NaN or accept that arithmetic operations 
>> may throw errors, etc.
>>
>
> And that is a good thing! If you have to check before every operation that 
> the input is acceptable then you litter your code with if branches that 
> make it hard to follow what you are actually doing. Separating the error 
> handling from the actual algorithm is a basic programming pattern...
>

Sure, it is not the simple fact that errors are thrown that is the 
problem.  What I meant is that by allowing arithmetic with infinity, you 
could easily mask actual mathematical mistakes, due to the fact that there 
is hardly any property of infinity/ies that is valid in every case.  I 
think the original point in Denis Simon's program with respect to which 
this question arose involved taking a certain valuation of zero.  This used 
to return a very large integer, now it returns infinity.  I don't know if 
in this case zero was a valid value for the variable in question, but 
things like this are cases where the code needs to be clear on whether it 
is valid or not, instead of allowing errors to be raised later.  It is 
completely sensible for valuation(0) to result in an error (or a "useless" 
infinity return value), which you can then explicitly catch or check for, 
instead of allowing the program to silently continue computing with 
infinity, possibly resulting in a mathematically nonsensical answer later.  
Explicitly checking for x = 0 in the code inspires more confidence in the 
correctness of the program than code that doesn't tell you whether the 
author ever thought about the case x = 0.

One thing that does make this case a little more difficult is the fact that 
>> Denis Simon's scripts are not updated very frequently.  On the positive 
>> side, the functionality of these scripts is gradually being moved into the 
>> PARI library.
>>
>> In this case I would prefer to make a few simple changes to Simon's code 
>> instead of introducing arithmetic with infinity just to fix this problem.
>>
>
> So even if upstream never comes around with infinities, we can always 
> remove the infinities patch once the scripts have been updated.
>

Only if nothing else has started to rely on them in the meantime...

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to