Re: 0.0 is different with 0?
- To: mathgroup at smc.vnet.net
- Subject: [mg90068] Re: 0.0 is different with 0?
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Fri, 27 Jun 2008 06:21:00 -0400 (EDT)
- References: <g3vkss$kfs$1@smc.vnet.net>
damayi wrote:
> Dear all
> Here is an example to show my question.
> SF[N_Integer, a_Real, fs_Real] :=
> Table[Sin[(1 + fs)*k*2 Pi/N + a], {k, 0, N - 1}]
>
> SF[32, 0.1, 0.0] can show the table contents, however, SF[32, 0.1, 0]
> cannot show the result. Why?
>
First, avoid using identifiers beginning with capital letters. N is a
built-in symbol (but not the cause of the problem).
You can check using Head[0] and Head[0.0] that 0 is an Integer and 0.0
is a Real (i.e. an inexact number), so fs_Real does not match 0. "Real"
mean different things in Mathematica and mathematical terminology.