[New Feature] Support decimal:quantize langlib function #35687
Replies: 3 comments 6 replies
-
@chiranSachintha, the overall design looks okay to me. (Your flow chart will be more clear if you use something like |
Beta Was this translation helpful? Give feedback.
-
I think, we can add another optional parameter to get the rounding direction @chiranSachintha
Python also supports both up and down rounding directions. Refer to quantize(exp, rounding=None, context=None) |
Beta Was this translation helpful? Give feedback.
-
For this, we use the IEEE semantics of the
quantize
function.For more details, you can follow the 5.3.2 section of IEEE spec.
In this discussion,
The exponent of LHS means the exponent of the first argument of the
quantize
functionThe exponent of RHS means the exponent of the second argument of the
quantize
functionExamples
following cases are not valid with ballerina spec. because we do not support NaN
Implementation design
p
means the maximum number of digits in the significand of 128-bit decimal (radix 10) floating-point number(equals 34).Highly appreciate your input on this discussion.
Beta Was this translation helpful? Give feedback.
All reactions