adonis0147 commented on PR #35115:
URL: https://github.com/apache/doris/pull/35115#issuecomment-2121913411

   > > I don't think this fix is suitable.
   > 
   > Please add some suggestion instead of just giving a conclusion.
   
   Hi @zhiqiang-hhhh , I feel sorry for the reply. I validated another fix just 
now. I think the following modification is more suitable.
   
   ```shell
   
/Users/runner/work/doris/doris/be/src/vec/functions/function_string.h:3024:22: 
error: call to 'abs' is ambiguous
           frac_value = std::abs(frac_value / multiplier) + 5;
                        ^~~~~~~~
   ```
   
   Another fix without defining functions in namespace `std`:
   ```cpp
   // do rounding, so we need to reserve 3 digits.
   auto multiplier = common::exp10_i128(std::abs(static_cast<int>(scale - 3)));
   // do devide first to avoid overflow
   // after round frac_value will be positive by design.
   frac_value = std::abs(frac_value) / multiplier + 5;
   ```
   
   We can just make `frac_value` positive due to `multiplier` is positive.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to