Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to name functions to extract parts of a decimal number?

I am writing a class for handling decimal numbers, e.g. "123.456". I want one function for extracting the digits before the decimal point (123), and one function to extract the digits after the decimal point (0.456). My question is not how to do the programming, but how to name the functions? Do you have any better idea than digits_before_point() and digits_after_point()?

like image 785
Johan Kotlinski Avatar asked Dec 20 '25 04:12

Johan Kotlinski


2 Answers

integralPart() and decimalPart() or integers() and decimals()

like image 194
dfa Avatar answered Dec 24 '25 08:12

dfa


How about integral_part and decimal_part?

like image 44
Anon. Avatar answered Dec 24 '25 07:12

Anon.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!