How many digit after the comma a negative float variable can take


Yesterday 23:32
Forum: The Lounge
Starter: shantanu@india
Views: 0
Replies: 12
Yesterday 18:31
Forum: Proton Plus Compiler v3
Starter: Valter
Views: 0
Replies: 1
Yesterday 17:27
Forum: SnapShot
Starter: towlerg
Views: 0
Replies: 53
Yesterday 15:57
Forum: Proton Plus Compiler v3
Starter: gtv_pic
Views: 0
Replies: 20
Yesterday 14:55
Forum: Proton Plus Compiler v3
Starter: kuhrig
Views: 0
Replies: 1
Yesterday 02:48
Forum: Proton Plus Compiler v3
Starter: BenBarber
Views: 4587
Replies: 41
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member yvesmazzon's Avatar
    Join Date
    Jul 2006
    Posts
    183
    Thumbs Up
    Received: 9
    Given: 24
    Total Downloaded
    7.57 GB

    0 Not allowed!

    Default How many digit after the comma a negative float variable can take

    Hello Picsters,

    How many digit after the comma a negative float variable can take or what precision?

    Regards,

    Yves

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    414
    Thumbs Up
    Received: 79
    Given: 0
    Total Downloaded
    205.07 MB

    0 Not allowed!

    Default Re: How many digit after the comma a negative float variable can take

    If you're talking about the decimal point position, it really doesn't matter much where it is until you start to approach the extreme end of the range (E+-38, or there abouts). You get 6-7 decimal digits total.

    Keep that in mind if you do operations with variables that cover a wide range (ie large number + small number).

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,629
    Thumbs Up
    Received: 116
    Given: 31
    Total Downloaded
    3.15 GB

    0 Not allowed!

    Default Re: How many digit after the comma a negative float variable can take

    Yves,
    The important thing to understand is Significant Figures.
    The accuracy of floating point maths available in PDS runs out after 6 or 7 significant figures.
    Look up "Rules for significant figures" in Google then choose the www.nku.edu option as a useful one.
    The tricky part is understanding when zero is significant or not.
    John
    Last edited by John Drew; 7th February 2019 at 03:02. Reason: Typo, my phone can't spell

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Fanatical Contributor Les's Avatar
    Join Date
    Feb 2002
    Posts
    3,158
    Thumbs Up
    Received: 360
    Given: 130
    Total Downloaded
    1.53 GB

    0 Not allowed!

    Default Re: How many digit after the comma a negative float variable can take

    That's one of the reasons I created 64-bit floating point in Proton24. I'm sure it was John, who was developing astronomical equipment and he wanted a bit more accuracy, so I decided to create the 64-bit floats. Because they operate on the 16-bit architecture of the PIC24 and dsPIC devices, they are very fast to operate and very accurate. In Proton24, they are named "Double"

    An 8-bit device is not suitable for 64-bit floating point IMO, because they take so much room up and are quite complex so will be quite slow on any 8-bit microcontroller platform.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,629
    Thumbs Up
    Received: 116
    Given: 31
    Total Downloaded
    3.15 GB

    0 Not allowed!

    Default Re: How many digit after the comma a negative float variable can take

    The 64 bit floats in Proton 24 work a treat and give great accuracy. The orbit of the moon is really complex and there are hundreds of lines of code so accuracy is critical. The moon is is one of the most difficult astronomical bodies to track. Because it's moving the calculations also need to be fast because1 sec updates are necessary. The P24 series are ideal with Les's double floats.
    John

    If any users make use of Floats I recommend reading this article in Microchip Developers:http://microchipdeveloper.com/c:unde...epresentations
    Last edited by John Drew; 8th February 2019 at 05:38.

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Member yvesmazzon's Avatar
    Join Date
    Jul 2006
    Posts
    183
    Thumbs Up
    Received: 9
    Given: 24
    Total Downloaded
    7.57 GB

    0 Not allowed!

    Default Re: How many digit after the comma a negative float variable can take

    Thank you all

    Yves

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,317
    Thumbs Up
    Received: 116
    Given: 43
    Total Downloaded
    1.31 GB

    0 Not allowed!

    Default Re: How many digit after the comma a negative float variable can take

    For expected precision on today's larger and faster PICs see NBitMath for calculation values of up to 31 bytes wide with no rounding down etc.

    For display and step by step debugging see macroFORMAT which converts the up to 31 bytes wide values into a string.

    Norm

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Problem for Print or Float variable
    By SELCUK in forum Proton Plus Compiler v3
    Replies: 10
    Last Post: 31st May 2009, 19:07
  2. Float variable
    By Dave-S in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 11th September 2007, 23:43
  3. Float variable
    By Dave-S in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 11th June 2007, 12:40

Members who have read this thread since 12th March 2019, 14:06 : 0

Actions :  (Set Date)  (Clear Date)

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts