Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Currency filter doesn't truncate floats correctly when the JS float math is wacky. #1469

Closed
@mattsgarrison

Description

@mattsgarrison

JS floating point math goes awry when you do 1.07 + 1 - 2.07, it returns 4.440892098500626e-16, whereas 1.00 + 1 - 2.00 returns 0.

However, when you use that same floating point math in an angular expression with a currency filter, the filter does not truncate/convert the scientific notation to $0.00.

For reference, this fiddle will display the problem: http://jsfiddle.net/mattsgarrison/vZh69/ if you provide the first input 1.07, the second input 1, and the third input 2.07.

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