How to find how many places from left the dot appears in a flot/double?

rempas rempas at tutanota.com
Thu Dec 30 16:34:14 UTC 2021


On Thursday, 30 December 2021 at 11:17:39 UTC, afg45 wrote:
> See the https://en.wikipedia.org/wiki/Common_logarithm fpr the 
> explanations.
>
> ```
> import std.stdio, std.math;
>
> void main(string[] args)
> {
>     alias numDigits = (f) => log10(f + 0.5).ceil();
> }
> ```

Thanks a lot! However, I used the "log10" function from "libm" 
because I will need to not use Phobos anyway


More information about the Digitalmars-d-learn mailing list