Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > pl.comp.programming > #32595

Re: Porównywanie liczb, double float

From "Pszemol" <Pszemol@PolBox.com>
Newsgroups pl.comp.programming, pl.misc.elektronika
Subject Re: Porównywanie liczb, double float
Date 2019-06-13 08:39 -0500
Organization A noiseless patient Spider
Message-ID <qdtjmb$69t$1@dont-email.me> (permalink)
References <qdqqh6$n2f$1@dont-email.me> <5d00f430$0$17345$65785112@news.neostrada.pl>

Cross-posted to 2 groups.

Show all headers | View raw


"J.F." <jfox_xnospamx@poczta.onet.pl> wrote in message 
news:5d00f430$0$17345$65785112@news.neostrada.pl...
> Użytkownik "Pszemol"  napisał w wiadomości grup 
> dyskusyjnych:qdqqh6$n2f$1@dont-email.me...
>>Sub AlaMaKota(nieważne tutaj argumenty procedury)
>>Dim len as Double
>
>>len = CDbl("tekst wydłubany z RS232") - 1.8
>
>>If len <> CDbl("inny tekst wydłubany z RS232) Then
>>    zgłoś błąd i kapitulujemy... kaput!
>>Else
>>    lecimy z testami talej, wsio w pariadkie
>>Endif.
>
>>Pierwszy tekst z RS232 był 32.8, drugi 31. 32.8-1.8 = 31.
>>Powinno być wszystko ok, bo w matematyce 31 równe jest 31 :-)
>>Wynik porównania VB6 był 31 nie jest równe 31 i program
>>kapitulował...
>
>>Przyczyną błędu była różnica odejmowania wynosząca 15.1234e-15
>
>>Dlaczego konwersja CDbl stringu 31 lub 32.8 dodaje jakieś
>>śmieci do zmiennej double float na 15 miejscu po przecinku??
>>A może odejmowanie stałej 1.8 wprowadza ten błąd?
>>Czy to jest normalne zachowanie się VB6?
>
> To nie jest problem VB, to jest problem przyjetego formatu liczb 
> rzeczywistych.
> Albo problem programisty :-)
>
> 31 jest dokladne, 0.8 nie.
> 0.5 jest dokladne, 0.25 i 0.75 itd - ale wiekszosc liczb "dziesietnych po 
> przecinku" niestety nie.
>
> Po prostu nie da sie zapisac 32.8 dokladnie.
> Programista ma o tym wiedziec i sie zabezpieczyc :-)
>
>>Czy inne Visuale jak VC++ lub VC# też tak mają?
>
> To jest problem procesora z FP IEEEcostam.

Teraz jak czytam co napisałeś to wydaje się to oczywiste.
Ale taki byłem szczęśliwy że wreszcie znalazłem buga i uruchomiłem
program że samamu mi się ta klapka w mózgu nie odklapiła - dzięki. 

Back to pl.comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-12 07:17 -0500
  Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-12 12:29 +0000
    Re: Porównywanie liczb, double float queequeg@trust.no1 (Queequeg) - 2019-06-12 14:53 +0000
    Re: Porównywanie liczb, double float Cezary Grądys <czarekgr@wa.onet.pl> - 2019-06-12 16:54 +0200
      Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:40 +0200
        Re: Porównywanie liczb, double float bartekltg <bartekltg@gmail.com> - 2019-06-16 18:44 -0700
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:15 +0200
        Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-17 09:43 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:20 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:59 +0200
        Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-17 16:14 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:32 +0200
        Re: Porównywanie liczb, double float DMR <mezzogm@gmail.com> - 2019-07-11 22:27 -0700
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-07-13 09:21 +0200
            Re: Porównywanie liczb, double float DMR <mezzogm@gmail.com> - 2019-07-14 01:16 -0700
              Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-07-16 00:05 +0200
          Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 08:24 -0700
            Re: Porównywanie liczb, double float DMR <mezzogm@gmail.com> - 2019-07-24 10:19 -0700
              Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-07-24 21:13 +0200
              Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-24 13:39 -0700
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-07-26 20:35 +0200
          Re: Porównywanie liczb, double float DMR <mezzogm@gmail.com> - 2020-01-12 10:17 -0800
    Re: Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-13 08:37 -0500
      Re: Porównywanie liczb, double float bartekltg <bartekltg@gmail.com> - 2019-06-13 14:22 -0700
        Re: Porównywanie liczb, double float JDX <jdx@onet.pl> - 2019-06-14 06:35 +0200
        Re: Porównywanie liczb, double float Mateusz Viste <mateusz@wont.tell> - 2019-06-14 06:19 +0000
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:53 +0200
            Re: Porównywanie liczb, double float Mateusz Viste <mateusz@wont.tell> - 2019-06-17 07:02 +0000
              Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:18 +0200
                Re: Porównywanie liczb, double float Mateusz Viste <mateusz@wont.tell> - 2019-06-19 07:03 +0000
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:32 +0200
                Re: Porównywanie liczb, double float Mateusz Viste <mateusz@wont.tell> - 2019-06-25 20:05 +0000
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 22:17 +0200
                Re: Porównywanie liczb, double float Mateusz Viste <mateusz@wont.tell> - 2019-06-25 20:45 +0000
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 22:56 +0200
        Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:48 +0200
        Re: Porównywanie liczb, double float Tomasz Kaczanowski <kaczus@poczta.onet.pl> - 2019-06-19 11:21 +0200
      Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:43 +0200
        Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-17 07:21 +0000
        Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-17 09:48 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:21 +0200
            Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-19 09:17 +0200
        Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-17 16:09 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:27 +0200
            Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-19 11:45 +0200
              Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-19 11:40 +0000
                Re: Porównywanie liczb, double float KLoSS <nospam.klossik@alchemy.com.pl> - 2019-06-19 21:51 +0200
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:53 +0200
                Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-26 06:38 +0200
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:51 +0200
              Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:48 +0200
                Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-26 06:10 +0200
        Re: Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-19 19:52 -0500
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:58 +0200
    Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-17 09:39 +0200
      Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-17 07:53 +0000
        Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-17 12:59 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:23 +0200
        Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-17 16:05 +0200
        Re: Porównywanie liczb, double float "Grzegorz Niemirowski" <grzegorz@grzegorz.net> - 2019-06-17 16:25 +0200
          Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-18 01:33 +0200
            Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-18 06:32 +0000
              Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-18 12:04 +0200
                Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-18 12:30 +0000
                Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-18 15:45 +0200
                Re: Porównywanie liczb, double float queequeg@trust.no1 (Queequeg) - 2019-06-18 14:38 +0000
                Re: Porównywanie liczb, double float Piotr Wyderski <peter.pan@neverland.mil> - 2019-06-19 09:04 +0200
                Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-18 16:52 +0200
                Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-18 15:20 +0000
                Re: Porównywanie liczb, double float Roman Tyczka <noemail@because.no> - 2019-06-18 17:54 +0200
                Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 08:03 -0700
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:25 +0200
                Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-26 06:21 +0200
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-07-02 22:56 +0200
                Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-07-03 00:42 +0200
                Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 12:56 -0700
                Re: Porównywanie liczb, double float Marek <fake@fakeemail.com> - 2019-06-18 22:10 +0200
                Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 01:16 -0700
              Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-18 12:11 +0200
                Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:48 +0200
              Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 00:47 -0700
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:43 +0200
        Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 00:37 -0700
      Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:19 +0200
  Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-12 14:44 +0200
    Re: Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-13 08:39 -0500
    Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:19 +0200
      Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-17 16:20 +0200
        Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:37 +0200
          Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-19 11:35 +0200
            Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 21:37 +0200
              Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-26 06:17 +0200
  Re: Porównywanie liczb, double float Zbych <abuse@onet.pl> - 2019-06-12 14:48 +0200
    Re: Porównywanie liczb, double float "Irek.N." <tajny@jakis.taki.jest> - 2019-06-12 14:56 +0200
  Re: Porównywanie liczb, double float bartekltg <bartekltg@gmail.com> - 2019-06-12 06:07 -0700
    Re: Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-13 08:43 -0500
    Re: Porównywanie liczb, double float bartekltg <bartekltg@gmail.com> - 2019-06-13 14:25 -0700
      Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:50 +0200
  Re: Porównywanie liczb, double float JDX <jdx@onet.pl> - 2019-06-12 15:21 +0200
    Re: Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-13 08:24 -0500
  Re: Porównywanie liczb, double float Szyk Cech <szykcech@spoko.pl> - 2019-06-12 16:52 +0200
    Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-12 17:27 +0200
      Re: Porównywanie liczb, double float stary grzyb <starygrzyb@onet.pl> - 2019-06-12 18:17 +0200
      Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-16 21:21 +0200
        Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-17 16:15 +0200
          Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-19 08:34 +0200
      Re: Porównywanie liczb, double float Szyk Cech <szykcech@spoko.pl> - 2019-06-16 22:10 +0200
      Re: Porównywanie liczb, double float Piotrne <piotrne@poczta.onet.pl> - 2019-06-20 14:16 +0200
        Re: Porównywanie liczb, double float Mateusz Viste <mateusz@nie.pamietam> - 2019-06-20 12:38 +0000
          Re: Porównywanie liczb, double float Piotrne <piotrne@poczta.onet.pl> - 2019-06-22 13:36 +0200
          Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-23 14:57 +0200
            Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 22:09 +0200
              Re: Porównywanie liczb, double float "J.F." <jfox_xnospamx@poczta.onet.pl> - 2019-06-26 06:11 +0200
        Re: Porównywanie liczb, double float Janusz <janusz_kk@o2.pl> - 2019-06-20 20:39 +0200
          Re: Porównywanie liczb, double float Piotrne <piotrne@poczta.onet.pl> - 2019-06-22 14:47 +0200
            Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 22:07 +0200
        Re: Porównywanie liczb, double float AK <nobody@nowhere.net> - 2019-06-25 22:03 +0200
    Re: Porównywanie liczb, double float "Pszemol" <Pszemol@PolBox.com> - 2019-06-13 08:35 -0500
      Re: Porównywanie liczb, double float fir <profesor.fir@gmail.com> - 2019-07-22 00:17 -0700
  Re: Porównywanie liczb, double float Dariusz Dorochowicz <_dadoro_@wp.com> - 2019-06-13 17:28 +0200

csiph-web