Project

General

Profile

Design #432

Semantics of IsPrintedWithMinus

Added by John Abbott about 10 years ago. Updated almost 10 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
Various
Target version:
Start date:
31 Jan 2014
Due date:
% Done:

10%

Estimated time:
Spent time:

Description

We should clarify what the semantics of IsPrintedWithMinus are.

I suggest that if IsPrintedWithMinus(x) gives true then IsPrintedWithMinus(-x) must give false; note that x and -x could both give false e.g. if using least non neg residue for a prime finite field.


Related issues

Related to CoCoALib - Feature #222: Printing polynomials - spaces between termsIn Progress2012-08-08

Related to CoCoALib - Feature #1117: Better printing of negative coeffsIn Progress2017-11-07

Related to CoCoALib - Design #1156: Printing for RingElemNew2018-02-12

History

#1 Updated by John Abbott about 10 years ago

  • Status changed from New to In Progress

If we follow the suggestion in note 6 of issue #222 then we need to define IsPrintedWithMinus only for numerical ringelems (i.e. ones for which IsRational gives true). If so, then there is an easy definition:

bool IsPrintedWithMinus(ConstRefRingElem x)
{
  BigRat q;
  return IsRational(q, x) && sign(q) == -1;
}

#2 Updated by John Abbott about 10 years ago

Anna rightly asked how should TwinFloats be handled.

Right now, I'm undecided. I'm quite sure that any polynomial with twinfloat coeffs will be very ugly/unreadable when printed.

#3 Updated by John Abbott almost 10 years ago

  • Target version set to CoCoALib-1.0
  • % Done changed from 0 to 10

If we use the definition I gave in comment 1 then some twin-float numbers will be recognized as rationals and should be printed out as such (I suppose). It could look a bit odd having a poly whose coeffs are partly rational and partly "floating-point"; then again a rational coeff is probably important information (since I'd expect it to be a rare event).

#4 Updated by John Abbott over 6 years ago

  • Related to Feature #1117: Better printing of negative coeffs added

#5 Updated by John Abbott about 6 years ago

Also available in: Atom PDF