PolyMath icon indicating copy to clipboard operation
PolyMath copied to clipboard

``PMArbitraryPrecisionFloat one`` returns a Float

Open SergeStinckwich opened this issue 4 years ago • 5 comments

@nicolas-cellier-aka-nice why PMArbitraryPrecisionFloat one returns a SmallInteger and not a PMArbitraryPrecisionFloat?

SergeStinckwich avatar Feb 28 '21 08:02 SergeStinckwich

I don't know. In the original repo, I have this:

one
^self class 
	mantissa: 1
	exponent: 0
	nBits: nBits

yes on instance side, I was talking about class side. When I try: PMArbitraryPrecisionFloat new one, I have an error.

SergeStinckwich avatar Feb 28 '21 09:02 SergeStinckwich

Ah, there's no such thing in original repository. I don't think that it's a good idea to have one on class side because we can't specify precision. Unless you pick some arbitrary arbitraryPrecision... Probably, we should forbid new too, that's not how instances shall be created.

There is no method on the class side, but one in defined in Number on class side in fact. BTW, how instances should be created. Do you have tests that illustrate how to create instances?

SergeStinckwich avatar Feb 28 '21 13:02 SergeStinckwich

It would be interesting to have a default precision I think.

SergeStinckwich avatar Feb 28 '21 13:02 SergeStinckwich