{"id":2522,"date":"2025-04-16T04:54:33","date_gmt":"2025-04-16T04:54:33","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=2522"},"modified":"2025-06-10T06:03:57","modified_gmt":"2025-06-10T06:03:57","slug":"floating-point-formatting-function-f","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/","title":{"rendered":"Floating point formatting function f()"},"content":{"rendered":"\n<p>Specifies floating point data as an argument to a supporting hash function.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Formatter Prototype<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">f(<br>   Source,<br>   FieldWidth,<br>   Decimals,<br>   Style )<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Parameter<\/th><th>Option<\/th><th>Description<\/th><\/tr><tr><th>Source<\/th><td>mandatory<\/td><td>Quite simply, this is what to print<\/td><\/tr><tr><th>FieldWidth<\/th><td>optional<\/td><td>Number of characters to print, including sign and decimal point.&nbsp; Leading spaces will be printed to ensure the number of displayed characters is always this width, unless the&nbsp;<strong>Style<\/strong>&nbsp;is set to &#8220;v&#8221;.&nbsp; Range is 1 thru 9, default is 9.<\/td><\/tr><tr><th>Decimals<\/th><td>optional<\/td><td>Maximum number of decimal places to print.&nbsp; Range is 0 thru 7, default is 7.&nbsp; This value cannot be specified without the FieldWidth value.<\/td><\/tr><tr><th>Style<\/th><td>optional<\/td><td><strong>&#8220;v&#8221;<\/strong>&nbsp;means &#8220;variable width&#8221;.&nbsp; If the value is less than the specified width, then no leading spaces will be printed.&nbsp; Default is fixed width.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The first argument specifies the data source. An optional pair of arguments specifies the format in terms of the number of characters total (<code>FieldWidth<\/code>) and the number of digits after the decimal point (<code>Decimals<\/code>). Unless both format arguments are present, the format defaults to&nbsp;<code>FieldWidth=9<\/code>&nbsp;and&nbsp;<code>Decimals=7<\/code>. If the result requires fewer than&nbsp;<code>FieldWidth<\/code>&nbsp;character it will be padded to the left with spaces unless Style is set to &#8220;v&#8221;.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Source specifiers<\/h6>\n\n\n\n<p>The following are the allowable source specifiers<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Form<\/td><td>Meaning<\/td><td>Example<\/td><\/tr><tr><td><code>=w<\/code><\/td><td>Contents of the W register<\/td><td><code><code><code>#<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5243\">HMI<\/a> <\/code>Print(f(=w))<\/code><\/code><\/td><\/tr><tr><td><code>=q<\/code><\/td><td>Contents of the Q register<\/td><td><code>#HMI Print(f(=q))<\/code><\/td><\/tr><tr><td><code>Constant<\/code><\/td><td>Contents of an EQUated constant. This can be plain&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/directives\/equ-directive\/\">EQU<\/a><\/code>,&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/directives\/fequ-directive\/\">fEQU<\/a><\/code>&nbsp;or&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/directives\/equ-directive-2\/\">#EQU<\/a><\/code><\/td><td><code>Foo fEQU 56.78<\/code><code>...<\/code><code>#HMI Print(f(Foo))<\/code><\/td><\/tr><tr><td>Any valid floating point number<\/td><td>An immediate numeric value<\/td><td><code>#HMI Print(f(3.1415926))<\/code><code>#HMI Print(\"3.1415926\")<\/code><\/td><\/tr><tr><td><code>*Label<\/code><\/td><td>Contents of a float in&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o414\">RAM<\/a><\/td><td><code>fTemperature defFLOAT<\/code><code>...<\/code><code>#HMI Print(f(*Temperature))<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\">index\/jndex modifiers<\/h6>\n\n\n\n<p>RAM variable references can also have index\/jndex modifiers<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Form<\/td><td>What is sourced<\/td><td>Example code<\/td><\/tr><tr><td><code>*+ff<\/code><\/td><td>Whatever is in RAM (float) variable<code> ff<\/code>,with&nbsp;&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/precodes\/iasj-precode-d16\/\">IasJ:<\/a><\/code>&nbsp;applied<\/td><td><code>#HMI Print(f(*+fCounter)) ;Force indexing<\/code><\/td><\/tr><tr><td><code>*-ff<\/code><\/td><td>Whatever is in RAM (float) variable<code> ff, <\/code>with&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/precodes\/iasj-precode-d16\/\">NoJ:<\/a><\/code>&nbsp;applied<\/td><td><code>#HMI Print(f(*-fCounter)) ;Inhibit jndexing<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>NOTE: The modifier (<code>+<\/code>&nbsp;or&nbsp;<code>-<\/code>) must be after the asterisk. jndexing applies only to code running inside a&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/multitrack-advanced-multi-channel-operations\/\">MultiTrack<\/a>&nbsp;task.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Format specifiers<\/h6>\n\n\n\n<p>The format arguments&nbsp;<code>FieldWidth <\/code>and<code> Decimals<\/code>&nbsp;specify how the number is to be displayed. The results are consistent with the older character LCD&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/onboard-lcd-oblcd-instructions\/oblcd_fdispw-fp\/\">OBLCD_fDispW<\/a><\/code>&nbsp;instruction.<\/p>\n\n\n\n<p>Examples (spaces shown as ^):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Example code<\/td><td>Result (the single quotes are NOT printed)<\/td><td>Notes<\/td><\/tr><tr><td><code>#HMI Print(f(1.23456))<\/code><\/td><td><code>' 1.23456'<\/code><\/td><td>Defaults to 9, 9<\/td><\/tr><tr><td><code>#HMI Print(f(1.23456, 9))<\/code><\/td><td><code>' 1.23456'<\/code><\/td><td>Defaults to 9, 9 because&nbsp;<code>FieldWidth <\/code>and&nbsp;<code>Decimals<\/code>&nbsp;must be both present to affect the outcome (all or nothing)<\/td><\/tr><tr><td><code>#HMI Print(f(1.23456, 5, 3))<\/code><\/td><td><code>'1.235'<\/code><\/td><td>Note rounding<\/td><\/tr><tr><td><code>#HMI Print(f(-1.23456, 5, 3))<\/code><\/td><td><code>'-1.23'<\/code><\/td><td>Limited by f character positions<\/td><\/tr><tr><td><code>#HMI Print(f(-1.23456, 5, 9))<\/code><\/td><td><code>' -1.235'<\/code><\/td><td>Limited by 3 decimal places; padded left with spaces<\/td><\/tr><tr><td><code>#HMI Print(f(12.3456, 5, 3))<\/code><\/td><td><code>'12.35'<\/code><\/td><td>&nbsp;<\/td><\/tr><tr><td><code>#HMI Print(f(123.456, 5, 3))<\/code><\/td><td><code>'123.4'<\/code><\/td><td>&nbsp;<\/td><\/tr><tr><td><code>#HMI Print(f(1234.56, 5, 3))<\/code><\/td><td><code>' 1235'<\/code><\/td><td>Decimal point suppressed<\/td><\/tr><tr><td><code>#HMI Print(f(12345.6, 5, 3))<\/code><\/td><td><code>'12346'<\/code><\/td><td>&nbsp;<\/td><\/tr><tr><td><code>#HMI Print(f(123456, 5, 3))<\/code><\/td><td><code>'+++++'<\/code><\/td><td>Overflow: result can&#8217;t fit in field<\/td><\/tr><tr><td><code>#HMI Print(f(-12345.6, 5, 3))<\/code><\/td><td><code>'-----'<\/code><\/td><td>Underflow (negative overflow)<\/td><\/tr><tr><td><code>#HMI Print(f(0.123456, 5, 3))<\/code><\/td><td><code>'0.123'<\/code><\/td><td>Leading &#8220;<code>0.<\/code>&#8221; is displayed<\/td><\/tr><tr><td><code>#HMI Print(f(-0.123456, 5, 3))<\/code><\/td><td><code>'-0.12'<\/code><\/td><td>&nbsp;<\/td><\/tr><tr><td><code>#HMI Print(f(-0.00012345, 5, 3))<\/code><\/td><td><code>'-0.000'<\/code><\/td><td>Take care with small numbers!<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Specifies floating point data as an argument to a supporting hash function. Formatter Prototype f( Source, FieldWidth, Decimals, Style ) Parameter Option Description Source mandatory&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3802,"menu_order":1,"template":"","class_list":["post-2522","spl_knowledgebase","type-spl_knowledgebase","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Floating point formatting function f() - SPLat Controls<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Floating point formatting function f() - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"Specifies floating point data as an argument to a supporting hash function. Formatter Prototype f( Source, FieldWidth, Decimals, Style ) Parameter Option Description Source mandatory...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T06:03:57+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/\",\"name\":\"Floating point formatting function f() - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-16T04:54:33+00:00\",\"dateModified\":\"2025-06-10T06:03:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deprecated\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"# HMI Android &#038; Windows\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Formatting functions\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Floating point formatting function f()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"name\":\"SPLat Controls\",\"description\":\"OEM Embedded Machine Controllers\",\"publisher\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\",\"name\":\"SPLat Controls\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"caption\":\"SPLat Controls\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Floating point formatting function f() - SPLat Controls","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Floating point formatting function f() - SPLat Controls","og_description":"Specifies floating point data as an argument to a supporting hash function. Formatter Prototype f( Source, FieldWidth, Decimals, Style ) Parameter Option Description Source mandatory...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T06:03:57+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/","name":"Floating point formatting function f() - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-16T04:54:33+00:00","dateModified":"2025-06-10T06:03:57+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/floating-point-formatting-function-f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Deprecated","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/"},{"@type":"ListItem","position":3,"name":"# HMI Android &#038; Windows","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/"},{"@type":"ListItem","position":4,"name":"Formatting functions","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/"},{"@type":"ListItem","position":5,"name":"Floating point formatting function f()"}]},{"@type":"WebSite","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","name":"SPLat Controls","description":"OEM Embedded Machine Controllers","publisher":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization","name":"SPLat Controls","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","caption":"SPLat Controls"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/2522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase"}],"about":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/types\/spl_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/users\/1"}],"up":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3802"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=2522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}