Jacques Gélinas on Wed, 20 May 2020 00:47:42 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Float Numbers with 200 digits
|
- To: "pari-users@pari.math.u-bordeaux.fr" <pari-users@pari.math.u-bordeaux.fr>
- Subject: Re: Float Numbers with 200 digits
- From: Jacques Gélinas <jacquesg00@hotmail.com>
- Date: Tue, 19 May 2020 22:47:36 +0000
- Accept-language: fr-CA, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zUP4HtqRIJkrJ76sVeN/KAQPZy2iVqOm/+KGq3997vg=; b=EcPaovlxMzcJvupfEtS9AhumBlHD3bu15Fk2a3jACuNTxXve1ZGaxlTzk7sa3yaknGPZZfR//dsYcpegbGoSIOMfpzDxBQcod3PqsTCO9GV9zJ/u/8GJEeUzgJDGH5Z0yWexow3rU+dPydCk/S0/DHBu0RlTE7IaOKb0671yi64uQR1uWa1UPq8xLfF0WsoEKicL4CRMX3VPF1/ch5aOLYas/xRqEikEjS3SVuX0q37d+uHOKcMG9OXXf5OgUL0FPMtF/4BbcBYuj/adp/XWMTtCXWmAjnNTStUpc0nJ3z0xuThoqoHkZV1R6mZAzeABpxmgAXp4lUc+5IZ5825NKA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bxq9sjXcMhyYgcdfyiM3QDlFc9ocn+J6e8msbHoy3jLrxg+bZsD4dDA3ECnWC0BkqN0TbUbMZzqJhimKPevEIcOyt82VyXRizRheY+f3LKjs5ELfjoUZfDt0PlBe2r8SxYKwIoEGFZzssld7Q2QufG0kx+P2M5uAX/1PioVm44XDZrBBm9qBmEIUS248MWqnmPT843qXVyF2m5unWqP39/1y8dho2qU6kyAkby61afNk/3I7qcqe3ScCzhnsGVZx2ovjhDHuFYbA5Ay8UiAUHxMigOWSqCCRo0sI+AKGRooY14X2aU4OjuDAKN0FqpEFu/Cjr8Q3Yb2M5OZRKwM93Q==
- Delivery-date: Wed, 20 May 2020 00:47:42 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zUP4HtqRIJkrJ76sVeN/KAQPZy2iVqOm/+KGq3997vg=; b=S6dIA+fUMCp5KZKswfAqVyNmiUCml7v26nZF0iXbdiSYDhFsChfrj4HFDeAmn4N7htUchHl3U3cjVLV8n0Xnkt5gqxXap8+jvPhUWyjlYqZ7US6iJuANow0eoME4rThYlN7tS4GhdFfVtKxEoJtkJ51zNfJNuDKseK/lUu66dbKmGHIXLT4o2UvHKqqUGGhE7CNkSv2c677ddmEVlmZaemH8dvnhyzEObmZzppuw3pHBKKJ5hnBmMBz2fBBQY2wRt0xoxqpf8G55cTK+ZUFW9SjKQpVLr1pQnHnpj+Z4nzD5Xxvs3c5obWT/hANcu5bxfWnbu6i0fAtKSJTGt76wFw==
- In-reply-to: <CAMLkfFShADutzNj+kC781dmZKmzJ92sDfZeK2r7XhN+k4D4usA@mail.gmail.com>
- References: <87D558DF-7ACA-4FBE-8B55-1BC69F6260E0@gmail.com>,<CAMLkfFShADutzNj+kC781dmZKmzJ92sDfZeK2r7XhN+k4D4usA@mail.gmail.com>
- Thread-index: AQHWLYKoeyCEis68C0eh+lNukfalI6iv5vKAgAAaYEc=
- Thread-topic: Float Numbers with 200 digits
> I need to know how to represent a float number in PARI
Here is the answer of professor GP2C from # gp2c-run tst.gp
========================= file tst.gp
x = 1e-100;
print("x = ",x);
=========================
========================= from file tst.gp.c
static GEN x;
/*End of global vars*/
void
init_tst(long prec) /* void */
{
x = pol_x(0);
x = strtor("1e-100", prec);
pari_printf("x = %Ps\n", x);
return;
}
================================
And this works!
================================
GP/PARI CALCULATOR Version 2.12.1
$ init_tst()
x = 1.0000 E-100
$
================================
Jacques Gélinas
De : Loïc Grenié <loic.grenie@gmail.com>
Envoyé : 19 mai 2020 17:03
À : Tiago Mendes <tiagovazmendes7@gmail.com>
Cc : pari-users <pari-users@pari.math.u-bordeaux.fr>
Objet : Re: Float Numbers with 200 digits
Hi,
On Tue 19 may 2020 at 04:10, Tiago Mendes wrote:
Hi guys,
I need to know how to represent a float number in PARI. To use integre i usually do :
GEN expoent = strtoi("1123213137")
To represent a number like 10^{-200} how should i do ?
Depending on what you precisely need, real_1 might be your friend:
\fun{GEN}{real_1}{long prec} create a \typ{REAL} equal to $1$ to \kbd{prec}
words of accuracy.
This creates a 1 with arbitrary precision. You can use it with
gdiv(real_1(200),powuu(10,300)) (this creates 10^{-300} with 200 digits
precision).
Hope this helps,
Loïc