Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with bigfloat

43 views
Skip to first unread message

Thomas

unread,
May 17, 2013, 3:02:45 AM5/17/13
to
Hello!

I have a problem with bigfloat.
Anyone knows what i'm doing wrong?
Here's a snippet that shows the error

/// snippet

package require math::bigfloat

set content {8373;0;
8374;-6.9573623405856546;
8375;-6.9573623405856546;
8376;-6.9573263708472934;
8377;-6.9567882448929481;
8378;-6.9546613358259481;
8379;-6.9495681442009261;
8380;-6.9401076839889493;
8381;-6.9250138062697619;}

foreach line $content {
set number [math::bigfloat::fromstr [lindex [split $line ";"] 1] 20]
puts [math::bigfloat::tostr -nosci [math::bigfloat::mul $number $number]]
}

/// error message

second argument not allowed with an integer
while executing
"error "second argument not allowed with an integer""
(procedure "math::bigfloat::fromstr" line 19)
invoked from within
"math::bigfloat::fromstr [lindex [split $line ";"] 1] 20"
("foreach" body line 2)
invoked from within
"foreach line $content {
set number [math::bigfloat::fromstr [lindex [split $line ";"] 1] 20]
puts [math::bigfloat::tostr -nosci [math::bigfloat:..."

pal...@yahoo.com

unread,
May 17, 2013, 6:29:47 AM5/17/13
to
Exactly what the error says - you cannot specify the second arg (20) if the first arg is an integer

(wits) 52 % math::bigfloat::fromstr 0 10
second argument not allowed with an integer
(wits) 53 % math::bigfloat::fromstr 0.0 10
F 0 -51 32768

/Ashok

Alexandre Ferrieux

unread,
May 17, 2013, 4:38:17 PM5/17/13
to
On May 17, 12:29 pm, palm...@yahoo.com wrote:
> Exactly what the error says - you cannot specify the second arg (20) if the first arg is an integer

Sure... but why ? A bigfloat being an interval [x-d,x+d], what's wrong
with x being integer dans d being 1e-10 ?

-Alex

Arjen Markus

unread,
May 18, 2013, 5:28:57 AM5/18/13
to
Op vrijdag 17 mei 2013 22:38:17 UTC+2 schreef Alexandre Ferrieux het volgende:

> Sure... but why ? A bigfloat being an interval [x-d,x+d], what's wrong
> with x being integer dans d being 1e-10 ?
>
> -Alex

The short answer is: because.
The behaviour is actually documented.

The longer answer: it is a limitation in the current implementation, but
that could be changed. Could the OP register a change request in the Tcllib
project?

Regards,

Arjen
0 new messages