Calling degree on the zero (univariate) polynomial returns 0 (here). However, the usual mathematical convention is either -infinity (with the set of degrees = N U {-infty} forming an monoid) or "undefined". In particular, setting degree(0) = 0 violates degree(fg) = degree(f) + degree(g).
Making degree return an Option would be mathematically elegant, but also programmatically cumbersome - aside from a massive breaking change. Perhaps a better solution can be found? I understand this is pretty much a non-issue, but I felt compelled to bring it up.
Calling
degreeon the zero (univariate) polynomial returns0(here). However, the usual mathematical convention is either -infinity (with the set of degrees = N U {-infty} forming an monoid) or "undefined". In particular, settingdegree(0) = 0violatesdegree(fg) = degree(f) + degree(g).Making
degreereturn anOptionwould be mathematically elegant, but also programmatically cumbersome - aside from a massive breaking change. Perhaps a better solution can be found? I understand this is pretty much a non-issue, but I felt compelled to bring it up.