Results 1 to 5 of 5

Thread: keep from rounding

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    Minnesota
    Posts
    86

    keep from rounding

    I have some formulas outputting to a text box. The numbers keep rounding up. How do I stop this?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    supply the code or we won't know what went wrong
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    Minnesota
    Posts
    86
    Pi = 3.14159

    major = txtmajor.Text
    minor = txtminor.Text
    t = txtdia.Text
    p = txtpitch.Text
    z = txtflutes.Text
    f = txtchipload.Text
    v = txtsfm.Text
    cl = txtclearance.Text
    n = (v * 12) / (Pi * t) 'rpm
    f1 = f * z * n
    f2 = f1 * (major - t) / major 'feed
    ri = minor / 2
    ro = major / 2
    re = ((ri - cl) ^ 2 + ro ^ 2) / (2 * ro)
    D = 20 / major / p
    a = Pi * major / 4
    r = a * (Tan(D * (Pi / 180)))
    p1 = 1 / p
    x = 0
    y = (ri - cl) * (-1)
    ro1 = ro * (-1)

    txtprogram.Text = "N10 G90 G0 X0 Y0 Z0" & vbCrLf & "G91 G41 D" & txtdvalue.Text & " X0 Y" & Format(y, ".0000") & " Z0" & vbCrLf & "G3 X" & Format(ro, ".0000") & " Y" & Format(re, ".0000") & " Z? R" & Format(re, ".0000") & " S" & Format(n, "0.") & " F" & Format(f2, "0.") & vbCrLf & "G3 X0 Y0 Z" & Format(p1, ".0000") & " I" & Format(ro1, ".0000") & " J0" & vbCrLf & "G3 X" & Format(ro1, ".0000") & " Y" & Format(re, ".0000") & " Z? R" & Format(re, ".0000") & vbCrLf & "G0 G40 X0 Y" & Format(y, ".0000") & " Z0" & vbCrLf & "M1"

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Whoa! That looks heavy
    Where's the declarations of each and one of the variables?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    looks to me like you are telling them to round up with the Format Functions. Get rid of the formats and they shouldn't round up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width