Subject | Re: 3 * 1/3 = 0 ??? |
---|---|

Author | rogervellacott |

Post date | 2002-08-30T19:01:07Z |

The issue is not whether it is legitimate to have integer

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.

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.