I want to use printf only as my application uses printf and stores the format type in the object. The reason I want to represent 40000 as 4000 as it is incorrect if somebody is passing 40000. My object can't figure that out. It is for error handling.
printf doesn't chop anything except the decimal portion. It makes sense since 40000 means something very different than 4000 (left-chopped) or 0000 (right-chopped), while 5.123 and 5.12 are similar.
You can still use printf, but you first need to chop it using substr, unpack or some other means.