ex01.dvi

Similar documents
ex01.dvi

K227 Java 2

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

r1.dvi

1.ppt

Microsoft Word - keisankigairon.ch doc

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

新・明解Java入門

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

XMPによる並列化実装2

WinHPC ppt

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の break; までを処理し どれにも一致しない場合 default; から直後の break; までを処理する 但し 式や値 1

Microsoft Word - C.....u.K...doc

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文


Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

明解Java入門編

r02.dvi

ohp02.dvi

新版明解C言語 実践編

明解Javaによるアルゴリズムとデータ構造

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

C ( ) C ( ) C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C mandata mandata ( ) name age income mandata ( ) mandat

break 文 switch ブロック内の実行中の処理を強制的に終了し ブロックから抜けます switch(i) 強制終了 ソースコード例ソースファイル名 :Sample7_1.java // 入力値の判定 import java.io.*; class Sample7_1 public stati

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

tuat1.dvi

yacc.dvi

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

Java プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲

新・明解Java入門

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

ex12.dvi

num2.dvi

プログラムの基本構成

JavaプログラミングⅠ

C言語によるアルゴリズムとデータ構造

11042 計算機言語7回目 サポートページ:

IE6 2 BMI chapter1 Java 6 chapter2 Java 7 chapter3 for if 8 chapter4 : BMI 9 chapter5 Java GUI 10 chapter6 11 chapter7 BMI 12 chap

joho07-1.ppt

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裱£²²ó ¡Ý½ÉÂꣲ¤Î²òÀ⡤±é½¬£²¡Ý

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

r07.dvi

¥Ñ¥Ã¥±¡¼¥¸ Rhpc ¤Î¾õ¶·

ohp07.dvi

: : : TSTank 2

Java演習(2) -- 簡単なプログラム --

Javaセキュアコーディングセミナー東京 第3回 入出力(File, Stream)と例外時の動作 演習解説

‚æ4›ñ

Java演習(4) -- 変数と型 --

解きながら学ぶJava入門編

8 / 0 1 i++ i 1 i-- i C !!! C 2

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow

I java A

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

Java updated

2

slide5.pptx

2008 IIA (program) pro(before)+gram(write) (artificial language) (programming languege) (programming) (machine language) (assembly language) ( )


JavaプログラミングⅠ

OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a))

第1回 プログラミング演習3 センサーアプリケーション

新・明解Javaで学ぶアルゴリズムとデータ構造

I HTML HashMap (i) (ii) :.java import java.net.*; import java.io.*; import java.util.hashmap; public class SimpleStopWatch { public static voi

comment.dvi

< 中略 > 24 0 NNE 次に 指定した日時の時間降水量と気温を 観測地点の一覧表に載っているすべての地点について出力するプログラムを作成してみます 観測地点の一覧表は index.txt というファイルで与えられています このファイルを読みこむためのサブルーチンが AMD

:30 12:00 I. I VI II. III. IV. a d V. VI

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player jp/download/player/ URL VMware Plaeyr VMware


Microsoft PowerPoint ppt

< 中略 > 24 0 NNE 次に 指定した日時の時間降水量と気温を 観測地点の一覧表に載っているすべての地点について出力するプログラムを作成してみます 観測地点の一覧表は index.txt というファイルで与えられています このファイルを読みこむためのサブルーチンが AMD

JavaプログラミングⅠ

main

とても使いやすい Boost の serialization

デジタル表現論・第6回

Informatics 2015

橡Pro PDF

Prog2_9th

卒 業 研 究 報 告.PDF

Informatics 2014

(Version: 2017/4/18) Intel CPU 1 Intel CPU( AMD CPU) 64bit SIMD Inline Assemler Windows Visual C++ Linux gcc 2 FPU SSE2 Intel CPU do

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

プログラミングA

PowerPoint プレゼンテーション

ex14.dvi

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

C

DKA ( 1) 1 n i=1 α i c n 1 = 0 ( 1) 2 n i 1 <i 2 α i1 α i2 c n 2 = 0 ( 1) 3 n i 1 <i 2 <i 3 α i1 α i2 α i3 c n 3 = 0. ( 1) n 1 n i 1 <i 2 < <i

JAVA 11.4 PrintWriter 11.5

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3

超初心者用

Condition DAQ condition condition 2 3 XML key value

オブジェクト指向プログラミング・同演習 5月21日演習課題

8 if switch for while do while 2

Transcription:

,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include <stdio.h> int main(int argc, char **argv) double x = 0., y = 0.0 ; int n ; for(n=0;n<0;n++) y += x ; printf("y = %f\n", y) ; if (y ==.0) printf ("y equals to.0\n") ; else printf ("\n") ; printf("y = %.6f\n", y) ; return 0 ; gcc ex_0_0.c -o ex_0_0./ex_0_0 y =.000000 y = 0.9999999999999999 double. float. 0.,.0E- double, float 0. 0.F,.0E-F.

2 C (2) /******************************* * $Id: ex_0_0_.c,v.3 2006-04-0 3:37:07+09 naito Exp $ * * 0. 0.0 *******************************/ #include <stdio.h> int main(int argc, char **argv) float x = 0.F, y = 0.0F ; int n ; for(n=0;n<0;n++) y += x ; printf("y = %f\n", y) ; if (y ==.0F) printf ("y equals to.0\n") ; else printf ("\n") ; printf("y = %.8f\n", y) ; return 0 ; y =.000000 y =.0000002 0. 0.0. 0. 0.0.

3 Java // // $Id: ex_0_0.java,v.2 2006-04-05 6:38:59+09 naito Exp $ // import java.io.* ; /** * 0. 0.0 * @author Hisashi Naito */ public class ex_0_0 public static void main (String args[]) throws IOException double x = 0., y = 0.0 ; int n ; for(n=0;n<0;n++) y += x ; System.out.println("y = " + y) ; if (y ==.0) System.out.println("y equals to.0") ; else System.out.println("") ; javac ex_0_0.java java ex_0_0 y = 0.9999999999999999 double. float. 0.,.0E- double, float 0. 0.F,.0E-F. y =.000000

4 Fortran C $Id: ex_0_0.f,v. 2006-04-0 2:7:9+09 naito Exp $ C 0. 0.0 PROGRAM EX_0_0 REAL X, Y INTEGER N X = 0. ; Y = 0.0 ; DO N=,0, Y = Y + X ENDO WRITE(*,60) Y =, Y IF (Y.EQ..0) THEN PRINT *, Y EQUALS TO.0 ELSE PRINT *, Y DOES NOT EQUALS TO.0 ENDIF 60 FORMAT(A,F0.8) STOP END g77 ex_0_0.f./ex_0_0 y =.0000002 real. double precision. 0.,.0E- real, double precision 0. 0.D0,.0D-. y = 0.9999999999999999

5 OCaml (* ex_0_0.ml *) (* $Id: ex_0_0.ml,v.3 2006-04-05 8:57:54+09 naito Exp $ *) (* 0. 0.0 *) let ex_0_0 () = let x = 0. and y = ref 0.0 in for n = to 0 do y := x +.!y done ; Printf.printf "%f\n"!y ; if (!y ==.0) then Printf.printf "y equals to.0\n" else Printf.printf "\n"; Printf.printf "%.6f\n"!y ; ;; ex_0_0() ;; ocamlc ex_0_0.ml ocamlc ex_0_0.cmo -o./ex_0_0./ex_0_0.000000 0.9999999999999999 OCaml float. OCaml.

6 0. 0.0.,,.. 0. 0.0, 0. 0.0.

7 lim ( + n /n)n., lim ( + n /n)n = e, e, 2.78288284590452353602874735266249775724709369995. n 2.0000000000 2.0000000000000000 2.0000000000000000 5 2.48832022 2.488399999999999 2.488399999999994 0 2.5937430859 2.59374246000009 2.593742460000023 50 2.695805340 2.695880290736047 2.695880290736078 00 2.704830035 2.70483829425289 2.70483829425285 500 2.755508995 2.75568520656980 2.75568520657282 000 2.77049693 2.769239322355203 2.769239322355936 5000 2.780233002 2.78000500677 2.780005005549 0000 2.780233002 2.78459268243562 2.78459268249255 50000 2.725235233 2.78254646335386 2.7825464626732 00000 2.725235233 2.78268237975284 2.78268237922975 500000 2.754429872 2.782790298656 2.782790260366 000000 2.5946049690 2.78280469564275 2.782804690957534 5000000 3.292979773 2.7828555595598 2.7828555200292.0e+07 3.292979773 2.78286939803724 2.782869432088 5.0e+07.0000000000 2.782886570668 2.7828849349388.0e+08 2.78287863957975 2.78287983473577 5.0e+08 2.782872903208 2.78287488625042.0e+09 2.78282030845095 2.7828205205603 5.0e+09 2.782820434752482 2.782820530988732.0e+0 2.782820434752482 2.782820532347876 5.0e+0 2.7828203060255 2.78282053343588.0e+ 2.7828203060255 2.7828205335702 5.0e+ 2.78226686540404 2.7822696056250.0e+2 2.785234695682796 2.785234960372378 5.0e+2 2.792786740366 2.792796535723.0e+3 2.7600743422 2.7600340869009 5.0e+3 2.760008485276 2.7600340870092.0e+4 2.760008485276 2.7600340870226 5.0e+4 2.760004857476 2.7600340870337.0e+5 3.03503583962924 3.035035206549268 5.0e+5 3.0350358445453 3.0350352065492636.0e+6.0000000000000000.0000000000000000,. lim ( + n /n)n = (float), (double), (double), pow

8, e ( + /n) n 0 Method 2 0 Method 2 0. 0. 0.0 0.0 0.00 0.00 0.000 0.000 e-05 e-05 e-06 e-06 e-07 e-07 e-08 e-08 e-09 00 0000 e+06 e+08 e+0 e+2 e+4 e+6 e-09 00 0000 e+06 e+08 e+0 e+2 e+4 e+6 0 Method 3 5 0. 4 0.0 0.00 3 0.000 e-05 2 e-06 e-07 e-08 e-09 00 0000 e+06 e+08 e+0 e+2 e+4 e+6 0 00 0000 e+06 e+08 e+0 e+2 e+4 e+6, 0 0 0. 0. 0.0 0.0 0.00 0.00 0.000 0.000 e-05 e-05 e-06 e-06 e-07 e-07 e-08 e-08 e-09 00 0000 e+06 e+08 e+0 e+2 e+4 e+6 e-09 00 0000 e+06 e+08 e+0 e+2 e+4 e+6

9 (Solaris ) /* sample_0_2.c * (+/n)^n * */ #include <stdio.h> double power(double, unsigned long) ; unsigned long print_value[] =, 5, 0, 50, 00, 500, 000, 5000, 0000, 50000, 00000, 500000, 000000, 5000000, 0000000, 50000000, 00000000, 500000000, 000000000, 5000000000, 0000000000, 50000000000, 00000000000, 500000000000, 000000000000, 5000000000000, 0000000000000, 50000000000000, 00000000000000, 500000000000000, 000000000000000, 5000000000000000, 0000000000000000, 50000000000000000 ; int main(int argc, char **argv) int i ; int limit = sizeof(print_value)/sizeof(print_value[0]) ; for(i=0;i<limit;i++) fprintf(stdout, "%-6lu\t%8.6f\n", print_value[i], power((.0+.0/(double)print_value[i]), print_value[i])) ; return 0 ; double power(double x, unsigned long n) double x0 =.0, x = x ; while(n) if (n&) x0 *= x ; x *= x ; n >>= ; return x0 ;

0 (Linux ) /* sample_0_2.c * (+/n)^n * */ #include <stdio.h> double power(double, unsigned long long) ; unsigned long long print_value[] =, 5, 0, 50, 00, 500, 000, 5000, 0000, 50000, 00000, 500000, 000000, 5000000, 0000000, 50000000, 00000000, 500000000, 000000000, 5000000000, 0000000000, 50000000000, 00000000000, 500000000000, 000000000000, 5000000000000, 0000000000000, 50000000000000, 00000000000000, 500000000000000, 000000000000000, 5000000000000000, 0000000000000000, 50000000000000000 ; int main(int argc, char **argv) int i ; int limit = sizeof(print_value)/sizeof(print_value[0]) ; for(i=0;i<limit;i++) fprintf(stdout, "%-6lu\t%8.6f\n", print_value[i], power((.0+.0/(double)print_value[i]), print_value[i])) ; return 0 ; double power(double x, unsigned long long n) double x0 =.0, x = x ; while(n) if (n&) x0 *= x ; x *= x ; n >>= ; return x0 ;

.0 0, 0.0.,. lim ( + n /n)n, n, (+/n) n, gnuplot..,., Solaris unsigned long 8, Linux 4. Linux unsigned long long 8. lim n n/n lim sin(x)/x,., x 0. C pow, gcc foo.c -lm. -lm., IEEE754,. C, Java, Fortran, OCaml.