Help save net neutrality! Learn more.
Close

#523 ratweights: must be integer (check)

open
nobody
Lisp Core (471)
5
2006-07-24
2004-02-25
No

ratweights can currently only be integers, but there is
no check for this:

ratweight(x,1.5); -- no error
ratweight(y,3/2); -- no error
p: sum(x^i,i,0,10);
rat(p),ratwtlvl:1 => 0
rat(p),ratwtlvl:2 => 0
rat(p),ratwtlvl:10 => 0
rat(p),ratwtlvl:100 => 0

ratweight should give an error if the weight isn't integral.

Alternatively, fractional (rat and float) weights could be
supported. It wouldn't be that hard, though there would
be a bit of a performance hit. Most ratweight
manipulation is in ratout/wtptimesXXX, and uses f*. It
could use * or even MUL instead.

Discussion

  • Robert Dodier

    Robert Dodier - 2006-07-24

    Logged In: YES
    user_id=501686

    In 5.9.3cvs, ratweight(x,1.5) and ratweight(y,3/2) => no
    error (as in initial report). However, after p:
    sum(x^i,i,0,10), then rat(p),ratwtlvl:1 etc all yield /R/
    x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1 (not 0).

     
  • Robert Dodier

    Robert Dodier - 2006-07-24
    • labels: --> Lisp Core
     

Log in to post a comment.