鉴于双,需要找到总共有多少位数 [英] Given a double, need to find how many digits in total

查看:87
本文介绍了鉴于双,需要找到总共有多少位数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个双这不一定是正,但通常。它可以是0.xxxx000或X.xxxx00000或XX.00000或0.xxx0xxx00000,其中最终有全部为0到最后一个数字的权利。我需要跟踪的多少位有。我一直有麻烦了这一点,任何帮助?这是C

I have a double which is not necessarily positive but usually. It can be 0.xxxx000 or X.xxxx00000 or XX.00000 or 0.xxx0xxx00000, where eventually there are all 0's to the right of the last number. I need to keep track of how many digits there are. I've been having trouble with this, any help? This is C.

推荐答案

用sprintf把它变成一个字符串,你需要的数字做任何计数/测试

Use sprintf to turn it into a string and do whatever counting/testing you need to do on the digits

这篇关于鉴于双,需要找到总共有多少位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆