Re: 0.0 is different with 0?
- To: mathgroup at smc.vnet.net
- Subject: [mg90064] Re: 0.0 is different with 0?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 27 Jun 2008 06:20:14 -0400 (EDT)
On 6/26/08 at 4:44 AM, damayi at gmail.com (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? Because you defined your function to only accept real values in the last position not integers. The character 0 by itself with no decimal point is an integer with an exact value. The number 0.0 is a machine precision number that is approximately 0 but not guaranteed to be exactly 0. In any computer system there is a difference between exact integers and machine precision numbers often referred to as floating point numbers. And while these may be from some view point mathematically the same, they are never the same from the standpoint of numerical computation on a computer.