Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

08-13-2019 11:38 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Labels:

I'm doing the following, and received the wrong value. Is there something I'm missing?

Solved! Go to Solution.

Highlighted
Options

08-13-2019 11:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Why is this incorrect?

anything x 0 = 0 and -0 = 0

Highlighted
Options
To prove that -0 is equal to 0, add an increment by 1 after the multiply and before your indicator. The math is correct, it may just look wonky.

08-13-2019 11:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options
I mean it makes sense. The reason why I ask is because problem arises when I try to convert this is an string which now becomes "-0". Doing any comparisons fails immediately. Is there a reason why LV does this, rather than follow -1 * 0 = 0?

08-13-2019 12:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options

There are only two ways to tell somebody thanks: Kudos and Marked Solutions

Unofficial Forum Rules and Guidelines

Solution

Accepted by topic author Tom321

08-13-2019 12:12 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Well, there is a sign bit in the IEEE754 specification. When multiplying, the two sign bits should just be XORed. -1 has a sign of 1 (negative) while 0 has a sign of 0 (positive). XOR the values and you get 1 (negative). This results in -0.

For additional reading: Signed zero

There are only two ways to tell somebody thanks: Kudos and Marked Solutions

Unofficial Forum Rules and Guidelines

Highlighted
Options

** LabVIEW Champion. It all comes together in GCentral **

08-14-2019 02:18 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Tom321 wrote:

Doing any comparisons fails immediately.

Define "fail". If you do the comparison on the numerics, you can see that -0 and 0 are equal as expected.

Highlighted
Options

There are only two ways to tell somebody thanks: Kudos and Marked Solutions

Unofficial Forum Rules and Guidelines

08-14-2019 11:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@altenbach wrote:

@Tom321 wrote:

Doing any comparisons fails immediately.

Define "fail". If you do the comparison on the numerics, you can see that -0 and 0 are equal as expected.

Tom321 did sort of define it. He stated that he converts to a string and then does comparisons.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions

Unofficial Forum Rules and Guidelines