Too many decimal places

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
tssunilkumar
Posts: 6
Joined: Wed Jun 22, 2016 3:21 am
Location: Heriot-Watt University

Too many decimal places

Post by tssunilkumar »

Dear Opensees Experts,

I am a beginner in Opensees. The below is the part of a script I started writing for analysing a SC-MRF.
When I did a trial run, I get too many decimal places in the values of Y8, Y9 and Y10 as follows.
Y8 - 1.2104000000000001 (actual value should be 1.2104)
Y9 - 1.2177000000000002 (actual value should be 1.2177)
Y10 - 1.2250000000000003 (actual value should be 1.225)
Why is this happening? What wrong did I do?

Can someone advise me? If required I can send the MatricUnits.tcl, Wsection.tcl file to you.

Sunilkumar


# --------------------------------------------------------------------------------------------------
# SC-MRF_ExternalJoint -- Build Model
# nonlinearBeamColumn element, inelastic fiber section -- Steel W-Section
# Sunilkumar T S
#

# SET UP ----------------------------------------------------------------------------
wipe; # clear memory of all past model definitions
model BasicBuilder -ndm 2 -ndf 3; # Define the model builder, ndm=#dimension, ndf=#dofs
set dataDir Data; # set up name of data directory (you can remove this)
file mkdir $dataDir; # create data directory
set GMdir "../GMfiles/"; # ground-motion file directory
source MatricUnits.tcl; # define units
source Wsection.tcl; # procedure to define fiber W section

# define GEOMETRY -------------------------------------------------------------
# define structure-geometry paramters
set LCol [expr 1000*$mm]; # column height
set LBeam [expr 2500*$mm]; # beam length
set DCol [expr 400*$mm]; # column depth
set DBeam [expr 450*$mm]; # beam depth
set LRplate [expr 1080*$mm]; # length of beam flange reinforcement
set DLoad [expr 2000*$mm]; # distance of actuator (loading)
set Btf [expr 14.6*$mm]; # dflange thickness of beam

# calculate locations of beam/column intersections:
set X0 0.;
set X1 [expr {$X0 + $DCol / 2.0}];
set X2 [expr {$X0 + $DCol}];
set X3 [expr {$X2 + $LRplate}];
set X4 [expr {$X1 + $DLoad}];
set X5 [expr {$X1 + $LBeam}];
set Y1 0.;
set Y2 [expr {$Y1 + $LCol - $DBeam / 2.0}];
set Y3 [expr {$Y2 + $Btf / 2.0}];
set Y4 [expr {$Y3 + $Btf / 2.0}];
set Y5 [expr {$Y2 + $DBeam / 6.0}];
set Y6 [expr {$Y1 + $LCol}];
set Y7 [expr {$Y6 + $DBeam / 3.0}];
set Y8 [expr {$Y6 + $DBeam / 2.0 - $Btf}];
set Y9 [expr {$Y8 + $Btf / 2.0}];
set Y10 [expr {$Y9 + $Btf / 2.0}];
set Y11 [expr {$Y6 + $LCol}];
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Too many decimal places

Post by fmk »

depending on your os . setPrecision $numDigits may work
tssunilkumar
Posts: 6
Joined: Wed Jun 22, 2016 3:21 am
Location: Heriot-Watt University

Re: Too many decimal places

Post by tssunilkumar »

Thank you
Post Reply