[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Wes Turner
FWIW, bigfloat (GNU MPFR) has arbitrary precision and rounding that can be set with `with` context managers: https://pythonhosted.org/bigfloat/ On Thursday, November 14, 2019, Greg Ewing wrote: > On 15/11/19 7:39 am, Chris Angelico wrote: >> >> But in your >> source code, if you type 4.1, you

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Chris Angelico
On Fri, Nov 15, 2019 at 9:53 AM Greg Ewing wrote: > > On 15/11/19 7:39 am, Chris Angelico wrote: > > But in your > > source code, if you type 4.1, you are asking for the floating-point > > value > > The idea of providing decimal literals comes up from time to > time, but so far it hasn't gotten

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Greg Ewing
On 15/11/19 7:39 am, Chris Angelico wrote: But in your source code, if you type 4.1, you are asking for the floating-point value The idea of providing decimal literals comes up from time to time, but so far it hasn't gotten anywhere. The problem is that it would make the core interpreter

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Chris Angelico
On Fri, Nov 15, 2019 at 4:04 AM wrote: > > Does decimal make this: > 4.1 + 0.1 > produce 4.2 instead of 4.18? The decimal module means that Decimal("4.1") is equal to 41/10 rather than 2308094809027379/562949953421312, and Decimal("0.1") is equal to 1/10 rather than

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread MRAB
On 2019-11-14 17:10, Brett Cannon wrote: On Thu, Nov 14, 2019 at 9:04 AM > wrote: Does decimal make this: 4.1 + 0.1 produce 4.2 instead of 4.18? Yes, see https://docs.python.org/3/library/decimal.html#module-decimal. If you're talking

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Brett Cannon
On Thu, Nov 14, 2019 at 9:04 AM wrote: > Does decimal make this: > 4.1 + 0.1 > produce 4.2 instead of 4.18? > Yes, see https://docs.python.org/3/library/decimal.html#module-decimal. > ___ > Python-ideas mailing list --

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread awesomecronk
Does decimal make this: 4.1 + 0.1 produce 4.2 instead of 4.18? ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Jonathan Goble
On Thu, Nov 14, 2019 at 8:49 AM wrote: > > An ideal improvement to python would be the introduction of fixed point > decimals. Maybe make them adjustable with os.system(). To adjust, you would > call os.system with the parameters ‘fixed’, 3, 15 to dictate fixed point > math, three integer