> From: net-snmp-users-bounces@lists.sourceforge.net
> [mailto:net-snmp-users-bounces@lists.sourceforge.net] On
> Behalf Of mushtaq khan
> Sent: Monday, July 16, 2007 1:40 AM
> To: net-user
> Subject: [Fwd: What SNMP data type can i use to represent a
> floating pointnumber?]


> I am using net-snmp version 5.4. I have some variables of
> floating point data type, and i don't know what SNMP data
> type i used use for it. Please help me in this regard.


There is no standard way to move floating point data via SNMP. I have never seen a use case that merited it. You may want to reexamine what you are trying to do and make sure that you do in fact need to send floatting point data ovber the network.

Of course, you may have a good *reason* to send floating point data across the network, and I have seen many of those, the most common of which is "my boss told me to get this floating point data across the network and I'm addicted to food and shelter." Therefore, I offer two suggestions, both of which involve sending octet strings:

1) The robust way is to use printf and scanf (yes, scanf!) to stringify the value. There will probably be some loss of precision, but floats are inherently imprecise.

2) The precise way is to use a serialization library such as OSSP xdr to losslessly convert the data into binary form. This can only be used in environments that support XDR.


Good luck,

Mike

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/...net-snmp-users