in reply to Perl 5 numeric type and simplifications
You already got the correct answer, so apart my welcome, I only want to comment:
> I am only interested because I find this an easy way to remove trailing decimal zeroes, and if I can get away with not using sprintf then that would be great.
you dont pay CPU cycles nor characters in your program, do you? So it is better to embrace the more idiomatic style you can, without relying on edge cases to accomplish simple tasks as the precision of a number. One of our wise brothers has in their signature: Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond and even if in Perl there are many way to get the job done I suggest you to write your programs in the clearest form you can get.
Another great motto goes like: Being debugging twice harder than programming, dont program at your best as you dont be able to debug it, by definition
Imagine a weird bug in your 5k lines of perl code spread among different modules, a bug due to a weak assumption on perl rounding beahviour... good luck :)
Explore edge cases, try everything, but when you write something intended to be usable and durable choose the plainest way.
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl 5 numeric type and simplifications
by Bod (Parson) on May 05, 2021 at 21:02 UTC |