2024.05.19
0.0に近い値
はじめに
1.0 / x
求める方法
Javaソースコード
Division0.java
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030
public class Division0 { // 割り算メソッド public static double division( double a, double b ) { // aをbで割る return a / b; } // mainメソッド public static void main( String[] args ) { double a, b; // aに1.0を代入 a = 1.0; // bに1.0E-10を代入 b = 1.0E-10; // aをbで割っていく // ループの中でbで10.0で割っていく for ( int i = 1; i <= 500; i ++ ) { // aをbで割った結果を表示 System.out.println( a + "/" + b + "=" + division( a, b ) ); // bを10で割る b /= 10.0; } } }
コンパイル ソースコードが「ANSI」の場合
C:\talavax\javasample>javac -encoding sjis Division0.java
コンパイル ソースコードが「UTF-8」の場合
C:\talavax\javasample>javac Division0.java
実行
C:\talavax\javasample>java Division0
出力結果
1.0/1.0E-10=1.0E10 1.0/1.0000000000000001E-11=9.999999999999998E10 1.0/1.0000000000000002E-12=9.999999999999999E11 1.0/1.0000000000000002E-13=9.999999999999998E12 1.0/1.0000000000000002E-14=9.999999999999998E13 1.0/1.0E-15=9.999999999999999E14 1.0/1.0000000000000001E-16=9.999999999999998E15 1.0/1.0E-17=1.0E17 1.0/1.0E-18=9.9999999999999987E17 1.0/1.0000000000000001E-19=1.0E19 1.0/1.0000000000000001E-20=9.999999999999998E19 1.0/1.0000000000000001E-21=9.999999999999999E20 1.0/1.0E-22=1.0E22 1.0/1.0000000000000001E-23=9.999999999999999E22 1.0/1.0000000000000001E-24=9.999999999999998E23 1.0/1.0000000000000002E-25=9.999999999999999E24 1.0/1.0000000000000002E-26=9.999999999999999E25 1.0/1.0000000000000002E-27=9.999999999999997E26 1.0/1.0000000000000002E-28=9.999999999999997E27 1.0/1.0000000000000002E-29=9.999999999999997E28 1.0/1.0000000000000003E-30=9.999999999999997E29 1.0/1.0000000000000003E-31=9.999999999999997E30 1.0/1.0000000000000003E-32=9.999999999999997E31 1.0/1.0000000000000004E-33=9.999999999999997E32 1.0/1.0000000000000004E-34=9.999999999999996E33 1.0/1.0000000000000004E-35=9.999999999999996E34 1.0/1.0000000000000004E-36=9.999999999999996E35 1.0/1.0000000000000005E-37=9.999999999999995E36 1.0/1.0000000000000005E-38=9.999999999999996E37 1.0/1.0000000000000004E-39=9.999999999999996E38 1.0/1.0000000000000003E-40=9.999999999999997E39 1.0/1.0000000000000004E-41=9.999999999999996E40 1.0/1.0000000000000004E-42=9.999999999999996E41 1.0/1.0000000000000003E-43=9.999999999999998E42 1.0/1.0000000000000003E-44=9.999999999999997E43 1.0/1.0000000000000003E-45=9.999999999999998E44 1.0/1.0000000000000002E-46=9.999999999999997E45 1.0/1.0000000000000002E-47=9.999999999999998E46 1.0/1.0000000000000003E-48=9.999999999999997E47 1.0/1.0000000000000003E-49=9.999999999999997E48 1.0/1.0000000000000004E-50=9.999999999999997E49 1.0/1.0000000000000003E-51=9.999999999999997E50 1.0/1.0000000000000004E-52=9.999999999999996E51 1.0/1.0000000000000004E-53=9.999999999999996E52 1.0/1.0000000000000003E-54=9.999999999999997E53 1.0/1.0000000000000004E-55=9.999999999999996E54 1.0/1.0000000000000004E-56=9.999999999999997E55 1.0/1.0000000000000004E-57=9.999999999999997E56 1.0/1.0000000000000004E-58=9.999999999999997E57 1.0/1.0000000000000005E-59=9.999999999999995E58 1.0/1.0000000000000005E-60=9.999999999999994E59 1.0/1.0000000000000006E-61=9.999999999999994E60 1.0/1.0000000000000005E-62=9.999999999999996E61 1.0/1.0000000000000005E-63=9.999999999999995E62 1.0/1.0000000000000005E-64=9.999999999999996E63 1.0/1.0000000000000006E-65=9.999999999999994E64 1.0/1.0000000000000005E-66=9.999999999999996E65 1.0/1.0000000000000004E-67=9.999999999999995E66 1.0/1.0000000000000005E-68=9.999999999999995E67 1.0/1.0000000000000005E-69=9.999999999999995E68 1.0/1.0000000000000005E-70=9.999999999999995E69 1.0/1.0000000000000005E-71=9.999999999999994E70 1.0/1.0000000000000005E-72=9.999999999999996E71 1.0/1.0000000000000005E-73=9.999999999999995E72 1.0/1.0000000000000005E-74=9.999999999999994E73 1.0/1.0000000000000006E-75=9.999999999999995E74 1.0/1.0000000000000005E-76=9.999999999999994E75 1.0/1.0000000000000005E-77=9.999999999999995E76 1.0/1.0000000000000005E-78=9.999999999999996E77 1.0/1.0000000000000004E-79=9.999999999999995E78 1.0/1.0000000000000005E-80=9.999999999999995E79 1.0/1.0000000000000005E-81=9.999999999999995E80 1.0/1.0000000000000005E-82=9.999999999999995E81 1.0/1.0000000000000006E-83=9.999999999999994E82 1.0/1.0000000000000006E-84=9.999999999999994E83 1.0/1.0000000000000005E-85=9.999999999999995E84 1.0/1.0000000000000006E-86=9.999999999999993E85 1.0/1.0000000000000006E-87=9.999999999999995E86 1.0/1.0000000000000006E-88=9.999999999999994E87 1.0/1.0000000000000006E-89=9.999999999999994E88 1.0/1.0000000000000006E-90=9.999999999999994E89 1.0/1.0000000000000007E-91=9.999999999999994E90 1.0/1.0000000000000007E-92=9.999999999999993E91 1.0/1.0000000000000008E-93=9.999999999999992E92 1.0/1.0000000000000008E-94=9.999999999999993E93 1.0/1.0000000000000008E-95=9.999999999999991E94 1.0/1.0000000000000007E-96=9.999999999999992E95 1.0/1.0000000000000007E-97=9.999999999999993E96 1.0/1.0000000000000008E-98=9.999999999999992E97 1.0/1.0000000000000008E-99=9.999999999999991E98 1.0/1.0000000000000008E-100=9.999999999999992E99 1.0/1.0000000000000008E-101=9.999999999999992E100 1.0/1.000000000000001E-102=9.999999999999991E101 1.0/1.000000000000001E-103=9.99999999999999E102 1.0/1.000000000000001E-104=9.99999999999999E103 1.0/1.000000000000001E-105=9.99999999999999E104 1.0/1.0000000000000009E-106=9.99999999999999E105 1.0/1.0000000000000009E-107=9.999999999999992E106 1.0/1.000000000000001E-108=9.99999999999999E107 1.0/1.0000000000000009E-109=9.999999999999991E108 1.0/1.000000000000001E-110=9.99999999999999E109 1.0/1.000000000000001E-111=9.99999999999999E110 1.0/1.000000000000001E-112=9.99999999999999E111 1.0/1.000000000000001E-113=9.99999999999999E112 1.0/1.000000000000001E-114=9.99999999999999E113 1.0/1.000000000000001E-115=9.999999999999991E114 1.0/1.000000000000001E-116=9.99999999999999E115 1.0/1.0000000000000009E-117=9.999999999999991E116 1.0/1.0000000000000009E-118=9.999999999999992E117 1.0/1.0000000000000008E-119=9.999999999999992E118 1.0/1.0000000000000008E-120=9.999999999999991E119 1.0/1.0000000000000008E-121=9.999999999999991E120 1.0/1.0000000000000009E-122=9.999999999999991E121 1.0/1.0000000000000009E-123=9.999999999999991E122 1.0/1.000000000000001E-124=9.99999999999999E123 1.0/1.0000000000000009E-125=9.99999999999999E124 1.0/1.000000000000001E-126=9.99999999999999E125 1.0/1.0000000000000008E-127=9.999999999999991E126 1.0/1.0000000000000008E-128=9.999999999999991E127 1.0/1.0000000000000009E-129=9.99999999999999E128 1.0/1.0000000000000009E-130=9.999999999999991E129 1.0/1.0000000000000009E-131=9.999999999999991E130 1.0/1.000000000000001E-132=9.99999999999999E131 1.0/1.0000000000000008E-133=9.999999999999991E132 1.0/1.0000000000000009E-134=9.999999999999991E133 1.0/1.000000000000001E-135=9.99999999999999E134 1.0/1.000000000000001E-136=9.99999999999999E135 1.0/1.0000000000000009E-137=9.99999999999999E136 1.0/1.000000000000001E-138=9.99999999999999E137 1.0/1.000000000000001E-139=9.99999999999999E138 1.0/1.0000000000000009E-140=9.99999999999999E139 1.0/1.0000000000000009E-141=9.99999999999999E140 1.0/1.000000000000001E-142=9.999999999999991E141 1.0/1.000000000000001E-143=9.99999999999999E142 1.0/1.000000000000001E-144=9.99999999999999E143 1.0/1.000000000000001E-145=9.99999999999999E144 1.0/1.000000000000001E-146=9.99999999999999E145 1.0/1.0000000000000011E-147=9.99999999999999E146 1.0/1.0000000000000012E-148=9.999999999999989E147 1.0/1.000000000000001E-149=9.999999999999989E148 1.0/1.0000000000000011E-150=9.999999999999989E149 1.0/1.0000000000000011E-151=9.999999999999989E150 1.0/1.0000000000000011E-152=9.999999999999989E151 1.0/1.0000000000000011E-153=9.999999999999989E152 1.0/1.0000000000000011E-154=9.999999999999988E153 1.0/1.000000000000001E-155=9.999999999999989E154 1.0/1.0000000000000011E-156=9.999999999999988E155 1.0/1.000000000000001E-157=9.999999999999989E156 1.0/1.000000000000001E-158=9.99999999999999E157 1.0/1.0000000000000011E-159=9.99999999999999E158 1.0/1.0000000000000011E-160=9.999999999999989E159 1.0/1.000000000000001E-161=9.99999999999999E160 1.0/1.0000000000000011E-162=9.99999999999999E161 1.0/1.000000000000001E-163=9.99999999999999E162 1.0/1.000000000000001E-164=9.999999999999991E163 1.0/1.000000000000001E-165=9.99999999999999E164 1.0/1.000000000000001E-166=9.999999999999991E165 1.0/1.000000000000001E-167=9.99999999999999E166 1.0/1.000000000000001E-168=9.99999999999999E167 1.0/1.000000000000001E-169=9.99999999999999E168 1.0/1.000000000000001E-170=9.99999999999999E169 1.0/1.0000000000000011E-171=9.999999999999989E170 1.0/1.0000000000000012E-172=9.999999999999989E171 1.0/1.0000000000000011E-173=9.999999999999989E172 1.0/1.0000000000000011E-174=9.99999999999999E173 1.0/1.0000000000000011E-175=9.999999999999989E174 1.0/1.000000000000001E-176=9.999999999999989E175 1.0/1.000000000000001E-177=9.99999999999999E176 1.0/1.000000000000001E-178=9.99999999999999E177 1.0/1.000000000000001E-179=9.99999999999999E178 1.0/1.000000000000001E-180=9.999999999999989E179 1.0/1.0000000000000011E-181=9.999999999999988E180 1.0/1.000000000000001E-182=9.999999999999989E181 1.0/1.000000000000001E-183=9.99999999999999E182 1.0/1.0000000000000011E-184=9.999999999999989E183 1.0/1.0000000000000011E-185=9.999999999999989E184 1.0/1.0000000000000011E-186=9.999999999999989E185 1.0/1.0000000000000012E-187=9.999999999999987E186 1.0/1.0000000000000012E-188=9.999999999999988E187 1.0/1.0000000000000013E-189=9.999999999999988E188 1.0/1.0000000000000013E-190=9.999999999999987E189 1.0/1.0000000000000013E-191=9.999999999999988E190 1.0/1.0000000000000013E-192=9.999999999999988E191 1.0/1.0000000000000013E-193=9.999999999999986E192 1.0/1.0000000000000012E-194=9.999999999999988E193 1.0/1.0000000000000012E-195=9.999999999999988E194 1.0/1.0000000000000012E-196=9.999999999999987E195 1.0/1.0000000000000012E-197=9.999999999999988E196 1.0/1.0000000000000012E-198=9.999999999999988E197 1.0/1.0000000000000013E-199=9.999999999999988E198 1.0/1.0000000000000013E-200=9.999999999999988E199 1.0/1.0000000000000012E-201=9.999999999999988E200 1.0/1.0000000000000012E-202=9.999999999999988E201 1.0/1.0000000000000012E-203=9.999999999999988E202 1.0/1.0000000000000012E-204=9.999999999999987E203 1.0/1.0000000000000013E-205=9.999999999999987E204 1.0/1.0000000000000013E-206=9.999999999999988E205 1.0/1.0000000000000013E-207=9.999999999999988E206 1.0/1.0000000000000014E-208=9.999999999999986E207 1.0/1.0000000000000014E-209=9.999999999999986E208 1.0/1.0000000000000014E-210=9.999999999999986E209 1.0/1.0000000000000014E-211=9.999999999999987E210 1.0/1.0000000000000014E-212=9.999999999999986E211 1.0/1.0000000000000014E-213=9.999999999999985E212 1.0/1.0000000000000014E-214=9.999999999999986E213 1.0/1.0000000000000013E-215=9.999999999999988E214 1.0/1.0000000000000013E-216=9.999999999999986E215 1.0/1.0000000000000013E-217=9.999999999999987E216 1.0/1.0000000000000013E-218=9.999999999999987E217 1.0/1.0000000000000013E-219=9.999999999999987E218 1.0/1.0000000000000014E-220=9.999999999999986E219 1.0/1.0000000000000014E-221=9.999999999999986E220 1.0/1.0000000000000014E-222=9.999999999999986E221 1.0/1.0000000000000015E-223=9.999999999999985E222 1.0/1.0000000000000015E-224=9.999999999999985E223 1.0/1.0000000000000015E-225=9.999999999999986E224 1.0/1.0000000000000014E-226=9.999999999999985E225 1.0/1.0000000000000015E-227=9.999999999999986E226 1.0/1.0000000000000015E-228=9.999999999999986E227 1.0/1.0000000000000015E-229=9.999999999999985E228 1.0/1.0000000000000015E-230=9.999999999999984E229 1.0/1.0000000000000016E-231=9.999999999999985E230 1.0/1.0000000000000016E-232=9.999999999999984E231 1.0/1.0000000000000016E-233=9.999999999999984E232 1.0/1.0000000000000016E-234=9.999999999999984E233 1.0/1.0000000000000017E-235=9.999999999999984E234 1.0/1.0000000000000018E-236=9.999999999999982E235 1.0/1.0000000000000018E-237=9.999999999999983E236 1.0/1.0000000000000017E-238=9.999999999999983E237 1.0/1.0000000000000018E-239=9.999999999999983E238 1.0/1.0000000000000018E-240=9.999999999999982E239 1.0/1.0000000000000018E-241=9.999999999999981E240 1.0/1.0000000000000018E-242=9.999999999999982E241 1.0/1.0000000000000018E-243=9.999999999999982E242 1.0/1.0000000000000019E-244=9.999999999999981E243 1.0/1.000000000000002E-245=9.99999999999998E244 1.0/1.000000000000002E-246=9.99999999999998E245 1.0/1.000000000000002E-247=9.999999999999981E246 1.0/1.000000000000002E-248=9.99999999999998E247 1.0/1.0000000000000019E-249=9.999999999999981E248 1.0/1.0000000000000019E-250=9.99999999999998E249 1.0/1.000000000000002E-251=9.99999999999998E250 1.0/1.000000000000002E-252=9.99999999999998E251 1.0/1.000000000000002E-253=9.99999999999998E252 1.0/1.000000000000002E-254=9.99999999999998E253 1.0/1.000000000000002E-255=9.99999999999998E254 1.0/1.000000000000002E-256=9.99999999999998E255 1.0/1.000000000000002E-257=9.99999999999998E256 1.0/1.000000000000002E-258=9.99999999999998E257 1.0/1.0000000000000021E-259=9.999999999999979E258 1.0/1.0000000000000021E-260=9.999999999999979E259 1.0/1.0000000000000021E-261=9.99999999999998E260 1.0/1.0000000000000021E-262=9.99999999999998E261 1.0/1.0000000000000021E-263=9.999999999999979E262 1.0/1.0000000000000022E-264=9.999999999999978E263 1.0/1.0000000000000022E-265=9.999999999999977E264 1.0/1.0000000000000022E-266=9.999999999999977E265 1.0/1.0000000000000021E-267=9.999999999999979E266 1.0/1.0000000000000021E-268=9.99999999999998E267 1.0/1.0000000000000021E-269=9.999999999999978E268 1.0/1.0000000000000021E-270=9.999999999999978E269 1.0/1.0000000000000022E-271=9.999999999999979E270 1.0/1.0000000000000022E-272=9.999999999999978E271 1.0/1.0000000000000021E-273=9.999999999999979E272 1.0/1.0000000000000021E-274=9.999999999999978E273 1.0/1.0000000000000022E-275=9.999999999999978E274 1.0/1.000000000000002E-276=9.99999999999998E275 1.0/1.0000000000000021E-277=9.999999999999978E276 1.0/1.0000000000000021E-278=9.999999999999979E277 1.0/1.0000000000000022E-279=9.999999999999978E278 1.0/1.0000000000000022E-280=9.999999999999978E279 1.0/1.0000000000000022E-281=9.999999999999978E280 1.0/1.0000000000000021E-282=9.999999999999978E281 1.0/1.0000000000000021E-283=9.999999999999979E282 1.0/1.0000000000000021E-284=9.99999999999998E283 1.0/1.0000000000000021E-285=9.999999999999979E284 1.0/1.0000000000000022E-286=9.99999999999998E285 1.0/1.0000000000000022E-287=9.999999999999977E286 1.0/1.0000000000000022E-288=9.999999999999977E287 1.0/1.0000000000000023E-289=9.999999999999977E288 1.0/1.0000000000000023E-290=9.999999999999976E289 1.0/1.0000000000000023E-291=9.999999999999977E290 1.0/1.0000000000000023E-292=9.999999999999978E291 1.0/1.0000000000000023E-293=9.999999999999978E292 1.0/1.0000000000000023E-294=9.999999999999977E293 1.0/1.0000000000000022E-295=9.999999999999977E294 1.0/1.0000000000000022E-296=9.999999999999978E295 1.0/1.0000000000000022E-297=9.999999999999977E296 1.0/1.0000000000000022E-298=9.999999999999978E297 1.0/1.0000000000000022E-299=9.999999999999978E298 1.0/1.0000000000000022E-300=9.999999999999978E299 1.0/1.0000000000000021E-301=9.999999999999979E300 1.0/1.0000000000000022E-302=9.999999999999978E301 1.0/1.0000000000000022E-303=9.999999999999979E302 1.0/1.0000000000000022E-304=9.999999999999977E303 1.0/1.0000000000000021E-305=9.999999999999978E304 1.0/1.0000000000000021E-306=9.99999999999998E305 1.0/1.000000000000002E-307=9.999999999999979E306 1.0/1.000000000000002E-308=9.99999999999998E307 1.0/1.0E-309=Infinity 1.0/1.0E-310=Infinity 1.0/1.0E-311=Infinity 1.0/1.0E-312=Infinity 1.0/1.0E-313=Infinity 1.0/1.0E-314=Infinity 1.0/1.0E-315=Infinity 1.0/1.0E-316=Infinity 1.0/9.999997E-318=Infinity 1.0/1.0E-318=Infinity 1.0/1.0E-319=Infinity 1.0/1.0E-320=Infinity 1.0/1.0E-321=Infinity 1.0/1.0E-322=Infinity 1.0/1.0E-323=Infinity 1.0/0.0=Infinity 1.0/0.0=Infinity 1.0/0.0=Infinity :
Javaソースコードの解説
ここからは、このソースコードを上から順番に解説していきます。
001
public class Division0 {
クラス名を、Division0としています。
010 011
// mainメソッド public static void main( String[] args ) {
このmainメソッドからプログラムを実行します。
012
double a, b;
014 015
// aに1.0を代入
a = 1.0;
変数aに1.0を代入しています。
017 018
// bに1.0E-10を代入
b = 1.0E-10;
変数bに1.0E-10(10の-10乗)を代入しています。
020 021 022
// aをbで割っていく // ループの中でbで10.0で割っていく for ( int i = 1; i <= 500; i ++ ) {
023 024
// aをbで割った結果を表示 System.out.println( a + "/" + b + "=" + division( a, b ) );
026 027
// bを10で割る
b /= 10.0;
bを10.0で割っていきます。
以上です。