Fraction.st
changeset 22099 cc9d508cf69c
parent 21974 cf76d289d886
child 22254 30d452a7c004
--- a/Fraction.st	Tue Jul 25 16:36:49 2017 +0200
+++ b/Fraction.st	Tue Jul 25 16:36:59 2017 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1055,6 +1057,30 @@
     "Modified: 28.7.1997 / 19:08:46 / cg"
 !
 
+raisedFromFloat:aFloat
+    "aFloat does not know how to be raised to the receiver"
+
+    numerator == 1 ifTrue:[
+        ^ aFloat nthRoot:denominator
+    ].
+    ^ self asFloat raisedFromFloat:aFloat
+
+    "
+     100 raisedTo:(2/5) asFloat
+     100 raisedTo:(1/5) asFloat
+     
+     100 nthRoot:2      10.0
+     100 nthRoot:3      4.641588833612778893
+     100 raisedTo:(1/3) 3.16227766016838
+     100 raisedTo:(1/4) 3.16227766016838
+     100 raisedTo:(1/5) 2.51188643150958
+     100 raisedTo:(1/6) 2.15443469003188
+     100 raisedTo:(1/7) 1.93069772888325
+    "
+
+    "Created: / 25-07-2017 / 16:13:26 / cg"
+!
+
 sumFromFixedPoint:aFixedPoint
     |n d otherDenominator otherNumerator|