Page 1 of 1

Harbour and floats

PostPosted: Sat Jan 27, 2018 4:13 am
by dissonantdev
Hello! I'm new here so I hope you guys can lend me a hand if at all possible.

First I should disclose that I know pretty much nothing about Harbour, however I recently became interested in learning about it; so my question might already have an obvious answer!

For those of you that know, how does Harbour represent floats? Does it have any kind of limited-precision or arbitrary-precision decimal type?
I need something either like the limited precision decimal type in C# or something with arbitrary precision like Java's BigDecimal.

I personally use gmplib in C++, can that be used with Harbour?
GMP is a C library, and I think I heard in passing that Harbour can import and use C stuff; anyone that knows?

And last question! I recently found (10 minutes ago) Alexander Kresin's Harbour manual, but I thought I'd ask anyway.
Are there any other recommended resources to learn a bit more about the language?

Thank you for your time!

Re: Harbour and floats

PostPosted: Sat Jan 27, 2018 2:18 pm
by Rick Lipkin
Welcome to the forum .. here is the ( new ) Harbour website .. a good place to start .. documentation, downloads, reference guides and code samples .. enjoy!

Rick Lipkin

https://harbour.github.io/

Re: Harbour and floats

PostPosted: Sat Jan 27, 2018 8:40 pm
by cnavarro
Hello
Welcome to the forum
I am sure that among all the companions we can help you in all the doubts you have
Please, read
viewtopic.php?f=3&t=19688#p103823

Re: Harbour and floats

PostPosted: Sun Jan 28, 2018 6:14 am
by Antonio Linares
1)
https://groups.google.com/forum/#!searchin/harbour-devel/float%7Csort:date
https://groups.google.com/forum/#!searchin/harbour-devel/double%7Csort:date

In hbapi.h:
#define HB_IT_DOUBLE 0x00010
Code: Select all  Expand view
struct hb_struDouble
{
   double value;
   HB_USHORT length;
   HB_USHORT decimal;
};

Search for double in hbapi.h and review all related doubles functions
You may also review hbfloat.h

2) You can use any C library from Harbour:
viewtopic.php?p=63612#p63612
viewtopic.php?p=66183#p66183
viewtopic.php?p=96883#p96883

Re: Harbour and floats

PostPosted: Mon Jan 29, 2018 2:06 am
by dissonantdev
I just had enough time to check all those resources you guys linked, thank you very much!
It's exactly what I was looking for.

Thanks again for all the help!