[issue32978] Issues with reading large float values in AIFC files

2020-01-11 Thread Cheryl Sabella
Change by Cheryl Sabella : -- versions: +Python 3.9 -Python 2.7, Python 3.6, Python 3.7 ___ Python tracker ___ ___ Python-bugs-list

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Mark Dickinson
Mark Dickinson added the comment: > But I don't know the exact format for infinities and NaNs. >From the Intel software developer manuals: For infinities: Sign bit: 0 or 1 (positive or negative infinity) Exponent field (15 bits): all ones Significand (64 bits): first bit 1, all remaining bits

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But I don't know the exact format for infinities and NaNs. -- ___ Python tracker ___ ___ Python-

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Mark Dickinson
Mark Dickinson added the comment: > What if return 80-bit infinities and NaN as 64-bit infinities and NaN and > raise an error in the case of finite numbers overflow? That's certainly reasonable from a pure floating-point-conversion perspective: it's exactly what I'd expect a general purpose

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What if return 80-bit infinities and NaN as 64-bit infinities and NaN and raise an error in the case of finite numbers overflow? -- ___ Python tracker

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Mark Dickinson
Mark Dickinson added the comment: > If left the OverflowError propagated I would catch it at the caller place > (_read_float() is used only once) and reraise as aifc.Error. Ah, if there's a dedicated exception type already then yes, agreed that raising aifc.Error (with a suitable message) mak

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your review Mark. If left the OverflowError propagated I would catch it at the caller place (_read_float() is used only once) and reraise as aifc.Error. OverflowError is not expected exception. It never is raised for valid AIFC files, and the

[issue32978] Issues with reading large float values in AIFC files

2018-03-02 Thread Mark Dickinson
Mark Dickinson added the comment: > And I think that using math.ldexp() can be more preferable that pow(2.0, ...) Yes, absolutely agreed. I'll take a look at the PR. -- ___ Python tracker ___

[issue32978] Issues with reading large float values in AIFC files

2018-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm fine with an OverflowError, but it looks inconsistent to me that for some huge values an OverflowError is not raised, but aifc._HUGE_VAL is returned instead. And I think that using math.ldexp() can be more preferable that pow(2.0, ...), especially for e

[issue32978] Issues with reading large float values in AIFC files

2018-03-01 Thread Mark Dickinson
Mark Dickinson added the comment: I'm finding it hard to imagine why you'd ever have a sample rate greater than 1e308 in an audio file. (In fact, it's hard to imagine needing a sample rate greater than 1e6.) Raising an OverflowError for a value that's too large to fit in an IEEE 754 binary64

[issue32978] Issues with reading large float values in AIFC files

2018-03-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +5718 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-

[issue32978] Issues with reading large float values in AIFC files

2018-03-01 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : The frequency rate is saved as a 80-bit floating point value in AIFC files. There are issues with reading large values. 1. Values with maximal exponent are read as aifc._HUGE_VAL which is less then sys.float_info.max. Thus greater values can be read as le