English
Forum

Float-trouble, or not?

 

CompileMarkSeparation
Declare x!,y!,a!,b!
Cls
showmax
a!=0
b!=-20
x!=0
y!=-10

Whileloop 100

    y!=y!-0.1

EndWhile

If ((x!=a!) and (y!=b!))

    Print "Ist gleich"

EndIf

decimals 20
Print x!,y!,a!,b!
WaitInput
The code shows unfortunately not is same on, but it should.

by the Decimals-row heave I forth Why the Print not carryed out becomes.
 
05/05/06  
 




RGH
Hello David,

the Print X!,Y!,A!,B! shows Yes right explicit, Why Y! even still mismatched B! is. with Floats (= double in others Languages) are even not any values 100%ig exakt darzustellen. The accuracy is hold on 15 to put terminable. by the mehrmalige addition with 0.1 summiert itself with Y! the Error on a inaccuracy in the 16. place, sodaß the result even not exakt -20 is, separate even -20.000000000000035.
with Fließkommazahlen ought to one therefore never on equality Verify, separate always on >=, <=, etc.
the meets in the übrigen on any Programmiersprachen To, The in the normal no BCD-Dartstellung of Fließkommazahlen afford.
(An exception was PowerBasic for DOS, which Fließkommazahlen in the BCD-stature darstellte.)

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
05/05/06  
 



Jut!

means with round or. with int(f!*1x) gerundet vergleichen, so komm I clear.
 
05/05/06  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

564 Views

Untitledvor 0 min.

Themeninformationen

this Topic has 2 subscriber:

iF (2x)
RGH (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie