File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -571,9 +571,10 @@ Decimal objects
571
571
>>> Decimal(321 ).exp()
572
572
Decimal('2.561702493119680037517373933E+139')
573
573
574
- .. method :: from_float(f)
574
+ .. classmethod :: from_float(f)
575
575
576
- Classmethod that converts a float to a decimal number, exactly.
576
+ Alternative constructor that only accepts instances of :class: `float ` or
577
+ :class: `int `.
577
578
578
579
Note `Decimal.from_float(0.1) ` is not the same as `Decimal('0.1') `.
579
580
Since 0.1 is not exactly representable in binary floating point, the
Original file line number Diff line number Diff line change @@ -114,10 +114,10 @@ another rational number, or from a string.
114
114
115
115
.. versionadded :: 3.8
116
116
117
- .. method :: from_float(flt)
117
+ .. classmethod :: from_float(flt)
118
118
119
- This class method constructs a :class: ` Fraction ` representing the exact
120
- value of * flt *, which must be a :class: `float `. Beware that
119
+ Alternative constructor which only accepts instances of
120
+ :class: ` float ` or :class: `numbers.Integral `. Beware that
121
121
``Fraction.from_float(0.3) `` is not the same value as ``Fraction(3, 10) ``.
122
122
123
123
.. note ::
@@ -126,10 +126,10 @@ another rational number, or from a string.
126
126
:class: `Fraction ` instance directly from a :class: `float `.
127
127
128
128
129
- .. method :: from_decimal(dec)
129
+ .. classmethod :: from_decimal(dec)
130
130
131
- This class method constructs a :class: ` Fraction ` representing the exact
132
- value of * dec *, which must be a :class: `decimal.Decimal ` instance .
131
+ Alternative constructor which only accepts instances of
132
+ :class: `decimal.Decimal ` or :class: ` numbers.Integral ` .
133
133
134
134
.. note ::
135
135
You can’t perform that action at this time.
0 commit comments