hcrisp

01-19-2011, 11:26 AM

Discovered in WAVE 9.01f (Windows): Looks like any non-numeric float (whether undefined, infinite, or indeterminate) taken to the power of a zero (either byte, integer, or long, but not float) returns the value of 1.0.

f = machine(/f)

nan = f.nan

inf = 1./0.

ind = sqrt(-1.)

info, nan^0

;<Expression> FLOAT = 1.00000

info, inf^0

;<Expression> FLOAT = 1.00000

info, ind^0

;<Expression> FLOAT = 1.00000

info, nan^0B

;<Expression> FLOAT = 1.00000

info, nan^0L

;<Epression> FLOAT = 1.00000

I can understand why infinity^0 would result in 1, but why aren't the other non-numeric values propagated to the output like they are when you take them to the power of a float zero? It doesn't seem consistent.

info, inf^0.

;<Expression> FLOAT = 1.00000

info, nan^0.

;<Expression> FLOAT = 1.#QNAN

info, ind^0.

;<Expression> FLOAT = -1.#IND0

f = machine(/f)

nan = f.nan

inf = 1./0.

ind = sqrt(-1.)

info, nan^0

;<Expression> FLOAT = 1.00000

info, inf^0

;<Expression> FLOAT = 1.00000

info, ind^0

;<Expression> FLOAT = 1.00000

info, nan^0B

;<Expression> FLOAT = 1.00000

info, nan^0L

;<Epression> FLOAT = 1.00000

I can understand why infinity^0 would result in 1, but why aren't the other non-numeric values propagated to the output like they are when you take them to the power of a float zero? It doesn't seem consistent.

info, inf^0.

;<Expression> FLOAT = 1.00000

info, nan^0.

;<Expression> FLOAT = 1.#QNAN

info, ind^0.

;<Expression> FLOAT = -1.#IND0