<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Arithmetic overflow error]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=105&amp;type=atom" />
	<updated>2012-06-26T14:03:31Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=105</id>
		<entry>
			<title type="html"><![CDATA[Re: Arithmetic overflow error]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=337#p337" />
			<content type="html"><![CDATA[<p>I find that changing to 9.46E12 seems to fix it; there is no need to change to real*8 or double.</p><p>I am not an F2008 user, so I cannot say why the initial construct of 9.46*10**12 is a problem, yet the later 150.0*10**6 is seemingly ok.</p><p>Regards</p>]]></content>
			<author>
				<name><![CDATA[petesun]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=460</uri>
			</author>
			<updated>2012-06-26T14:03:31Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=337#p337</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Arithmetic overflow error]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=336#p336" />
			<content type="html"><![CDATA[<p>Try using DOUBLE PRECISION or REAL*8<br />---<br />John</p>]]></content>
			<author>
				<name><![CDATA[JohnWasilewski]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=102</uri>
			</author>
			<updated>2012-06-25T22:11:45Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=336#p336</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Arithmetic overflow error]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=335#p335" />
			<content type="html"><![CDATA[<p>Hi,</p><p>I typed in&nbsp; an example Fortran code from a textbook. But when I compiled it, the arithmetic overflow error occurs. I am using a 64-bit computer. So I was thinking that all the numbers should be in the range. Please help identify what may cause this problem. The code and the compiler message were copied below.</p><p>program ch0504<br />implicit none<br />real :: Light_Minute, Distance, Elapse<br />integer :: Minute, Second<br />real , parameter :: Light_Year = 9.46*10**12<br />! Light_Year : Distance travelled by light<br />! in one year in km<br />! Light_Minute : Distance travelled by light<br />! in one minute in km<br />! Distance : Distance from sun to earth in km<br />! Elapse : Time taken to travel a <br />! distance (Distance) in minutes<br />! Minute : integer number part of elapse<br />! Second: integer number of seconds<br />! equivalent to fractional part of elapse<br />!<br />&nbsp; &nbsp; Light_Minute = Light_Year/(365.25*24.0*60.0)<br />&nbsp; &nbsp; Distance = 150.0*10**6<br />&nbsp; &nbsp; Elapse = Distance / Light_Minute<br />&nbsp; &nbsp; Minute = Elapse<br />&nbsp; &nbsp; Second = (Elapse - Minute) *60<br />&nbsp; &nbsp; print *, &#039;Light takes&#039;,Minute, &#039;Minutes&#039;<br />&nbsp; &nbsp; print *, &#039; &#039;,Second, &#039;Seconds&#039;<br />&nbsp; &nbsp; print *, &#039;to reach the earth from the sun&#039;<br />end program ch0504</p><p>-----------------------build status<br />==============================================================================<br />Open Watcom Make Version 1.9 (Modified 3 Mar 2012)<br />Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.<br />Source code is available under the Sybase Open Watcom Public License.<br />See <a href="http://www.openwatcom.org/">http://www.openwatcom.org/</a> for details.<br />&nbsp; &nbsp; &quot;C:\Program Files (x86)\Simply Fortran\mingw-w64\bin\gfortran.exe&quot; -c -o build\ch0504.o&nbsp; &nbsp;-Jmodules .\ch0504.f08<br />.\ch0504.f08:5.40:</p><p>real , parameter :: Light_Year = 9.46*10**12<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1<br />Error: Arithmetic overflow at (1)<br />.\ch0504.f08:17.29:</p><p>&nbsp; &nbsp; Light_Minute = Light_Year/(365.25*24.0*60.0)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br />Error: Symbol &#039;light_year&#039; at (1) has no IMPLICIT type<br />Error(E42): Last command making (build\ch0504.o) returned a bad status<br />Should this file be deleted [Yes/No] ? Error(E02): Make execution terminated</p><p>* Complete *</p>]]></content>
			<author>
				<name><![CDATA[weizhang]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=470</uri>
			</author>
			<updated>2012-06-25T19:02:40Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=335#p335</id>
		</entry>
</feed>
