Skip to content

missing method big(::Dual) #537

Open

Description

@stevengj

It seems like this should work. All that is needed is:

Base.big(x::Dual{T}) where {T} = Dual{T}(big(x.value), big(x.partials))
Base.big(p::Partials) = Partials(big.(p.values))

(Mentioned on discourse.)

Activity

  1. Pramodh-G commented on Jul 22, 2021

    @Pramodh-G

    Hi, I'd like to take this up. I have some queries though, for Eg, the Base.float(x::Dual) is defined here as follows:
    Base.float(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)

    Should I stick to the same format for Base.big(x::Dual) too?
    Thanks :)

  2. stevengj commented on Jul 22, 2021

    @stevengj
    ContributorAuthor

    I think the float function is wrong (see #535), so I wouldn't follow that model.

    Calling big on the values seems like the best way to make it consistent with Base.

  3. dlfivefifty commented on Jul 28, 2021

    @dlfivefifty
    Contributor

    I ran into this in code that tried to convert to BigFloat . So I’m wondering whether to do big(float(x)) or float(big(x)) ?

  4. stevengj commented on Jul 28, 2021

    @stevengj
    ContributorAuthor

    big(float(x)) should generally be faster, assuming float(x) doesn't lose precision (e.g. x is an integer ≤ maxintfloat)

  5. markmbaum commented on Oct 2, 2021

    @markmbaum

    @stevengj is there a reason that floatmin and floatmax are not implemented for Dual numbers? Just ran into that issue and found this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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