🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sunyab.tutorial
Article #3

Truncating a double float

#3
From: steven j hinkle
Date: Sun, 17 Feb 1991 20:14
18 lines
1091 bytes
   I would like to know if there is a good, "clean" way to truncate
a double float in C to a certain (given) accuracy point. 

   Example : I want to truncate a double to the tenth decimal point.

Anyone got a good idea how I can do this so that my code is portable?

Any help would be appreciated.

Steven Hinkle


-- 
|  Steven Hinkle   "The Quaker"       |  Always look on the bright side.|
|  University of Buffalo              |  If there isn't one, check the  |
|  INTERNET : hinkle@acsu.buffalo.edu |  light bulb, it is probably     |
|  BITNET   : hinkle@sunybcs          |  burned out.                    |
Technical Details
Message-ID: <60278@eerie.acsu.Buffalo.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ub!acsu.buffalo.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ub!acsu.buffalo.edu
From: hinkle@acsu.buffalo.edu (steven j hinkle)
Newsgroups: sunyab.tutorial,comp.lang.c,comp.lang.c++
Subject: Truncating a double float
Message-ID: <60278@eerie.acsu.Buffalo.EDU>
Date: 17 Feb 91 20:14:53 GMT
Sender: news@acsu.Buffalo.EDU
Followup-To: sunyab.tutorial
Distribution: usa
Organization: SUNY Buffalo
Lines: 18
Nntp-Posting-Host: autarch.acsu.buffalo.edu