🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309448

Re: chunk2int (or str2int) how it SHOULD work?

#309448
From: (fir)
Date: Fri, 15 Sep 2017 18:32
52 lines
4649 bytes
W dniu piątek, 15 września 2017 16:52:03 UTC+2 użytkownik (fir) napisał:
> 
> to wyglada jako tako ok ale faktycznie jest problem z kwestiÄ… floatow, chyba faktycznie byloby lepiej gdyby
> takie kawalki jak "1.23e6" 12.34" 'parsowalo' od razu jako floata i jedynie przed zwroceniem wyniku rzutowalo na inta ustawiajac ew flage .zaszlo_rzutowanie_z_floata (ew jest tez opcja moze zostawienie tego i dorobienia drugiej funkcji Chunk2Double, ktos wie moze czy da sie to latwo przerobic na wersje doublowÄ… (nie googlowalem jeszcze a z glowy nie pamietam czym sie wczytywalo double))

funkcje dla daubli da sie zrobic niemal bez zmian wzgledem powyzszego na strtod (trzeba tylko w tej funkcji do pomijania junkow zrobic by nie pomijala kropki jesli jest nastÄ…piana digitem)

jednakowoz ta funkcja da dabli lyka dable ale wysypuje sie na hexach (0x-ach)

                 1         1.000000
                 2         2.000000
                 3         3.000000
                 4         4.000000
                a1         1.000000   polluted left
                a2         2.000000   polluted left
                a3         3.000000   polluted left
                3d         3.000000   polluted right
                3h         3.000000   polluted right
              0xff         0.000000   polluted right
            0xffff         0.000000   polluted right
                0x         0.000000   polluted right
          0b111001         0.000000   more numbers   polluted right
               1e4     10000.000000
             -0x45        -0.000000   more numbers   polluted right
                -2        -2.000000
                a-              nil
                3-         3.000000   polluted right
                4-         4.000000   polluted right
               --5        -5.000000   polluted left
                 -              nil
                 6         6.000000
                 -              nil
               a2a         2.000000   polluted left   polluted right
            a-22-3       -22.000000   more numbers   polluted left
              3f4f         3.000000   more numbers   polluted right
               (2)         2.000000   polluted left   polluted right
                +6         6.000000   polluted left
               )89        89.000000   polluted left
               =78        78.000000   polluted left
                *4         4.000000   polluted left
                ^4         4.000000   polluted left
        7123456789  7123456789.000000
       0x223344556         0.000000   more numbers   polluted right
                 8         8.000000
                 9         9.000000
              0.23         0.230000
               .84         0.840000
              .12.         0.120000   polluted right
               .23         0.230000

nie wiem czy w obliczu tej sytuacji jak przedstawiona wchodzic dalej w ten temat czy nie warto - jako ze te dwie funkcje nie udostepniaja idealnej funkcjonalnosci ale udostepniaja tez jednak pewnÄ… funkcjonalnosc w wiekszosci wypadkow wystarczajacÄ…
(sporo lepsza niz czyste atoi/atof strtol/strtod)
Technical Details
Message-ID: <90922fcd-3be5-46d0-99a9-aaa05ca89f16@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!o200no760102itg.0!news-out.google.com!x15ni291qth.1!nntp.google.com!q8no863886qtb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <f762205f-d614-4267-813a-f181066a6ae2@googlegroups.com> <d8c69713-0a0f-4664-8349-1ddd667e401f@googlegroups.com> <e8a3e9ca-4ad0-4afa-aad8-9cb5e69f2a66@googlegroups.com>

Show Full Headers
Complete Article Headers
X-Received: by 10.98.160.204 with SMTP id p73mr13618396pfl.7.1505500344483;        Fri, 15 Sep 2017 11:32:24 -0700 (PDT)
X-Received: by 10.31.48.205 with SMTP id w196mr284354vkw.13.1505500344409; Fri, 15 Sep 2017 11:32:24 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!o200no760102itg.0!news-out.google.com!x15ni291qth.1!nntp.google.com!q8no863886qtb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.c
Date: Fri, 15 Sep 2017 11:32:24 -0700 (PDT)
In-Reply-To: <e8a3e9ca-4ad0-4afa-aad8-9cb5e69f2a66@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=5.172.255.134; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.134
References: <f762205f-d614-4267-813a-f181066a6ae2@googlegroups.com> <d8c69713-0a0f-4664-8349-1ddd667e401f@googlegroups.com> <e8a3e9ca-4ad0-4afa-aad8-9cb5e69f2a66@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <90922fcd-3be5-46d0-99a9-aaa05ca89f16@googlegroups.com>
Subject: Re: chunk2int (or str2int) how it SHOULD work?
From: "(fir)" <profesor.fir@gmail.com>
Injection-Date: Fri, 15 Sep 2017 18:32:24 +0000
Lines: 64
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit