English
Bugs and vermeintliche

actually Version: XProfan X4

Rundung with Int

 

Jörg
Sellmeyer
Profanhilfe Int (n)
Ganzzahliger share of n. it'll not gerundet.

SubProc Get.of/ one

    Parameters Zahl&&
    declare f!
    Var Divisor& = 10
    f! = (Zahl&& / Divisor& - Int(Zahl&& / Divisor&))
    Zahl&& = (Zahl&& / Divisor& - Int(Zahl&& / Divisor&)) * Divisor&
    Return (f! * Divisor&)

ENDPROC

SubProc Get.tenner

    Parameters Zahl&&
    declare f!
    Var Divisor& = 100
    f! = (Zahl&& / Divisor& - Int(Zahl&& / Divisor&))
    Zahl&& = (Zahl&& / Divisor& - Int(Zahl&& / Divisor&)) * Divisor&
    Return (f! * Divisor&)

ENDPROC

Print Int(Get("Einer",2020))
Print "Warum comes here only 19 out?"
Print Int(Get("Zehner",2020))
Print
Print Get("Einer",2020)
Print "Als Floatausgabe correctly...."
Print Get("Zehner",2020)
Print "und with Round auch"
Print Int(Round(Get("Zehner",2020),0))
WaitInput
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
05/24/18  
 




RGH
Hi,

the lying on it, that not any Ganzzahlen a exakte interne bit-correspondence as Fließkommazahl having.

(this is too the reason, Why compare of Fließkommazahlen with Ganzzahlen gladly moreover weg and never akin go should.)

These Lines show the trouble:
CLS
Var Zahl& = 2020
Var Divisor& = 100
set("decimals",15)
print "  ";Zahl& / Divisor&
set("decimals",6)
print "  ";Zahl& / Divisor&
WaitInput
end

with the Defaulteinstellung of 6 Nachkommastellen, falls not so slight on. with Round() can itself the trouble bypass.

I have long in the Finanzbranche program and there was a stetige entrapment, The on eachone corner hereon waited, that one hineinfällt. The problem is also available in JAVA, Delphi or C, there it with the internen statement of Fließkommazahlen the Prozessors To do has.
some Languages afford for rundungsfehlerfreie Berechnungen therefore BCD-Arithmetik on.

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/24/18  
 




Jörg
Sellmeyer
thanks, the declared it.

here  [...]  are a couple Opportunities, around the without Rundungsprobleme To solve.
 
XProfan X3
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
05/24/18  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.068 Views

Untitledvor 0 min.
Stringray01/05/22
RGH07/05/20
Jörg Sellmeyer06/24/20
Rolf Koch01/15/20
More...

Themeninformationen

this Topic has 2 subscriber:

Jörg Sellmeyer (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