8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

More details about arithmetical exceptions.

This commit is contained in:
dimitr 2008-04-01 12:04:08 +00:00
parent c741f654a2
commit 60fcb5886c

View File

@ -2862,7 +2862,12 @@ static dsc* binary_value(thread_db* tdbb, const jrd_nod* node, impure_value* imp
{
const double divisor = MOV_get_double(desc2);
if (divisor == 0)
ERR_post(isc_arith_except, 0);
{
ERR_post(isc_arith_except,
isc_arg_gds, isc_exception_float_divide_by_zero,
isc_arg_sql_state, "22012",
0);
}
impure->vlu_misc.vlu_double =
DOUBLE_DIVIDE(MOV_get_double(desc1), divisor);
impure->vlu_desc.dsc_dtype = DEFAULT_DOUBLE;
@ -4200,7 +4205,12 @@ static dsc* divide2(const dsc* desc, impure_value* value, const jrd_nod* node)
if (node->nod_flags & nod_double) {
const double d2 = MOV_get_double(desc);
if (d2 == 0.0)
ERR_post(isc_arith_except, 0);
{
ERR_post(isc_arith_except,
isc_arg_gds, isc_exception_float_divide_by_zero,
isc_arg_sql_state, "22012",
0);
}
const double d1 = MOV_get_double(&value->vlu_desc);
value->vlu_misc.vlu_double = DOUBLE_DIVIDE(d1, d2);
value->vlu_desc.dsc_dtype = DEFAULT_DOUBLE;
@ -4249,7 +4259,12 @@ static dsc* divide2(const dsc* desc, impure_value* value, const jrd_nod* node)
*/
SINT64 i2 = MOV_get_int64(desc, desc->dsc_scale);
if (i2 == 0)
ERR_post(isc_arith_except, 0);
{
ERR_post(isc_arith_except,
isc_arg_gds, isc_exception_integer_divide_by_zero,
isc_arg_sql_state, "22012",
0);
}
SINT64 i1 = MOV_get_int64(&value->vlu_desc, node->nod_scale - desc->dsc_scale);