## Search found 236 matches

- Jul 02, 2018 19:03
- Forum: General
- Topic: Useful defines
- Replies:
**18** - Views:
**1246**

### Re: Useful defines

Although not defines, I'll contribute some of my favorite flavors of MOD for real numbers with Ceiling/Floor support. ' ======================================================================================== ' Force modulus x into the range a..b for Real Numbers ' =================================...

- Jun 26, 2018 22:28
- Forum: General
- Topic: 52 card shuffle
- Replies:
**22** - Views:
**1119**

### Re: 52 card shuffle

@IvorU The include file GMP_INT.bi , has a GMP_rnd and fac() function that can be used to create a random number Fac(n) calculates the factorial of n. GMP_rnd(n) return a integer number in the range from 0 to n-1. A little program to show how it can be done. #Include"gmp_int.bi" ' without ...

- Feb 10, 2018 23:12
- Forum: General
- Topic: PI calc try
- Replies:
**8** - Views:
**571**

### Re: PI calc try

@counting_pine I hope this will answer the questions that you have about this program. bluetigro listing with minimal changes, working but slow. '' BLUATIGRO 30 JAN 2018 '' PI '' frisian 9 feb 2018 minimal changes to get program working Dim Shared As Integer numdigits Const As String z10 = "000...

- Feb 10, 2018 22:44
- Forum: General
- Topic: piramid - piramid = 1 kokonut
- Replies:
**4** - Views:
**345**

### Re: piramid - piramid = 1 kokonut

@integer This is my interpretation of the description given by bluatigro. You have a four sided stack of coconuts (or cannon balls) of a certain height containing X amount of coconuts and you need to construct a three sided stack with X - 1 coconuts. How many are needed and how high are the stacks. ...

- Feb 06, 2018 19:56
- Forum: General
- Topic: PI calc try
- Replies:
**8** - Views:
**571**

### Re: PI calc try

I have made bluatigro's code working. '' BLUATIGRO 30 JAN 2018 '' PI '' Frisian 3 FEB 2018 made it work. '' some speedups, tweaks and trimmed output from subs Dim Shared As Integer numdigits Sub arraymulty( ByRef inuit As String , ByRef m As Integer ) Dim As Integer c , p , h Dim As String uit For p...

- Sep 14, 2017 20:14
- Forum: Tips and Tricks
- Topic: Bresenham3D
- Replies:
**3** - Views:
**454**

### Re: Bresenham3D

BasicCoder2 Your program contains for i as integer = 0 to l that should be for i = 0 to l . The i in for i as integer = 0 to l is a different one then the one in dim as integer i . Here is a other Bresenham in 3D that is much simpler. You should have a look there, it's a simple clear page with simpl...

- Sep 12, 2017 16:02
- Forum: General
- Topic: Sha-256 QB
- Replies:
**15** - Views:
**1159**

### Re: Sha-256 QB

I don't have at this moment time to give a explanation of the changes I made but it should not be hard to spot them. The extra code makes the program slow but there is room for some speedup. 'SHA-256 OPTION EXPLICIT FUNCTION SHL&(x AS LONG, n) ' SHL& = x * 2 ^ n DIM x1 AS DOUBLE IF x < 0 THE...

- May 22, 2017 21:01
- Forum: Tips and Tricks
- Topic: Big Number Wrapper (GMP_INT.BI)
- Replies:
**3** - Views:
**746**

### Re: Big Number Wrapper (GMP_INT.BI)

srvaldez wrote:hello frisian, you need a constructor for the fp2 type.

Thanks for the code example, the only thing I knew that it needed a constructor through the error messages I got from my try's. But I had no idea how and where to put it.

- May 20, 2017 21:20
- Forum: Beginners
- Topic: Always for me a Big question
- Replies:
**28** - Views:
**1848**

### Re: Always for me a Big question

srvaldez wrote:thank you frisian for the update, perhaps you should post it in the tips & tricks section?

I have updated my GMP_INT.BI version in the tips and tricks section.

http://www.freebasic.net/forum/viewtopic.php?f=7&t=25684

- May 18, 2017 20:33
- Forum: Tips and Tricks
- Topic: Big Number Wrapper (GMP_INT.BI)
- Replies:
**3** - Views:
**746**

### Big Number Wrapper (GMP_INT.BI)

updated the GMP_INT.BI code (22 may 2017). (typo's, removed some redundant comments). updated Cipolla.bas to work with the Type code that srvaldez provided. updated the GMP_INT.BI code and added fdiv_cdiv.bas (20 may 2017). I extended Yetifoot's Big number wrapper with lots of new stuff making worki...

- May 06, 2017 9:09
- Forum: Beginners
- Topic: Always for me a Big question
- Replies:
**28** - Views:
**1848**

### Re: Always for me a Big question

[edit] in the test code, next to last line you missed a right parenthesis i = gmp_int(string(128,"1", 2) should be i = gmp_int(string(128,"1"), 2) also you missed a print i fixed the code in my previous post, thanks. I have cleaned the listing of gmp_int.bi and added shl and shr...

- May 05, 2017 21:12
- Forum: Beginners
- Topic: Always for me a Big question
- Replies:
**28** - Views:
**1848**

### Re: Always for me a Big question

Gmp_int.bi has two problems in the floating point division (/) routine. First the gmp floats need a 16 byte structure (__mpf_struct) but they get a 12 byte structure (__mpz_struct) which result in data stored outside the structure and most likely overwriting data in the next structure, hence crashes...

- Jan 12, 2017 21:07
- Forum: Projects
- Topic: Calendar Calculations Class
- Replies:
**4** - Views:
**689**

### Re: Calendar Calculations Class

rpkelly Had a look at your code, nice piece work. At the end of the file you have a function for ceiling a floating point. My suggestion is to replace Function = cmFloor(x * -1) * -1 with Function = -cmFloor(-x) . This will replace two multiplications with two sign change instructions. ' ===========...

- Dec 29, 2016 21:48
- Forum: Beginners
- Topic: How to convert from PowerBasic
- Replies:
**10** - Views:
**994**

### Re: How to convert from PowerBasic

If you search the internet then it's possible to find the code snippet. https://discuss.codechef.com/questions/7349/computing-factorials-of-a-huge-number-in-cc-a-tutorial #include<stdio.h> int main() { int t; int a[200]; //array will have the capacity to store 200 digits. int n,i,j,temp,m,x; scanf(&...

- Dec 28, 2016 13:37
- Forum: Beginners
- Topic: How to convert from PowerBasic
- Replies:
**10** - Views:
**994**

### Re: How to convert from PowerBasic

Working Dim As Integer a(2000), index, i, j, n, tmp, carry Input "Enter factorial: ";n a(0)=1 For j=n To 2 Step -1 carry = 0 For i = 0 To index tmp = (a(i) * j) + carry a(i) = tmp Mod 10 carry = tmp \ 10 Next i While carry > 0 index = index + 1 a(index) = carry Mod 10 carry = carry \ 10 We...