github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/CAT.go (about) 1 //This file is part of EESLISM. 2 // 3 //Foobar is free software : you can redistribute itand /or modify 4 //it under the terms of the GNU General Public License as published by 5 //the Free Software Foundation, either version 3 of the License, or 6 //(at your option) any later version. 7 // 8 //Foobar is distributed in the hope that it will be useful, 9 //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 11 //GNU General Public License for more details. 12 // 13 //You should have received a copy of the GNU General Public License 14 //along with Foobar.If not, see < https://www.gnu.org/licenses/>. 15 16 /* 17 18 小数点の切捨て 19 FILE=CAT.c 20 Create Date=1999.6.7 21 */ 22 23 package eeslism 24 25 import "math" 26 27 func CAT(a, b, c *float64) { 28 *a = math.Floor((*a)*10000.0 + 0.5) 29 *b = math.Floor((*b)*10000.0 + 0.5) 30 *c = math.Floor((*c)*10000.0 + 0.5) 31 32 *a = (*a) / 10000.0 33 *b = (*b) / 10000.0 34 *c = (*c) / 10000.0 35 36 if math.Signbit(*a) { 37 *a = 0.0 38 } 39 if math.Signbit(*b) { 40 *b = 0.0 41 } 42 if math.Signbit(*c) { 43 *c = 0.0 44 } 45 }