Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
new approach to base conversion system and math library
#3
this is what I got so far I decided to upgrade it to a base 2 - 100 conversion program it does not some to be functioning properly I need help there seems to be an error at or after reloop2 can you see what that error is?
Code: (Select All)
Dim nmbr$1(63, 511)
Dim avail$1(99)
Dim cnvtbk~%%(255)
For s = 0 To 255
    cnvtbk~%%(s) = 255
Next s
For s = 0 To 78
    cnvtbk~%%(s + 48) = s
    avail$1(s) = Chr$(s + 48)
Next s
laze$ = "!$%&()*/"
For pel% = 224 To 236
    laze$ = laze$ + Chr$(pel%)
Next pel%
For s = 79 To 99
    p% = Asc(Mid$(laze$, s - 78, 1))
    cnvtbk~%%(p%) = s
    avail$1(s) = Chr$(p%)
Next s
Print "    0123456789"
For s = 0 To 9
    Print Chr$(s + 48); "  ";
    For t = 0 To 9
        If (s * 10 + t) <= 99 Then
            Print avail$1(s * 10 + t);
        End If
    Next t
    Print ""
Next s
ing$ = ""
While ing$ = "": ing$ = InKey$: Wend
Print "enter each number using the format Base sign(+ or -) whole part . then fractional part terminat the number with a #"
Print "use a decimal point as a decimal point the sign be included if omitted the number is assumed to be positive"
Print "use the chart shown to determine digits in the number , for the base use the actual symbol or number that corresponds"
Print "to the highest number reachable in the base used so a 1 for base means base 2 6 for base 7  9 for base 10 and so on"
Print "this can handle up to base 81 for example pi in base 81 is given as /3.;U/# this to 4 base 81 places"
Print " or thata same value pi in base 81 can be /+3.;U/# a negative value would be like this 9-57.94# to indicate -57.94 in base 10"
Print "this program will take 2 numbers you enter in and multiply them max number of digits is 512 bit equivelent total and will output"
Print " the answer in whatever base you chose"
Print "target base : ";
bse$ = getbas$
Print "first number : ";
num1$ = getnum$
Print "second number : ";
num2$ = getnum$
If 6.33985 * (Len(data1$) + Len(data2$) - 8) > 512 Then Print "numbers are too large"


Data 33,36,37,38,40,41,42,47  '79,80,81,82,83,84,85,86
Data 224,225,233,235        '87,88,89,90


Function getnum$ ()
    num$ = ""
    hiasc = 0
    reloop: wi$ = ""
    While wi$ = ""
        wi$ = InKey$
    Wend

    If hiasc = 1 Then
        wi$ = ""
        While wi$ = ""
            wi$ = InKey$
            If wi$ = "0" Then
                wi$ = Chr$(224)
                Print wi$;
            End If
            If wi$ = "1" Then
                wi$ = Chr$(225)
                Print wi$;
            End If

            If wi$ = "2" Then
                wi$ = Chr$(226)
                Print wi$;
            End If

            If wi$ = "3" Then
                wi$ = Chr$(227)
                Print wi$;
            End If

            If wi$ = "4" Then
                wi$ = Chr$(228)
                Print wi$;
            End If
            If wi$ = "5" Then
                wi$ = Chr$(229)
                Print wi$;
            End If
            If wi$ = "6" Then
                wi$ = Chr$(230)
                Print wi$;
            End If
            If wi$ = "7" Then
                wi$ = Chr$(231)
                Print wi$;
            End If
            If wi$ = "8" Then
                wi$ = Chr$(232)
                Print wi$;
            End If
            If wi$ = "9" Then
                wi$ = Chr$(233)
                Print wi$;
            End If
            If wi$ = "A" Then
                wi$ = Chr$(234)
                Print wi$;
            End If
            If wi$ = "B" Then
                wi$ = Chr$(235)
                Print wi$;
            End If
            If wi$ = "C" Then
                wi$ = Chr$(236)
                Print wi$;
            End If
            hiasc = 0
        Wend
    End If
    If Asc(wi$) > 47 And Asc(wi$) < 127 Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "+" Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "-" Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "." Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "#" Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If Asc(wi$) > 127 Then num$ = num$ + wi$
    If wi$ = Chr$(39) Then hiasc = 1
    If wi$ <> "#" Then GoTo reloop
    getnum$ = num$
End Function


Function getbas$ ()
    num$ = ""
    hiasc = 0
    reloop2: wi$ = ""
    While wi$ = ""
        wi$ = InKey$
    Wend

    If hiasc = 1 Then
        wi$ = ""
        While wi$ = ""
            wi$ = InKey$
            If wi$ = "0" Then
                wi$ = Chr$(224)
                Print wi$;
            End If
            If wi$ = "1" Then
                wi$ = Chr$(225)
                Print wi$;
            End If

            If wi$ = "2" Then
                wi$ = Chr$(226)
                Print wi$;
            End If

            If wi$ = "3" Then
                wi$ = Chr$(227)
                Print wi$;
            End If

            If wi$ = "4" Then
                wi$ = Chr$(228)
                Print wi$;
            End If
            If wi$ = "5" Then
                wi$ = Chr$(229)
                Print wi$;
            End If
            If wi$ = "6" Then
                wi$ = Chr$(230)
                Print wi$;
            End If
            If wi$ = "7" Then
                wi$ = Chr$(231)
                Print wi$;
            End If
            If wi$ = "8" Then
                wi$ = Chr$(232)
                Print wi$;
            End If
            If wi$ = "9" Then
                wi$ = Chr$(233)
                Print wi$;
            End If
            If wi$ = "A" Then
                wi$ = Chr$(234)
                Print wi$;
            End If
            If wi$ = "B" Then
                wi$ = Chr$(235)
                Print wi$;
            End If
            If wi$ = "C" Then
                wi$ = Chr$(236)
                Print wi$;
            End If
            hiasc = 0
        Wend
    End If
    If Asc(wi$) > 47 And Asc(wi$) < 127 Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "+" Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "-" Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "." Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If wi$ = "#" Then
        num$ = num$ + wi$
        Print wi$;
    End If
    If Asc(wi$) > 127 Then num$ = num$ + wi$
    If wi$ = Chr$(39) Then hiasc = 1
    If hiasc = 1 Then reloop2
        getbas$ = num$
End Function
Reply


Messages In This Thread
RE: new approach to base conversion system and math library - by Dragoncat - 07-16-2025, 10:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Keyhit to Inkey Conversion Project Pete 7 595 01-11-2026, 01:26 AM
Last Post: Pete
  3D Sun-Earth-Moon System (_MAPTRIANGLE3D) Magdha 8 747 11-11-2025, 10:09 AM
Last Post: Magdha
  QB UI Library aadityap0901 6 1,187 08-02-2025, 05:13 PM
Last Post: aadityap0901
  Everything Date Library in progress SMcNeill 2 719 05-14-2025, 08:36 PM
Last Post: SMcNeill
  universal base conversion program possibly for a base conversion library later on Dragoncat 22 3,068 04-24-2025, 02:08 AM
Last Post: Dragoncat

Forum Jump:


Users browsing this thread: 1 Guest(s)