Page MenuHomeFeedback Tracker

What is this sorcery?... -1 x 0 = -0 ??
Closed, ResolvedPublic

Description

Apparently -0 is a legit number. Hmm I wonder if it goes

..-3, -2, -1, -0, 0, 1, 2, 3...

Please fix it, BIS!

Details

Legacy ID
4217254346
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Scripting
Steps To Reproduce

execute

hint str (-1 * 0)

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Scripting.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Fixed.
Killzone_Kid set Legacy ID to 4217254346.May 7 2016, 5:27 PM
Bohemia added a subscriber: ceeeb.Nov 18 2013, 8:48 PM

someone needed a place to keep track of the sign, but for those parsing numbers might get ugly.

Not actually a bug.

See http://en.wikipedia.org/wiki/IEEE_754.

It is standard for computer representation of number to have positive zero, negative zero, plus infinity, minus infinity and "Not A Number" signal value. Also, the function for raising a number into a power is called "pown".
Welcome to the wonderful worlds of computers :)

Well, if this is not a bug then according to the same article we should have the concept of infinity so division by 0 should be possible, but it is not.

zeven added a subscriber: zeven.May 7 2016, 5:27 PM

division by zero is not infinity it's mathematically undefined.

@zeven Read the article, in IEEE 754 division by 0 is infinity.

Maybe we do, maybe we don't.

hint str 1e39 => "1.#INF"
hint str 1e500 => "1.#INF"
hint str 1e3903909403940390394 => "1.#INF"

so theoretically

hint str (1/0) => "1.#INF"

should be possible but you get zero divisor error

i did not know the following but:

"Division by zero (an operation on finite operands gives an exact infinite result, e.g., 1/0 or log(0)) (returns ±infinity by default)." from the wikipedia article

(+infinity and -infinity)