POV-Ray : Newsgroups : povray.off-topic : Why is 1e0 a float? : Why is 1e0 a float? Server Time
11 Oct 2024 07:12:27 EDT (-0400)
  Why is 1e0 a float?  
From: Shay
Date: 30 Oct 2007 23:13:46
Message: <472800fa$1@news.povray.org>
I noticed this while browsing through some stuff I'd cut and pasted into 
my .vimrc.

syn match Float "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
" floating point number, without dot, with exponent
" Author:	Jean-Marc Vanel <http://jmvanel.free.fr/>

Though this might be some kind of C thing, but tried it in Python:
 >>> 1+0
1
 >>> 2-1
1
 >>> 1*1
1
 >>> 1/1
1
 >>> 3%2
1
 >>> 1e0
1.0
 >>> pow(1,1)
1
 >>>

That last one especially throws me. Why is 1e0 a float? Simply to cover 
instances where NeN represents a float value with no decimal points 
anywhere in the expression? Is the language's interpretation that 
"dumb"? If that's the case, why doesn't pow always return a float?

Just curious.
  -Shay


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.