Menu

FLOATS update

Anobium
2024-02-21
2024-04-04
1 2 > >> (Page 1 of 2)
  • Domenic Cirone

    Domenic Cirone - 2024-02-21

    I have limited time, but I can carve out a little if you need someone to test.

     
    • Anobium

      Anobium - 2024-02-21

      Good to hear.

      We are producing test programs. Once we have the basics running on our tests rigs we can get help to test in the real world. The first goal is to get Singles working, we already have made compiler changes and we have basic maths working to show Single float values on the terminal.. mySingle = 4.321 actually shows up on a serial terminal... this means ram representation and some basic maths convert the Single into Integers for display.

      Once we have a version ready will publish to the Dev Channel on GCSTUDIO

      Look an update on our progress.

       
  • Anobium

    Anobium - 2024-02-29

    We, Clint, Jim and I are making progress.

    We have something that we could share with the constraints we are aware of.

    We are focusing on float support adding the minimum functions needed for singles would be +, -. *, /, SingleToString() (so it could be displayed) and SingleToHex()

    SingletoString function supports +/-999999.99999999 this is good enough for a utility function. We have another 3 decimal routine that shows how to extract the integer and decimal components.

    We have resolved many, many issues and there are many to be resolved.

    See this video for an insight into the progress.

    Want to play ? The more folks testing the better.

     
    ❤️
    2
  • Anobium

    Anobium - 2024-03-01

    Current functional list

    Advanced variables are only supported by a subset of the functions of GCBASIC - you may need to write your own functions, if you need them. :-)

    If the function is NOT shown below assume the function is NOT supported. If you use a function that is not shown below then you may get a silent failure and you may not get the results you expected.

    The functional characteristics are:

    • Dimensioning of single variable type in user program.
    • Assigning advanced variables creation of values from constants.
    • Assigning advanced variables creation of values from singles and constants using addition and subtraction.
    • Assigning a IEEE574 HEX constant value to a single.
    • Multiplication and division of single variable type
    • Assigning single to long and long to single.
    • The assignment of a single or a double to a long also deals with byte and word.
    • Copying between variables of the same type (single to single).
    • Assigning unit value of a single or double variable to a long variable.
    • Setting of advanced variable bits.
    • Addition and subtraction of advanced variables.
    • Boolean operators of advanced variables.
    • Use of float variable(s) as global variables.
    • Functions and sub routines supported including passing float variable(s) as parameters to methods ( sub, function and macro)
    • Extraction of unit and/or mantissa value to string functionality
    • SingleToHEX - convert a single to a string IEEE574 HEX
    • StringToSingle - convert a string to a single.
    • SingleToString - convert a single to a string.
    • Conditional statements
    • Calculation of the modulo of a single variable
    • Dimensioning of longInt, ulongInt and double variable types in libraries.
    • Int() for Single variables
    • Assigning double to long and long to double
    • Assigning a single to double and double to single
    • Rotate of double, longInt & ulongInt advanced variables.
    • Negate for advanced variables.
    • Demos are available
    • GCode Helper updated
    • Help updated

    Current non-functional list

    These are the functions that are not supported. Assuming that a function is not supported is the best approach when using advanced variables. Use of these functions may cause an error message or may silently fail producing invalid ASM.

    Functionality explicitly known not to be supported is shown below.

    None

     
    ❤️
    2

    Last edit: Anobium 2024-03-23
  • Angel Mier

    Angel Mier - 2024-03-01

    Update with floats beta is available on DEV channel.
    Tool Chain Build: 1348
    Version: 1.01.08.3

    Just select the DEV channel to get it.

    If for some reason you want to go back to the Stable Release, simply select mainstream channel and apply a Force Update.

    Enjoy and give feedback to the team!

    Angel

     
    ❤️
    2
  • Anobium

    Anobium - 2024-03-06

    Single multiply works!!

    The following test program shows Single * Single and Single * Constant.

        HserPrintCRLF   
    
        HSerPrintStringCRLF "Initial = " + SingleToString ( cPI )
        HSerPrintStringCRLF "Initial = 0x" + SingleToHex ( cPI )
        HserPrintCRLF
    
        Do
    
            myRadius = 11.5
    
    
            // Constant * Single
            myCircumference = cPI * myRadius
    
            HSerPrintStringCRLF "Result  = " + SingleToString ( myCircumference )
            HSerPrintStringCRLF "Result  = 0x" + SingleToHex ( myCircumference )
    
            // Single * Single
            myPi = 3.142857142857143
            myCircumference = myPi  * myRadius   
            HSerPrintStringCRLF "Result  = " + SingleToString ( myCircumference )
            HSerPrintStringCRLF "Result  = 0x" + SingleToHex ( myCircumference )
    
    
            // Assign Single to Long 
            myLong = myCircumference 
            HSerPrintStringCRLF "MyLong  = " + LongToString ( myLong )
    
            Wait 5 s
    
        Loop
    

    Yields this on the terminal

    **Initial = 3.14285707
    Initial = 0x40492492

    Result = 36.14285278
    Result = 0x42109248
    Result = 36.14285278
    Result = 0x42109248
    MyLong = 36
    **

     

    Last edit: Anobium 2024-03-06
  • Anobium

    Anobium - 2024-03-06

    Single divide now works!!

    // Test program
    
        #script
            Pi = 22/7
        #endscript
    
        Dim myCircumference, myRadius as Single
        Dim myDiameter as Single Alias myCircumference_E, myCircumference_U, myCircumference_H, myCircumference
    
        HserPrintCRLF
    
        myRadius = 9.5
        HSerPrintStringCRLF "myRadius = " + ltrim(SingleToString(myRadius))
    
        myCircumference = myRadius * Pi * 2
        HSerPrintStringCRLF "myCircumference = " + ltrim(SingleToString(myCircumference))
    
        If myRadius > 10.5 Then
            HSerPrintStringCRLF "myRadius greater than 10.5" 
        Else If myRadius = 10.5 Then
            HSerPrintStringCRLF "myRadius equals 10.5"
        Else If  myRadius < 10.5 Then
            HSerPrintStringCRLF "myRadius less than 10.5" Then
        End if
    
        myDiameter = myCircumference / Pi
        HSerPrintStringCRLF "myDiameter = " + ltrim(SingleToString(myDiameter))
        End
    

    Yields the correct results.

    **
    myRadius = 9.50000000
    myCircumference = 59.71428298
    myRadius less than 10.5
    myDiameter = 19.00000000
    **

    A demo video is here:

     
  • Anobium

    Anobium - 2024-03-07

    The functional characteristics are:

    Use of float variable(s) as global variables.
    Dimensioning of single variable type in user program.
    Assigning advanced variables creation of values from constants.
    Assigning advanced variables creation of values from singles and constants using addition and subtraction.
    Multiplication and division of single variable type
    Assigning single to long and long to single.
    The assignment of a single or a double to a long also deals with byte and word.
    Assigning unit value of a single or double variable to a long variable.
    Int() for Single varaibles
    Copying between variables of the same type (single to single).
    Setting of advanced variable bits.
    Addition and subtraction of advanced variables.
    Boolean operators of advanced variables.
    Functions and sub routines supported including passing float variable(s) as parameters to methods ( sub, function and macro)
    Extraction of unit and/or mantissa value to string
    SingleToHEX() HEX string of the single
    SingleToString() string of the single
    SingletoString
    Conditional statements
    Calculation of the modulo of a Single variable
    Dimensioning of longInt, ulongInt and double variable types in libraries.
    Assigning double to long and long to double
    Assigning a single to double and double to single
    Rotate of double, longInt & ulongInt advanced variables.
    Negate for advanced variables.

    See Video not available

     
  • David Briscoe

    David Briscoe - 2024-03-07

    Evan,
    Thanks for all the work you and the rest of the team have done on this. Will this be available in an update soon? Will examples be available to test? Thanks.

     
    • Anobium

      Anobium - 2024-03-07

      Thank you!

      This has been a huge amount of work by Clint, Jim and myself. It it not for those guys I was not motivated to spend the huge amount of time on making it all work.

      Thanks goes to Hugh for the foundation work, the guys that kicked the tyres in 2021 ( they identified all the issue!) and now Jim and Clint.


      Angel will release to the DEV Channel build 1358 very soon.

      The stable and fully functional build is 1358.

      We have two items of additional functionality to add but 1358 is pretty close to completed.

       
      ❤️
      1
  • Angel Mier

    Angel Mier - 2024-03-10

    New Update with floats beta is available on DEV channel.
    Tool Chain Build: 1364
    Version: 1.01.08.4

    Keep the great work!

    Angel

     
    👍
    1

    Last edit: Angel Mier 2024-03-10
  • Anobium

    Anobium - 2024-03-10

    And, here are many, many programs that show what you can do with the new advanced variable.

    See https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/AdvancedVariableSolutions/SingleVariableType_Solutions

    An example is this complex program. It shows using a script to calculate a complex constant that has many decimal points, assignment, maths, conditional test, timer with overflow interrupt and the ISR, and serial interface.

    //! Lots of tests!!
    //! Maths, timer running, events happening, more maths and show some debug
    
        //! Uncomment SYSSINGLECALCS_DEBUG to show debug
        // #DEFINE SYSSINGLECALCS_DEBUG
    
        Dim myCircumference, myRadius, myPi as Single 
        Dim myLong As Long
    
        #script
                cPI = 22/7
        #endscript
    
        // Initialise the timer and ISR as a test
            // Firstly tell the compiler to use a 16bit timer for this demonstration
            #DEFINE TMR0_16BIT
    
            InitTimer0 Osc, PRE0_256 + TMR0_FOSC4 ,  POST0_1
            //    Start the Timer
            StartTimer 0
    
            // Every ~1 sec.  0x0bdc is calculated value using a tool like Mr E. Timer Helper
            SetTimer ( 0 , 3036  )
    
        // Test interupt handling
            On Interrupt Timer0Overflow Call ISR
    
    
    
        HserPrintCRLF   
    
        HSerPrintStringCRLF "Initial = " + SingleToString ( cPI )
        HSerPrintStringCRLF "Initial = 0x" + SingleToHex ( cPI )
        HserPrintCRLF
    
        Do
    
            myRadius = 11.5
    
            // Single maths are long running, may need to turn interrupt off
                INTOFF
            // Constant * Single
            myCircumference = cPI * myRadius * 2
                INTON
    
            HSerPrintStringCRLF "Result  = " + SingleToString ( myCircumference )
            HSerPrintStringCRLF "Result  = 0x" + SingleToHex ( myCircumference )
    
            // Single * Single
            myPi = 3.142857142857143
            myCircumference = myPi  * myRadius * 2
            HSerPrintStringCRLF "Result  = " + SingleToString ( myCircumference )
            HSerPrintStringCRLF "Result  = 0x" + SingleToHex ( myCircumference )
    
            // Single * Single - zero check
            myPi = 10.5
            myRadius = 1000
            myCircumference = myPi  * myRadius * 2  
            HSerPrintStringCRLF "Result  = " + SingleToString ( myCircumference )
            HSerPrintStringCRLF "Result  = 0x" + SingleToHex ( myCircumference )
    
    
            // Assign Single to Long 
            myLong = myCircumference 
            HSerPrintStringCRLF "MyLong  = " + LongToString ( myLong )
    
            Wait 5 s
    
        Loop
    
    
    Sub ISR
        HSerPrintStringCRLF "In ISR"
        Wait 10 ms
    End Sub
    

    Enjoy

     
  • Anobium

    Anobium - 2024-03-11

    A new demo video is here

    Remember to like the Video, subscribe and let the video run the the end.

    This shows the capabilities, lots of demos and easy to use.

     
    • jackjames

      jackjames - 2024-03-11

      When is the official release of the compiler?

       
      • Anobium

        Anobium - 2024-03-11

        A few days. You can get yesterdays build via the GCSTDIO DEV Channel.

        We have one function to complete and a little utility to complete. All the Help etc is all done.

         
  • Anobium

    Anobium - 2024-03-11

    A demonstration of porting an existing LCD program to use a Single variable.

    This changes the LCD display from a range of 0 to 1023 ... to 0v0 to 5v0 and more.. see the video.

    See the short video here

    Really simple, enjoy

     
  • Anobium

    Anobium - 2024-03-12

    Here is the source, and the changes to support using a Single variable in the LCD volt meter video, see https://sourceforge.net/p/gcbasic/discussion/579125/thread/e777a80dfa/?limit=250#02cf

    I defined a Single variable, assigned the ADC result to the single variable, did the maths and converted the SingleToString for display on the LCD.

    //! Dimension a single variable
    dim myVolts as Single
    
    Do Forever
    
        Locate 0, 12
        Print LeftPad( Str( ReadAD10( AN0 ) ), 4 )
        Locate 1, 12
    
        //! Read the 10bit to ADC and assign to a Single variable
        myVolts = [single]ReadAD10( AN1 )
        //! Mutliple the ADC reading by the calculation of 5v0 divided by the max number if increments from the ADC read 
        myVolts = myVolts  * [SINGLE]( [SINGLE]5 / [SINGLE]1023 )
        //! Print the string on LCD
        Print Ltrim(SingleToString ( myVolts )+"00")
    
    Loop
    

    Enjoy

     
  • Anobium

    Anobium - 2024-03-14

    The updated GCBASIC toolchain could be released to the general GCSTUDIO channel by Angel in the coming days.

    Clint, Jim and I have completed a huge project to build upon the work of Hugh to provide as robust solution for floating point numbers support. The more we learn about the compiler each time we do some heavy development the more we learn of the amazing compiler that Hugh as youngling wrote. TRULY AMAZING.

    From my point of view as the Chief Engineer for this project.

    • The changes, whilst huge, are limited to users who use the advanced variables. Therefore, the risk is low of breaking other things. We may have impacted other compiler operations but we have been very careful to constrain and test these changes.

    • The biggest risk is a function, deep inside the compiler, called ISCONST(). This was updated to improved handling of constants. We have run extensive tests and we have no reported errors from the 1000s of test runs. Any errors reported by ISCONST() routine were identified as actual constant errors ( in the test programs )... which is a good thing. So, this risk is low. However, we will have to manage any impact via the forum.

    • Where advanced variables functions in the compiler are not supported, we have tried to trap these with error messages. This will stop silent error compilation. An example is AVR support for Singles - the message is.. 'not supported'. There may be places where we need to add more error handling .

    • The HELP is completed. It may need improvement but it is a start and we wait for feedback.

    • Regarding post release Support. We work as hard as we can with any support requests via the Forum

    Constraints

    1. Only chips with lots of RAM will be supported. See item #2.
    2. If someone wants to improve the new routines to reduce RAM usage etc then please do. We can help with regression testing but I am certain folks can improve our work.
    3. If someone wants DOUBLE support in the user program then they can write any supporting functions. We have focused on providing Single support in the user program. All variable types can be used in libraries or included file. You will may hit issues, so, fix them and let us know.
    4. If someone wants AVR support then they can do it. Multi/Divide/Compare in ASM is needed. The compiler is ready for the ASM.
    5. The demos are there and folks should use them and learn from them.

    As always, enjoy... this mega release.

     
  • Angel Mier

    Angel Mier - 2024-03-17

    New Update with floats beta is available on DEV channel.
    Tool Chain Build: 1368
    Version: 1.01.09

    This is the candidate to become 1.01.09 on mainstream and other channels in a few days, so please provide feedback if any bug is found before the release to the stable channel.

    Angel

     

    Last edit: Angel Mier 2024-03-17
  • Marco Goudriaan

    Marco Goudriaan - 2024-03-17

    I get an error invalid variable type: SINGLE ? I have updated to to build 1368.
    I'am a new to gcbasic so i must be doing something wrong :-))

     
    • Anobium

      Anobium - 2024-03-17

      If you open the Preferences Editor, then select the Compiler tab, you will set a new setting.

      I have do so folks know they turned on a new capability.

      Heads up - we have a new Compiler and String.h - you WILL need these. Also, we are still testing and we know there are issues, so,please ONLY try to used 18FxxK22 or 18FxxK42 other chips seems to have an error in the conditional test routines ( all ASM ).

      If you want to proceed then I will post the new files for you to download.

       

      Last edit: Anobium 2024-03-17
  • Marco Goudriaan

    Marco Goudriaan - 2024-03-17

    Found it, thank you :-)

     
  • Anobium

    Anobium - 2024-03-23

    Testing ... testing will take many days. approx 12 days for range we have selected

    Huge thanks should go to Jim and Clint.

    See this video for an insight into the testing progress.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.