bc.library (256281) | bc.library (265533) |
---|---|
1/* $FreeBSD: stable/10/usr.bin/bc/bc.library 233121 2012-03-18 15:34:39Z kevlo $ */ 2/* $OpenBSD: bc.library,v 1.3 2007/02/03 21:15:06 otto Exp $ */ | 1/* $FreeBSD: stable/10/usr.bin/bc/bc.library 265533 2014-05-07 08:06:54Z delphij $ */ 2/* $OpenBSD: bc.library,v 1.4 2012/03/14 07:35:53 otto Exp $ */ |
3 4/* 5 * Copyright (C) Caldera International Inc. 2001-2002. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 84 unchanged lines hidden (view full) --- 95 return (a) 96 } 97 t = scale 98 99 f = 1 100 if (x < 1) { 101 s = scale(x) 102 } else { | 3 4/* 5 * Copyright (C) Caldera International Inc. 2001-2002. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 84 unchanged lines hidden (view full) --- 95 return (a) 96 } 97 t = scale 98 99 f = 1 100 if (x < 1) { 101 s = scale(x) 102 } else { |
103 s = length(x) - scale(x) | 103 s = length(x)-scale(x) |
104 } 105 scale = 0 106 a = (2.31*s)/1 /* estimated integer part of the answer */ 107 s = t + length(a) + 2 /* estimated length of the answer */ 108 while (x > 2) { | 104 } 105 scale = 0 106 a = (2.31*s)/1 /* estimated integer part of the answer */ 107 s = t + length(a) + 2 /* estimated length of the answer */ 108 while (x > 2) { |
109 scale=0 | 109 scale = 0 |
110 scale = (length(x) + scale(x))/2 + 1 111 if (scale < s) scale = s 112 x = sqrt(x) 113 f = f*2 114 } 115 while (x < .5) { 116 scale = 0 117 scale = scale(x)/2 + 1 --- 157 unchanged lines hidden --- | 110 scale = (length(x) + scale(x))/2 + 1 111 if (scale < s) scale = s 112 x = sqrt(x) 113 f = f*2 114 } 115 while (x < .5) { 116 scale = 0 117 scale = scale(x)/2 + 1 --- 157 unchanged lines hidden --- |