8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

Fixed CORE-3091 - Built-in function POWER(X, Y) does not work when the X argument is negative and the Y value is scaled numeric but integral

This commit is contained in:
asfernandes 2010-07-31 18:40:45 +00:00
parent 9a946aea74
commit e664de5f00

View File

@ -3044,7 +3044,10 @@ dsc* evlPower(thread_db* tdbb, const SysFunction* function, jrd_nod* args,
Arg::Str(function->name));
}
if (v1 < 0 && !(value2->isExact() && value2->dsc_scale == 0))
if (v1 < 0 &&
(!value2->isExact() ||
MOV_get_int64(value2, 0) * SINT64(CVT_power_of_ten(-value2->dsc_scale)) !=
MOV_get_int64(value2, value2->dsc_scale)))
{
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
Arg::Gds(isc_sysf_invalid_negpowfp) <<