Project

General

Profile

Feature #565

FloatApprox for TwinFloat values?

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

Status:
In Progress
Priority:
Normal
Assignee:
Category:
New Function
Target version:
Start date:
22 May 2014
Due date:
% Done:

20%

Estimated time:
20.00 h
Spent time:

Description

Does it make sense to have a fn like FloatApprox for twin-float values?

Currently the only way to get a "real value" out of a twin-float is to apply IsRational (or IsInteger); this is very limited.


Related issues

Related to CoCoA-5 - Slug #907: ApproxSolve very slow on this exampleClosed2016-07-14

History

#1 Updated by John Abbott almost 10 years ago

  • Status changed from New to In Progress
  • Assignee set to John Abbott
  • % Done changed from 0 to 20
  • Estimated time changed from 40.00 h to 20.00 h

After further thought it seemed to make more sense to output the twin-float value as a MantExp2 structure, which better allows the actual accuracy to be represented. It is then simple to convert the MantExp2 structure into a rational if so desired.

I have a first prototype impl; it worked on a couple of trivial tests. Needs a lot more work though.

#2 Updated by John Abbott almost 8 years ago

  • Related to Slug #907: ApproxSolve very slow on this example added

#3 Updated by John Abbott almost 8 years ago

My argument that creating a MantExp2 structure makes evident the precision is correct, but there are several occasions when the precision is of secondary importance (after all RingTwinFloat guarantees that it is better than a certain bound), and it would be helpful to have a function which produces directly a BigRat.

I am undecided exactly what the fn should be called. I observe that there is a fn called SimplestBinaryRatBetween, so the name should probably contain BinaryRat.

#4 Updated by John Abbott almost 8 years ago

How about the name BinaryRatApprox?
Mmm, well, that is exactly what FloatApprox does in other cases, but it's called FloatApprox.

Also available in: Atom PDF