*** Starter Wiki Page : Boilerplate edition*** This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, [gold] 20DEC2020 ---- Title: Equation_V2_into_TCL <> ***Preface*** [gold] Here are some calculations using TCL expressions. ---- ***Introduction*** Here are TCL calculations on the equation. pretty print from autoindent and ased editor Convert HgA1c to Average Blood Glucose mg/dl Convert HgA1c to Average Blood Glucose mg/dl V2 Console program example demo was written on Windows 10 on TCL working under TCL version 8.6 gold on TCL Club , 20aug2020. Each HgA1c reading usually from limits of 4.0 to 11 has an equivalent average blood glucose over a 3 month period.formula from Diabetes Care, 2012. Roughly 5 HgA1c converts to 100 mg/dl abbrev. for milligrams per deciliter. ---- *** Calculator Usage*** As as alternate way of using the calculator *** Expressions into TCL. *** ---- ***Testcases are important in development of TCL programs. *** ---- ***Conclusions*** By inspection ---- *** Table 1: Tables*** ---- %| table| printed in|TCL format |% %| HgA1c units | mg/dl units | comment, if any|% &| 4.1000 | 68.660 | |& &| 4.2000 | 72.220 | |& &| 4.3000 | 75.780 | |& &| 4.4000 | 79.340 | |& &| 4.5000 | 82.900 | |& &| 4.6000 | 86.460 | |& &| 4.7000 | 90.020 | |& &| 4.8000 | 93.580 | |& &| 4.9000 | 97.140 | |& &| 5.0000 | 100.70 | |& &| 5.1000 | 104.26 | |& &| 5.2000 | 107.82 | |& &| 5.3000 | 111.38 | |& &| 5.4000 | 114.94 | |& &| 5.5000 | 118.50 | |& &| 5.6000 | 122.06 | |& &| 5.7000 | 125.62 | |& &| 5.8000 | 129.18 | |& &| 5.9000 | 132.74 | |& &| 6.0000 | 136.30 | |& &| 6.1000 | 139.86 | |& &| 6.2000 | 143.42 | |& &| 6.3000 | 146.98 | |& &| 6.4000 | 150.54 | |& &| 6.5000 | 154.10 | |& &| 6.6000 | 157.66 | |& &| 6.7000 | 161.22 | |& &| 6.8000 | 164.78 | |& &| 6.9000 | 168.34 | |& &| 7.0000 | 171.90 | |& &| 7.1000 | 175.46 | |& &| 7.2000 | 179.02 | |& &| 7.3000 | 182.58 | |& &| 7.4000 | 186.14 | |& &| 7.5000 | 189.70 | |& &| 7.6000 | 193.26 | |& &| 7.7000 | 196.82 | |& &| 7.8000 | 200.38 | |& &| 7.9000 | 203.94 | |& &| 8.0000 | 207.50 | |& &| 8.1000 | 211.06 | |& &| 8.2000 | 214.62 | |& &| 8.3000 | 218.18 | |& &| 8.4000 | 221.74 | |& &| 8.5000 | 225.30 | |& &| 8.6000 | 228.86 | |& &| 8.7000 | 232.42 | |& &| 8.8000 | 235.98 | |& &| 8.9000 | 239.54 | |& &| 9.0000 | 243.10 | |& &| 9.1000 | 246.66 | |& &| 9.2000 | 250.22 | |& &| 9.3000 | 253.78 | |& &| 9.4000 | 257.34 | |& &| 9.5000 | 260.90 | |& &| 9.6000 | 264.46 | |& &| 9.7000 | 268.02 | |& &| 9.8000 | 271.58 | |& &| 9.9000 | 275.14 | |& &| 10.000 | 278.70 | |& &| 10.100 | 282.26 | |& &| 10.200 | 285.82 | |& &| 10.300 | 289.38 | |& &| 10.400 | 292.94 | |& &| 10.500 | 296.50 | |& &| 10.600 | 300.06 | |& &| 10.700 | 303.62 | |& &| 10.800 | 307.18 | |& &| 10.900 | 310.74 | |& &| 11.000 | 314.30 | |& &| 11.100 | 317.86 | |& &| 11.200 | 321.42 | |& &| 11.300 | 324.98 | |& &| 11.400 | 328.54 | |& &| 11.500 | 332.10 | |& &| 11.600 | 335.66 | |& &| 11.700 | 339.22 | |& &| 11.800 | 342.78 | |& &| 11.900 | 346.34 | |& &| 12.000 | 349.90 | |& &| 12.100 | 353.46 | |& &| 12.200 | 357.02 | |& &| 12.300 | 360.58 | |& &| 12.400 | 364.14 | |& &| 12.500 | 367.70 | |& &| 12.600 | 371.26 | |& &| 12.700 | 374.82 | |& &| 12.800 | 378.38 | |& &| 12.900 | 381.94 | |& &| 13.000 | 385.50 | |& ---- *** Table 2: Tables *** ---- ---- ***Testcases Section*** **** Testcase 1 **** ---- **** Testcase 2 **** ---- **** Testcase 3 **** ---- ---- ***Screenshots Section*** **** figure 1. Calculator Screenshot **** **** figure 2. Console Screenshot **** ---- ***References:*** ---- * google search engine < HgA1c to Average Blood Glucose> * How Do You Calculate Your A1c? diabetestalk.net * BLOOD SUGAR HOW DO YOU CALCULATE YOUR A1C? DEC 5, 2017 * [table] * The Diabetes Code: Prevent and Reverse Type 2 Diabetes Naturally * 2018 ยท 4.88 MB by Dr Jason Fung ---- ***Pseudocode & Equations Section*** ====== more than one formula for 1) tables and 2) calculator shell Pseudocode Section ====== ---- ====== # pretty print from autoindent and ased editor # Convert HgA1c to Average Blood Glucose mg/dl V2 # Console program example demo # written on Windows 10 on TCL # working under TCL version 8.6 # gold on TCL Club , 20aug2020 # Each HgA1c reading usually from # limits of 4.0 to 11 # has an equivalent average blood glucose # over a 3 month period. # formula from Diabetes Care, 2012. # Roughly 5 HgA1c converts to 100 # mg/dl abbrev. for milligrams per deciliter package require Tk package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tclprecision 17 console show # following dresses up console output to easy eye console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} set tclprecision 17 #hgA1c_convert_to_average_blood_glucose mg/dl HgA1c proc a1c aa { expr { 35.6*$aa -77.3} } # proc precisionx used to round off floating point numbers proc precisionx {precision float} { # tcl:wiki:Floating-point formatting, # select numbers only, not used on every number. set x [ expr {round( 10 ** $precision * $float) / (10.0 ** $precision)} ] # rounded or clipped to nearest 5ird significant figure set x [ format "%#.5g" $x ] return $x } proc summit n { set sum 0 # initial hgA1c level set count 4.0 puts "%| table| printed in|TCL format |% " puts "%| HgA1c units | mg/dl units | comment, if any|% " # adapted proc from # printout in TCL WIKI format table for { set i 1 } { $i <= $n } { incr i } { set count [+ $count .1] puts "&| [ precisionx 3 $count ] | [ precisionx 3 [ a1c $count ]] | |&" incr sum $i } return $sum } summit 90 ====== ---- [gold] This page is copyrighted under the TCL/TK license terms, [http://tcl.tk/software/tcltk/license.html%|%this license]. Disclaimers: This page, screenshots, and TCL source code is copyrighted under the TCL/TK license terms. Editorial rights and disclaimers retained under the TCL/TK license terms and will be defended as necessary in court. **Hidden Comments Section** <> Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, [gold] 12Aug2020 ---- <> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI ---- <> Development | Concept| Algorithm | Medicine | Biology