Skip to content

casting to quandtype emits uneccesary warnings #163

@mattip

Description

@mattip

When using np.astype and the array has inf or nan, I see a RuntimeWarning: invalid value encountered in cast. On internal numpy float dtypes these are not emitted.

Run with python -Walways

import numpy as np
import numpy_quaddtype
a = np.arange(30, dtype=np.float32); 
a[-1] = np.inf
q = numpy_quaddtype.QuadPrecision
d = np.float64
warns = a.astype(q)
# <stdin>:1: RuntimeWarning: invalid value encountered in cast
nowarns = a.astype(d)
# This does not warn
warns.astype(d)

I think this is coming from sleef?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions