--- a/Fraction.st Tue May 28 05:56:40 2019 +0200
+++ b/Fraction.st Tue May 28 08:32:04 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -708,6 +710,33 @@
"
!
+asLargeFloatPrecision:n
+ "Answer a Floating point with arbitrary precision
+ close to the receiver."
+
+ "Note: form below would not be the closest approximation
+ ^ (numerator asLargeFloatPrecision: n)
+ inPlaceDivideBy: (denominator asLargeFloatPrecision: n)"
+
+ ^ LargeFloat fromFraction:self precision:n
+
+ "
+ (5/9) asFloat 0.555555555555556
+ (5/9) asLargeFloatPrecision:200 0.555556
+ (5/9) asLargeFloat
+
+ (500000000000/900000000000) asFloat * 900000000000 - 500000000000
+ ((500000000000/900000000000) asLargeFloatPrecision:200) * 900000000000 - 500000000000
+ (500000000000/900000000000) asLargeFloat * 900000000000 - 500000000000
+
+ (500000000000/9) asLargeFloatPrecision:200
+ (500000000000/9) asLargeFloat:200
+ "
+
+ "Created: / 27-05-2019 / 08:30:08 / Claus Gittinger"
+ "Modified (comment): / 28-05-2019 / 06:04:48 / Claus Gittinger"
+!
+
asLargeInteger
"return an integer with my value - will usually truncate"