Open ob-robot opened 1 year ago
Hi there,
I'm interested in working on this issue. Is it available for me to work on?
Is there anything specific I should keep in mind while working on this? Any additional context or guidance would be appreciated.
Looking forward to contributing to the project!
Best regards,
Thanks. There are some definition named epsilon
(maybe), please take a look.
Should I use the epsilon value defined in the C/C++ standard library for floating-point types, which is FLT_EPSILON
?
It looks good
oceanbase/src/sql/engine/expr/ob_datum_cast.cpp
----8<--------------8<-------
5448:{
5449: int ret = OB_SUCCESS;
5450: ObObjTypeClass type_class = ob_obj_type_class(type);
5451: if (OB_UNLIKELY(ObFloatTC != type_class && ObDoubleTC != type_class)) {
5452: ret = OB_INVALID_ARGUMENT;
5453: LOG_WARN("obj type is invalid, must be float/double tc", K(ret), K(type), K(type_class));
5454: } else {
5455: IN_TYPE in_val = *(reinterpret_cast<const IN_TYPE*>(in_datum.ptr_));
5456: IN_TYPE out_val = in_val;
Medium:(FLOATING_POINT_EQUALITY)
CWEnone: Floating-point expressions shall not be directly or indirectly tested for equality or inequality.
Floating point expression "0." is compared using operator "==".
oceanbase/src/sql/engine/expr/ob_datum_cast.cpp: int oceanbase::sql::float_range_check(unsigned long const &, oceanbase::common::ObAccuracy const &, oceanbase::common::ObObjType, oceanbase::common::ObDatum const &, oceanbase::common::ObDatum &, int &)
5457: if (lib::is_oracle_mode() && 0.0 == in_val) {
5458: if (ObFloatTC == type_class) {
5459: res_datum.set_float(0.0);
5460: } else {
5461: res_datum.set_double(0.0);
5462: }
5463: } else {
5464: if (CAST_FAIL_CM(real_range_check(accuracy, out_val), cast_mode)) {
5465: LOG_WARN("real_range_check failed", K(ret));
5466: } else if (in_val != out_val) {
5467: if (ObFloatTC == type_class) {