Subject | Re: [ib-support] Re: 3 * 1/3 = 0 ??? |
---|---|
Author | Martijn Tonies |
Post date | 2002-08-30T20:26:34Z |
Hi,
Easy:
1 = integer
1.0 = float
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> The issue is not whether it is legitimate to have integerYou weren't asked to declare it as a float either...
> operations. It is whether literal values should be interpreted as
> integers by default.
>
> Division by literal values should default to the accurate result, not
> the inaccurate result. So 1/3 should default to 0.3333.. If I have
> declared a variable x as in integer, then it is reasonable that x/3
> (where x = 1) should return 0. But nowhere was I asked to declare
> that 1 was an integer, or that 3 was an integer. So this behaviour
> makes SQL arithmetic quite esoteric, and accident prone.
Easy:
1 = integer
1.0 = float
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."