File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 137137
138138assert 1.2 ** 2 == 1.44
139139assert_raises (OverflowError , lambda : 1.2 ** (10 ** 1000 ))
140+ assert 3 ** 2.0 == 9.0
140141
141142assert (1.7 ).real == 1.7
142143assert (1.3 ).is_integer () == False
Original file line number Diff line number Diff line change @@ -284,6 +284,14 @@ impl PyFloat {
284284 )
285285 }
286286
287+ #[ pymethod( name = "__rpow__" ) ]
288+ fn rpow ( & self , other : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
289+ try_float ( & other, vm) ?. map_or_else (
290+ || Ok ( vm. ctx . not_implemented ( ) ) ,
291+ |other| other. powf ( self . value ) . into_pyobject ( vm) ,
292+ )
293+ }
294+
287295 #[ pymethod( name = "__sub__" ) ]
288296 fn sub ( & self , other : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
289297 try_float ( & other, vm) ?. map_or_else (
You can’t perform that action at this time.
0 commit comments