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: 2668
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: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

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
viewtopic.php?f=3&t=19688#p103823
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Antonio Linares
Site Admin
Posts: 42511
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Re: Harbour and floats

Post 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

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
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