Skip to content

Incorrect result sign from multiply when one of the inputs is a power of 10 #57

Closed
@ZCG-coder

Description

@ZCG-coder

Describe the bug

When trying to multiply two numbers, where one of them is a power of 10, calc_multiply tries to move decimal places.
However, it did not take the sign of the number into consideration, leading to a wrong result.

To Reproduce

Steps to reproduce the behavior:

  1. Run the calc_multiply program with arguments -1.0 and -1.2222222222222.
  2. The output is
    Since -1.0 is a power of 10, we can move the decimal places to obtain the result.
    -1.22
    
    , which is of the incorrect sign.

Expected behavior

The sign should be positive.

Screenshots

None yet

OS

  • All OSs are affected

Additional context

None yet

Metadata

Metadata

Assignees

Labels

C-C++Code - Pull requests that update C++ code.T-BugType - Bug and unexpected behavior.T-ImprovementType - Improvements to components.

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions