| Off Topic > Off Topic |
| Programming Megathread |
| << < (155/241) > >> |
| Otis Da HousKat:
--- Quote from: Flowey on July 07, 2016, 11:45:21 AM ---Where the forget is Torque? --- End quote --- https://en.wikipedia.org/wiki/Torque_(game_engine) https://en.wikipedia.org/wiki/Torque |
| Foxscotch:
--- Quote from: SetGaming on July 07, 2016, 11:49:44 AM ---the scripting language that blockland uses --- End quote --- --- Quote from: Otis Da HousKat on July 07, 2016, 12:49:36 PM ---https://en.wikipedia.org/wiki/Torque_(game_engine) https://en.wikipedia.org/wiki/Torque --- End quote --- WHERE |
| Otis Da HousKat:
--- Quote from: Foxscotch on July 07, 2016, 01:22:55 PM ---WHERE --- End quote --- If you read the wikipedia page you'd know that torque is located on the perpendicular axis to the acting force and position vectors. |
| Metario:
--- Quote from: Flowey on July 07, 2016, 11:45:21 AM ---Where the forget is Torque? --- End quote --- it's approximately right there |
| Maxwell.:
bumping this cause why not, my function here can't seem to round down to 2 decimal places --- Quote from: vb.net ---Public Class Form1 Dim vara As Integer Dim varb As Integer Dim varc As Integer Dim root1 As Decimal Dim root2 As Decimal Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Clear() vara = InputBox("Enter a") varb = InputBox("Enter b") varc = InputBox("Enter c") quadrat(vara, varb, varc, root1, root2) ListBox1.Items.Add("Root 1: " & root1 & " Root 2: " & root2) End Sub Function quadrat(ByVal vara As Integer, ByVal varb As Integer, ByVal varc As Integer, ByRef root1 As Decimal, ByRef root2 As Decimal) '(-b +- sqrt(b^2 - 4ac)) / 2 root2 = (-varb - Math.Sqrt((varb ^ 2) - (4 * vara * varc))) / 2 root1 = (-varb + Math.Sqrt((varb ^ 2) - (4 * vara * varc))) / 2 Decimal.Round(root1, 2, MidpointRounding.AwayFromZero) Decimal.Round(root2, 2, MidpointRounding.AwayFromZero) Return root1 & root2 End Function Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ListBox1.Items.Clear() For counter = 1 To 10 vara = (9 * Rnd() + 1) + 1 varb = (9 * Rnd() + 1) + 1 varc = (9 * Rnd() + 1) + 1 quadrat(vara, varb, varc, root1, root2) ListBox1.Items.Add("Root 1: " & root1 & " Root 2: " & root2) Next End Sub End Class --- End quote --- it's giving really, really long decimal values instead and I can't seem to get it to work even though I've tried googling, could it be cause I'm rounding inside the function and then returning it or what help --- Quote from: Metario on July 10, 2016, 10:58:30 AM ---it's approximately right there --- End quote --- lmfao EDIT: got it working, I just ended up rounding inside both of the add items functions |
| Navigation |
| Message Index |
| Next page |
| Previous page |