HbA1c Approximates Average Blood Glucose in Console Example Demo for TCL table format V2

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 20Aug2020


Title: Equation_V2_into_TCL

Preface

gold Here are some calculations using for converting HbA1c to average blood glucose mg/dl.


Introduction

Here are TCL calculations on the equation. pretty print from autoindent and ased editor Convert HbA1c to Average Blood Glucose mg/dl Convert HbA1c 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 HbA1c 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 HbA1c converts to 100 mg/dl abbrev. for milligrams per deciliter.



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
  • Dr. Bernstein's Diabetes Solution: The Complete Guide to Achieving Normal Blood Sugars
  • 2007 by Richard K. Bernstein
  • care.diabetesjournals.org 2012
  • Measurement of Hemoglobin A1c , Diabetes Care
  • Measurement of Hemoglobin A1c
  • A new twist on the path to harmony
  • David B. Sacks, December 2012, full pdf available from ADA
Quotes Therefore, to change glucose from mg/
dL to mmol/L, one divides by 18.016
(usually rounded off to 18), and values
are multiplied by 18 to switch from
mmol/L to mg/dL. For example, 126
mg/dL is equivalent to 7.0 mmol/L, and
40 mg/dL is 2.2 mmol/L. 
  • Developing an HbA1c-Based Equation to Estimate Blood Glucose in Maintenance Hemodialysis Patients
  • Junichi Hoshino, MD, MPH1,2,3, Miklos Z. Molnar, MD, PHD1,
  • September 2020
 Quotes. Developing an HbA1c-Based Equation to Estimate Blood Glucose in Maintenance Hemodialysis Patients,2013
some equations showing a good correlation between HbA1c and average BG (AG) levels (the Diabetes Control and Complications Trial [DCCT] formula: AG = 35.6 × HbA1c − 77.3; 


        # pretty print from autoindent and ased editor
        # Convert HbA1c 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 HbA1c 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 HbA1c converts to 100
        # mg/dl abbrev. for milligrams per deciliter
        # mmol/L abbrev. for milligrams per Liter
        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
        # hbA1c_convert_to_average_blood_glucose mg/dl  HbA1c
        proc a1c hbA1c {  expr { 35.6*$hbA1c -77.3} }
        # convert mg/dl to mmol/L average blood glucose
        # some papers round off 18.016 to mgdl/18.
        proc mgdl_to_mmoll mgdl {  expr { $mgdl/18.0 } }
        # convert  mmol/L to mg/dl average blood glucose
        proc mmoll_to_mgdl mmoll {  expr { $mmoll*18.0 } }
        # proc precisionx used to round off floating point numbers
        proc precisionx {precision float}  {
            #  tcl:wiki:Floating-point formatting, <AM>
            # 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 table_format_out  n {
            set sum 0
            # initial hbA1c level
            set count 4.0
            puts "%| table|  | printed in|TCL format |% "
            puts "%| HbA1c units | mg/dl units |conv. mmol/L units  |comment, if any|% "
            # adapted proc from <RS>
            # printout in TCL WIKI format table
            for { set i 1 } { $i <= $n } { incr i } {
                set count [+ $count .1]
                set mgdl5 [ precisionx 3 [ a1c $count ]]
                set mmoll  [ precisionx 3 [mgdl_to_mmoll [ a1c $count ]]]
                puts "&| [ precisionx 3  $count ] | $mgdl5  | $mmoll | |&"
                incr sum $i
            }
            return $sum
        }
        proc comma_delimit_format n {
            set sum 0
            # initial hbA1c level
            set count 4.0
            puts "table, ,  printed in,  TCL format  "
            puts "HbA1c units , mg/dl units , conv. mmol/L units, comment, if any "
            # adapted proc from <RS>
            # printout in TCL  comma delimited format
            for { set i 1 } { $i <= $n } { incr i } {
                set count [+ $count .1]
                set mgdl5 [ precisionx 3 [ a1c $count ]]
                set mmoll  [ precisionx 3 [mgdl_to_mmoll [ a1c $count ]]]
                puts "[ precisionx 3  $count ] , $mgdl5, $mmoll ,  ,"
                incr sum $i
            }
            return $sum
        }
        table_format_out 90
        comma_delimit_format 90
        

gold This page is copyrighted under the TCL/TK license terms, 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