Thread: INFINITY micro

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    INFINITY micro

    Hi guys, I'm totally in shock that in C programming there's what's called "INFINITY micro" which it means infinity as we have in mathematics.

    My question and sorry for that silly question, how does PC/compiler assign INFINITY value whenever it's INFINITY ? is it just assigning it as big big big number which can deal with it as INFINITY ? I mean how PC/compiler consider INFINITY as?
    In math INFINITY just a concept .. a bigger bigger number .. but in PC sounds different

    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,176
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2019
    Posts
    722
    This applies just to floating point types. There are 4 "classes" of values: sub normals, normalized, NANs and INFINITYs. As in math, INFINITY isn't a number, but a "concept".

    There are 3 major binary representations of floating point types: single precision (float), double precision (double) and extended precision (long double). Some processors and compilers support 3 more: half precision (__fp16) and quad precision (__float128) and octuple precision (I never seen an implementation of this type), all defined by the latest revision of IEEE 754 (2008), but they are implemented optionally. They aren't standarized on ISO 9989.

    To understand how these types are structured, you can see these links (Half Precision, Single Precision, Double Precision, Extended Precision -- and Quadruple Precision)... Octuple precision is rarely implemented.

    Another great source of knowledge about floating point is David Goldberg's article What every computer scientist should know about floating point.

    A good book with a lot of information about floating point is this: Handbook of floating point arithmetic.

    I recomend all these references to everyone who wishes to understand what a floating point really is (they are not containers for "real" numbers)...

  4. #4
    Registered User
    Join Date
    Feb 2019
    Posts
    722
    Ahhh... another thing you'll be shocked! Since C99 "complex" floating point is supported:
    Code:
    #include <complex.h>
    complex double x = 1.0 + I; // I or J are valid "imaginary" parts
    And there are math functions which deals with complex numbers (csqrt(), csin(), ccos(), ...)...
    Last edited by flp1969; 05-03-2019 at 09:17 AM.

  5. #5
    Banned
    Join Date
    Apr 2015
    Posts
    596
    thank you all!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming a micro controller in C
    By Shubham Pandey in forum C Programming
    Replies: 3
    Last Post: 11-25-2012, 05:11 PM
  2. tan(pi/2) = infinity; now try to do this is C
    By MatthewDoucette in forum C Programming
    Replies: 16
    Last Post: 04-18-2006, 03:18 AM
  3. Micro seconddelays
    By aspirantnew in forum C Programming
    Replies: 2
    Last Post: 03-01-2006, 12:20 PM
  4. infinity
    By Unregistered in forum C++ Programming
    Replies: 10
    Last Post: 06-01-2002, 01:35 PM

Tags for this Thread