Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Is this normal?

Jul
532
10
1735655354533.webp


I’m just surprised at "-0". If anything, if you round to 0.0, and you’re negative, it should just be 0, right? Or at the very least "-0" might make more sense?

I’m just curious for the working-as-designed story here, or if it’s really a bug. Sorry!!!
 
"0-" ... that's gotta be a bug.

Code:
v:\> echo %@formatn[02.0,-0.01]
0-
 
Yea. I noticed a free-space-gained report was saying i’d gained "-" megs of free space. Eventually I realized it was "0 megs", but actually a negative number rounded to 0.
 
And FWIW, TakeCmd.dll's Printf does it and C's wprintf does not.

These

Code:
    Printf(L"%02.0f\r\n", -0.01);
    wprintf(L"%02.0f\r\n", -0.01);

produce

Code:
0-
-0
 
Maybe the development world needs a word for something that’s not quite a bug, like "varmint".
 
The example here was the simplified example

In my actual case, it’s a calculated value of how much harddrive space was freed via free-up-harddrive-space.bat

It measures before/after for terabytes, gigabytes, and megabytes.

None of the numbers were actually 0. I just don’t care about megabytes or gigabytes past the integer level, only terabites do i start to care about the 1ˢᵗ decimal place.

So I was getting reports that i’d freed up, for example, 150 megs, but "-" gigs (rounded from 0.150) and "-" terabytes (rounded from 0.000150 or something like that).
 
Back
Top