Giter Site home page Giter Site logo

Comments (3)

Neargye avatar Neargye commented on July 19, 2024 1

Ok, will try implement this.

from stl.

Neargye avatar Neargye commented on July 19, 2024

First look at the issues:

  1. operator/ call -> operator/= call -> _Div(...).
  2. Division operations require IsNan/Nan. (Example for float)
    template <class _Other>
    _CONSTEXPR20 void _Div(const complex<_Other>& _Right) {
        using _Myctraits = _Ctraits<_Ty>;

        _Ty _Rightreal = static_cast<_Ty>(_Right.real());
        _Ty _Rightimag = static_cast<_Ty>(_Right.imag());

        if (_Myctraits::_Isnan(_Rightreal) || _Myctraits::_Isnan(_Rightimag)) { // <========
...
            if (_Myctraits::_Isnan(_Wd) || _Wd == 0) {
                this->_Val[_RE] = _Myctraits::_Nanv(); // <========
...
    }
  1. Let's look at _Isnan. (Example for float)
    static bool _Isnan(_Ty _Left) {
        return _CSTD _FDtest(&_Left) == _NANCODE;
    }
  1. And look at _FDtest. (Example for float)
_CRTIMP2_PURE short __CLRCALL_PURE_OR_CDECL _FDtest(float*);

At first glance, I didn't notice a neat way to add a modifier constexpr without breaking the logic of the code.

from stl.

StephanTLavavej avatar StephanTLavavej commented on July 19, 2024

Thanks for looking into this. We've had access to constexpr NaN for a while (see numeric_limits). For _Isnan, it looks like we'll need to use constexpr bit_cast(), after which the NaN pattern can be easily identified. So I'll add a note that this depends on #22.

from stl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.