Skip to content

How to have a type literal #2

Open
@jdimeo

Description

@jdimeo

One of my methods always returns a double regardless of the dimension (a ratio of overlap of two boxes, which is between 0.0 and 1.0 regardless of if the boxes are int, float, etc.

The last line of my method is

return ox * oy / getArea();

If the dimension is already a double, no problem. If it's an int or long, I need to cast area first so that it doesn't do integer division. How do I inject a (double) getArea() into the template but only when the dimension is not a double?

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