Giter Site home page Giter Site logo

Comments (6)

mlubin avatar mlubin commented on June 20, 2024

How are you using nan in your code?

from dualnumbers.jl.

oxinabox avatar oxinabox commented on June 20, 2024

I'm not sure that this will help you,
but I use it when creating a lightweight version of one of my composite types.
(to save on network transmission, in my parallel code).
I want to set one of the fields to NaN so that if it is ever accesses (which on the lightweight version it shouldn't be), it becomes immediately apparent.
I further have a version of the lightweight type that support converting,
as part of me using it with ForwardDiff.jl

Yes there are other ways to do it, eg Nullable, which may be better.
But because I was using NaN as a quick hack,
I came across the aforementioned unexpected behavior.

EDIT: I've removed the code I posted cos that code is full of bugs and typos (clearly I need to sleep). Point being it doesn't seem logical that nan(Dual{Float32}) should produce a Float32. If it has to for implementation reasons, then that should be documented (if it isn't already)

from dualnumbers.jl.

oxinabox avatar oxinabox commented on June 20, 2024

It was added in commit 336b003 , if that helps you remember why you made it that way.
I'm sure you had a good reason at the time.

from dualnumbers.jl.

mlubin avatar mlubin commented on June 20, 2024

Since we overload the comparison operators, I think it's safe to make this change. Will need some testing though.

from dualnumbers.jl.

tomasaschan avatar tomasaschan commented on June 20, 2024

Now, inf(T) and nan(T) are deprecated in favor of convert(T, Inf) and convert(T, NaN), so I think these should simply be removed (after ample deprecation).

from dualnumbers.jl.

mlubin avatar mlubin commented on June 20, 2024

Resolved by #27

from dualnumbers.jl.

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.