English
Source / code snippets

Bruchnäherung from Point numbers

 

p.specht

Näherungsalgorithmus through undertow. "Naive Bruchaddition".
(Verträgt yet no negativen numbers!)
Window Title "  BRUCHNÄHERUNG PER ´NAIVE ADDITION ZÄHLER+ZÄHLER & NENNER+NENNER"
AppendMenubar 101,"  Early Alpha version!!!       particular Zahlenwerte:  Pi,  E "
'(CL) Copyleft 2020-12 by P.woodpecker, Vienna/Austria. without each warranty.
Declare x!,xint!,xfrac!,eps! , Z&,N&, Zu&,Nu&, Zo&,No& , w$,v$
New:
Clear x!,xint!,xfrac!,eps! , Z&,N&, Zu&,Nu&, Zo&,No& , w$,v$
Cls Rgb(200+Rnd(56),200+Rnd(56),200+Rnd(56)):Set("decimals",17)
Font 0
Print "\n\n\n   Vorfrage: On wieviele to put very to the fraction voices?: ";:Input v$

If v$="":v$="10":EndIf'default, accuracy 10 Kommastellen

    eps!=Val("1E-"+v$)
    Print "\n Max.Error epsilon = ";stature$("%g",eps!)
    hop:
    Font 2
    Print "\n your Zahlenwert: ",:Input w$
    w$=Translate$(w$,",",".")

    If Upper $(w$)="PI":w$=Str $(Pi()):Print w$:EndIf

        If Upper $(w$)="E":w$=Str $(Exp(1)):Print w$:EndIf

            x!=Val(w$)

            If x!=0:Goto "New":EndIf

                xint!=Int(x!):xfrac!=x!-xint!
                Zu&=0:Nu&=1:Zo&=1:No&=1:N&=1
                Nochma:

                If Abs(xfrac!-Z&/N&)<eps!

                    Cls Rgb(200+Rnd(56),200+Rnd(56),200+Rnd(56))
                    Print "\n\n Result (on ";v$;" Kommastellen): "
                    Print "\n ";stature$("%g",x!);" ~~ ";
                    Case xint!:Print Int(xint!);
                    case (Z&<>0) And (xint!<>0):print " & ";
                    Case Z&:Print Z&;"/";N&;
                    Print:Print:WaitInput:cls:Goto "hop"

                EndIf

                Z&=Zu&+Zo&:N&=Nu&+No&

                If xfrac!<(Z&/N&)

                    Zo&=Z&:No&=N&

                ElseIf xfrac!>(Z&/N&)

                    Zu&=Z&:Nu&=N&

                EndIf

                Print Z&;"/";N&

                If %csrlin>27:cls:EndIf

                    Goto "nochma"
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/30/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.417 Views

Untitledvor 0 min.
Erhard Wirth06/14/24
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (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