Harbour and floats

Post Reply
dissonantdev
Posts: 2
Joined: Thu Jan 25, 2018 8:06 pm

Harbour and floats

Post 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!
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Harbour and floats

Post 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/
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Harbour and floats

Post 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
http://forums.fivetechsupport.com/viewt ... 88#p103823
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Harbour and floats

Post by Antonio Linares »

1)
https://groups.google.com/forum/#!searc ... Csort:date
https://groups.google.com/forum/#!searc ... Csort:date

In hbapi.h:
#define HB_IT_DOUBLE 0x00010

Code: Select all

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:
http://forums.fivetechsupport.com/viewt ... 612#p63612
http://forums.fivetechsupport.com/viewt ... 183#p66183
http://forums.fivetechsupport.com/viewt ... 883#p96883
regards, saludos

Antonio Linares
www.fivetechsoft.com
dissonantdev
Posts: 2
Joined: Thu Jan 25, 2018 8:06 pm

Re: Harbour and floats

Post 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!
Post Reply