Does your hardware accept a number as a string, or does it desire the floating-point encoding of the number? (Yes, this is re-asking what NetWallah already asked, but maybe in a slightly more prominent way, with some extra clarifications following below.)
- if it wants a string, does it want it the numbers to each be a certain number of characters, or is there a specific delimiter between them (your examples imply a comma)
- if it wants floating-point encoding of the number, does it want single (32bit), double (64bit), long double (128bit) or something else? what endian-ness? Once you know the exact format of the number it desires, you can split your string on the commas (or use a prebuilt CSV module) to get a list of the floating-point values, then use pack to encode the floating points into the underlying representation that your hardware understands: your format will be one of f (single), d (double), or D (long double); with perl ≥ v5.10, you can add a modifier, > for big-endian or < for little-endian.
Once you have the answers to those, try coding it up. If you still need help afterwards, show us the coding progress you've made, and what's still not behaving as you expect.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.