Project

General

Profile

Feature #233

AsINT and AsRAT -- ConvertTo<BigInt> and ConvertTo<BigRat>

Added by John Abbott over 11 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
New Function
Target version:
Start date:
25 Sep 2012
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:

Description

Should we implement functions very like AsINT and AsRAT in CoCoALib?

What should their names be? Anna suggests AsBigInt and AsBigRat?
If so, design them properly!
Anna also points out that AsPolyRing and other similarly named functions for rings are essentially costless casts whereas AsBigInt is a costly operation.

2014-01: Final decision is for ConvertTo<BigInt>, ConvertTo<BigRat>


Related issues

Related to CoCoALib - Feature #253: W.Bruns's wish listClosed2012-10-04

Related to CoCoA-5 - Design #301: How to obtain an integer from a finite field element? AsINT?Closed2013-02-08

Related to CoCoA - Support #425: Osnabrueck 2014-01Closed2014-01-27

Related to CoCoALib - Feature #426: ConvertTo with optional arg to give more helpful error messageClosed2014-01-27

Related to CoCoALib - Feature #61: Conversion functions -- documentationClosed2011-12-13

History

#1 Updated by John Abbott over 11 years ago

  • Status changed from New to In Progress

JAA suggests using the convert family for achieving this. For instance

  RingElem x(...);
  BigInt N = ConvertTo<BigInt>(x);
  BigRat Q = ConvertTo<BigRat>(x);

2013-01-30 JAA has made experimental impl of ConvertTo<BigInt> for RingElem.

#2 Updated by John Abbott over 11 years ago

If I define ConvertTo for converting RingElem into BigInt, should I define all members of the convert family for performing the conversions? This might make IsInteger redundant...

#3 Updated by Anna Maria Bigatti about 11 years ago

  • Category set to New Function

#4 Updated by John Abbott over 10 years ago

An advantage of Anna's suggested names is that they are more compact than using the ConvertTo template fn.

JAA suggests looking through CoCoALib source code (and examples?) to see how IsInteger is used.

PS it'd be nice to close this task soon; it's little more than just a naming issue.

#5 Updated by Anna Maria Bigatti about 10 years ago

  • Status changed from In Progress to Feedback
  • Assignee set to John Abbott
  • Target version set to CoCoALib-0.9953
  • % Done changed from 0 to 80

Final decision is for ConvertTo<BigInt> and ConvertTo<BigRat>

#6 Updated by Anna Maria Bigatti about 10 years ago

  • Target version changed from CoCoALib-0.9953 to CoCoALib-0.99532

#7 Updated by Anna Maria Bigatti about 10 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 80 to 100
  • Estimated time set to 2.00 h

Please note that ConvertTo<..>(N)
also allows passing an error message

ConvertTo<long>(NumIndets, ErrMesg)
<\pre>

#8 Updated by Anna Maria Bigatti about 10 years ago

  • Subject changed from AsINT and AsRAT to AsINT and AsRAT -- ConvertTo<BigInt> and ConvertTo<BigRat>

Also available in: Atom PDF