| 5227 | |
| 5228 | |
| 5229 | dsc* evlLog(thread_db* tdbb, const SysFunction* function, const NestValueArray& args, |
| 5230 | impure_value* impure) |
| 5231 | { |
| 5232 | fb_assert(args.getCount() == 2); |
| 5233 | |
| 5234 | Request* request = tdbb->getRequest(); |
| 5235 | |
| 5236 | const dsc* value[2]; |
| 5237 | value[0] = EVL_expr(tdbb, request, args[0]); |
| 5238 | if (request->req_flags & req_null) // return NULL if value is NULL |
| 5239 | return NULL; |
| 5240 | |
| 5241 | value[1] = EVL_expr(tdbb, request, args[1]); |
| 5242 | if (request->req_flags & req_null) // return NULL if value is NULL |
| 5243 | return NULL; |
| 5244 | |
| 5245 | if (!areParamsDouble(2, value)) |
| 5246 | { |
| 5247 | DecimalStatus decSt = tdbb->getAttachment()->att_dec_status; |
| 5248 | Decimal128 v1 = MOV_get_dec128(tdbb, value[0]); |
| 5249 | Decimal128 v2 = MOV_get_dec128(tdbb, value[1]); |
| 5250 | |
| 5251 | if (v1.compare(decSt, CDecimal128(0)) <= 0) |
| 5252 | { |
| 5253 | status_exception::raise(Arg::Gds(isc_expression_eval_err) << |
| 5254 | Arg::Gds(isc_sysf_basemustbe_positive) << |
| 5255 | Arg::Str(function->name)); |
| 5256 | } |
| 5257 | |
| 5258 | if (v2.compare(decSt, CDecimal128(0)) <= 0) |
| 5259 | { |
| 5260 | status_exception::raise(Arg::Gds(isc_expression_eval_err) << |
| 5261 | Arg::Gds(isc_sysf_argmustbe_positive) << |
| 5262 | Arg::Str(function->name)); |
| 5263 | } |
| 5264 | |
| 5265 | impure->vlu_misc.vlu_dec128 = v2.ln(decSt).div(decSt, v1.ln(decSt)); |
| 5266 | impure->vlu_desc.makeDecimal128(&impure->vlu_misc.vlu_dec128); |
| 5267 | } |
| 5268 | else |
| 5269 | { |
| 5270 | const double v1 = MOV_get_double(tdbb, value[0]); |
| 5271 | const double v2 = MOV_get_double(tdbb, value[1]); |
| 5272 | |
| 5273 | if (v1 <= 0) |
| 5274 | { |
| 5275 | status_exception::raise(Arg::Gds(isc_expression_eval_err) << |
| 5276 | Arg::Gds(isc_sysf_basemustbe_positive) << |
| 5277 | Arg::Str(function->name)); |
| 5278 | } |
| 5279 | |
| 5280 | if (v2 <= 0) |
| 5281 | { |
| 5282 | status_exception::raise(Arg::Gds(isc_expression_eval_err) << |
| 5283 | Arg::Gds(isc_sysf_argmustbe_positive) << |
| 5284 | Arg::Str(function->name)); |
| 5285 | } |
| 5286 |
nothing calls this directly
no test coverage detected