diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-04-25 06:34:42 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-04-25 06:34:42 +0000 |
commit | 3af29ce7bf91b2c589dceff324dcb180aab8c600 (patch) | |
tree | 7eec1a1901f90288559f3ae6e4888ccf91ae9720 /packet-ldp.c | |
parent | 16510d5c56f3b2f18d452ff8eeac76da1f8ecb43 (diff) |
Use "%.10g", rather than "%f", for floating-point numbers. That will
display values that would fit in a 32-bit integer as integers, leaving
out all trailing zeroes after the decimal point (and leaving out the
decimal point if there are no digits left after the decimal point once
trailing zeroes are removed), and will use scientific notation for small
fractions or large numbers.
svn path=/trunk/; revision=5248
Diffstat (limited to 'packet-ldp.c')
-rw-r--r-- | packet-ldp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packet-ldp.c b/packet-ldp.c index 21e2e04789..e0486c9c35 100644 --- a/packet-ldp.c +++ b/packet-ldp.c @@ -1,7 +1,7 @@ /* packet-ldp.c * Routines for LDP (RFC 3036) packet disassembly * - * $Id: packet-ldp.c,v 1.35 2002/04/24 19:35:52 guy Exp $ + * $Id: packet-ldp.c,v 1.36 2002/04/25 06:34:41 guy Exp $ * * Copyright (c) November 2000 by Richard Sharpe <rsharpe@ns.aus.com> * @@ -1447,30 +1447,30 @@ dissect_tlv_traffic(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem) /* PDR */ val_f = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_double_format(val_tree, hf_ldp_tlv_pdr, tvb, offset, - 4, val_f, "PDR: %f Bps", val_f); + 4, val_f, "PDR: %.10g Bps", val_f); offset += 4; /* PBS */ val_f = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_double_format(val_tree, hf_ldp_tlv_pbs, tvb, offset, - 4, val_f, "PBS: %f Bytes", val_f); + 4, val_f, "PBS: %.10g Bytes", val_f); offset += 4; /* CDR */ val_f = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_double_format(val_tree, hf_ldp_tlv_cdr, tvb, offset, - 4, val_f, "CDR: %f Bps", val_f); + 4, val_f, "CDR: %.10g Bps", val_f); offset += 4; /* CBS */ val_f = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_double_format(val_tree, hf_ldp_tlv_cbs, tvb, offset, - 4, val_f, "CBS: %f Bytes", val_f); + 4, val_f, "CBS: %.10g Bytes", val_f); offset += 4; /* EBS */ val_f = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_double_format(val_tree, hf_ldp_tlv_ebs, tvb, offset, - 4, val_f, "EBS: %f Bytes", val_f); + 4, val_f, "EBS: %.10g Bytes", val_f); } } |